1515
1616import inspect
1717from functools import wraps
18- from typing import Optional , TypeVar
18+ from typing import Optional , TypeVar , Union , Sequence
19+ import grpc
1920
2021from durabletask import worker , task
2122
3435TInput = TypeVar ('TInput' )
3536TOutput = TypeVar ('TOutput' )
3637
38+ ClientInterceptor = Union [
39+ grpc .UnaryUnaryClientInterceptor ,
40+ grpc .UnaryStreamClientInterceptor ,
41+ grpc .StreamUnaryClientInterceptor ,
42+ grpc .StreamStreamClientInterceptor
43+ ]
3744
3845class WorkflowRuntime :
3946 """WorkflowRuntime is the entry point for registering workflows and activities."""
@@ -43,6 +50,10 @@ def __init__(
4350 host : Optional [str ] = None ,
4451 port : Optional [str ] = None ,
4552 logger_options : Optional [LoggerOptions ] = None ,
53+ interceptors : Optional [Sequence [ClientInterceptor ]] = None ,
54+ maximum_concurrent_activity_work_items : Optional [int ] = None ,
55+ maximum_concurrent_orchestration_work_items : Optional [int ] = None ,
56+ maximum_thread_pool_workers : Optional [int ] = None ,
4657 ):
4758 self ._logger = Logger ('WorkflowRuntime' , logger_options )
4859 metadata = tuple ()
@@ -62,6 +73,12 @@ def __init__(
6273 secure_channel = uri .tls ,
6374 log_handler = options .log_handler ,
6475 log_formatter = options .log_formatter ,
76+ interceptors = interceptors ,
77+ concurrency_options = worker .ConcurrencyOptions (
78+ maximum_concurrent_activity_work_items = maximum_concurrent_activity_work_items ,
79+ maximum_concurrent_orchestration_work_items = maximum_concurrent_orchestration_work_items ,
80+ maximum_thread_pool_workers = maximum_thread_pool_workers ,
81+ ),
6582 )
6683
6784 def register_workflow (self , fn : Workflow , * , name : Optional [str ] = None ):
0 commit comments