Skip to content

Commit f959f90

Browse files
committed
Adds support for interceptors and concurrency_options arguments in the workflow engine
Signed-off-by: Albert Callarisa <[email protected]>
1 parent ae3e592 commit f959f90

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

ext/dapr-ext-workflow/dapr/ext/workflow/workflow_runtime.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
import inspect
1717
from functools import wraps
18-
from typing import Optional, TypeVar
18+
from typing import Optional, TypeVar, Union, Sequence
19+
import grpc
1920

2021
from durabletask import worker, task
2122

@@ -34,6 +35,13 @@
3435
TInput = TypeVar('TInput')
3536
TOutput = TypeVar('TOutput')
3637

38+
ClientInterceptor = Union[
39+
grpc.UnaryUnaryClientInterceptor,
40+
grpc.UnaryStreamClientInterceptor,
41+
grpc.StreamUnaryClientInterceptor,
42+
grpc.StreamStreamClientInterceptor,
43+
]
44+
3745

3846
class 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

Comments
 (0)