|
22 | 22 | cast, |
23 | 23 | ) |
24 | 24 |
|
| 25 | +from temporalio.bridge.worker import WorkerTaskTypes |
25 | 26 | from typing_extensions import TypeAlias, TypedDict |
26 | 27 |
|
27 | 28 | import temporalio.bridge.worker |
@@ -124,7 +125,6 @@ def __init__( |
124 | 125 | max_concurrent_workflow_task_polls: Optional[int] = None, |
125 | 126 | nonsticky_to_sticky_poll_ratio: float = 0.2, |
126 | 127 | max_concurrent_activity_task_polls: Optional[int] = None, |
127 | | - no_remote_activities: bool = False, |
128 | 128 | sticky_queue_schedule_to_start_timeout: timedelta = timedelta(seconds=10), |
129 | 129 | max_heartbeat_throttle_interval: timedelta = timedelta(seconds=60), |
130 | 130 | default_heartbeat_throttle_interval: timedelta = timedelta(seconds=30), |
@@ -251,8 +251,6 @@ def __init__( |
251 | 251 | If set, will override any value passed to ``activity_task_poller_behavior``. |
252 | 252 |
|
253 | 253 | WARNING: Deprecated, use ``activity_task_poller_behavior`` instead |
254 | | - no_remote_activities: If true, this worker will only handle workflow |
255 | | - tasks and local activities, it will not poll for activity tasks. |
256 | 254 | sticky_queue_schedule_to_start_timeout: How long a workflow task is |
257 | 255 | allowed to sit on the sticky queue before it is timed out and |
258 | 256 | moved to the non-sticky queue where it may be picked up by any |
@@ -346,7 +344,6 @@ def __init__( |
346 | 344 | max_concurrent_workflow_task_polls=max_concurrent_workflow_task_polls, |
347 | 345 | nonsticky_to_sticky_poll_ratio=nonsticky_to_sticky_poll_ratio, |
348 | 346 | max_concurrent_activity_task_polls=max_concurrent_activity_task_polls, |
349 | | - no_remote_activities=no_remote_activities, |
350 | 347 | sticky_queue_schedule_to_start_timeout=sticky_queue_schedule_to_start_timeout, |
351 | 348 | max_heartbeat_throttle_interval=max_heartbeat_throttle_interval, |
352 | 349 | default_heartbeat_throttle_interval=default_heartbeat_throttle_interval, |
@@ -576,11 +573,11 @@ def check_activity(activity): |
576 | 573 | max_cached_workflows=config["max_cached_workflows"], |
577 | 574 | tuner=bridge_tuner, |
578 | 575 | nonsticky_to_sticky_poll_ratio=config["nonsticky_to_sticky_poll_ratio"], |
579 | | - # We have to disable remote activities if a user asks _or_ if we |
580 | | - # are not running an activity worker at all. Otherwise shutdown |
581 | | - # will not proceed properly. |
582 | | - no_remote_activities=config["no_remote_activities"] |
583 | | - or not config["activities"], |
| 576 | + task_types=WorkerTaskTypes( |
| 577 | + enable_workflows=self._workflow_worker is not None, |
| 578 | + enable_activities=self._activity_worker is not None, |
| 579 | + enable_nexus=self._nexus_worker is not None, |
| 580 | + ), |
584 | 581 | sticky_queue_schedule_to_start_timeout_millis=int( |
585 | 582 | 1000 |
586 | 583 | * config["sticky_queue_schedule_to_start_timeout"].total_seconds() |
@@ -890,7 +887,6 @@ class WorkerConfig(TypedDict, total=False): |
890 | 887 | max_concurrent_workflow_task_polls: Optional[int] |
891 | 888 | nonsticky_to_sticky_poll_ratio: float |
892 | 889 | max_concurrent_activity_task_polls: Optional[int] |
893 | | - no_remote_activities: bool |
894 | 890 | sticky_queue_schedule_to_start_timeout: timedelta |
895 | 891 | max_heartbeat_throttle_interval: timedelta |
896 | 892 | default_heartbeat_throttle_interval: timedelta |
|
0 commit comments