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+ ]
44+
3745
3846class WorkflowRuntime :
3947 """WorkflowRuntime is the entry point for registering workflows and activities."""
@@ -43,6 +51,10 @@ def __init__(
4351 host : Optional [str ] = None ,
4452 port : Optional [str ] = None ,
4553 logger_options : Optional [LoggerOptions ] = None ,
54+ interceptors : Optional [Sequence [ClientInterceptor ]] = None ,
55+ maximum_concurrent_activity_work_items : Optional [int ] = None ,
56+ maximum_concurrent_orchestration_work_items : Optional [int ] = None ,
57+ maximum_thread_pool_workers : Optional [int ] = None ,
4658 ):
4759 self ._logger = Logger ('WorkflowRuntime' , logger_options )
4860 metadata = tuple ()
@@ -62,6 +74,12 @@ def __init__(
6274 secure_channel = uri .tls ,
6375 log_handler = options .log_handler ,
6476 log_formatter = options .log_formatter ,
77+ interceptors = interceptors ,
78+ concurrency_options = worker .ConcurrencyOptions (
79+ maximum_concurrent_activity_work_items = maximum_concurrent_activity_work_items ,
80+ maximum_concurrent_orchestration_work_items = maximum_concurrent_orchestration_work_items ,
81+ maximum_thread_pool_workers = maximum_thread_pool_workers ,
82+ ),
6583 )
6684
6785 def register_workflow (self , fn : Workflow , * , name : Optional [str ] = None ):
0 commit comments