Skip to content

Commit 1af4a55

Browse files
committed
Add additional overloads
1 parent b2cce8c commit 1af4a55

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

temporalio/nexus/_operation_context.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99
from datetime import timedelta
1010
from typing import (
1111
Any,
12+
Awaitable,
1213
Callable,
1314
Mapping,
1415
MutableMapping,
1516
Optional,
1617
Sequence,
18+
Type,
1719
Union,
20+
overload,
1821
)
1922

2023
import nexusrpc.handler
@@ -194,6 +197,7 @@ def from_start_operation_context(
194197

195198
# Overload for single-param workflow
196199
# TODO(nexus-prerelease)*: bring over other overloads
200+
@overload
197201
async def start_workflow(
198202
self,
199203
workflow: MethodAsyncSingleParam[SelfType, ParamType, ReturnType],
@@ -225,6 +229,41 @@ async def start_workflow(
225229
request_eager_start: bool = False,
226230
priority: temporalio.common.Priority = temporalio.common.Priority.default,
227231
versioning_override: Optional[temporalio.common.VersioningOverride] = None,
232+
) -> WorkflowHandle[ReturnType]: ...
233+
234+
async def start_workflow(
235+
self,
236+
workflow: Union[str, Callable[..., Awaitable[ReturnType]]],
237+
arg: Any = temporalio.common._arg_unset,
238+
*,
239+
args: Sequence[Any] = [],
240+
id: str,
241+
task_queue: Optional[str] = None,
242+
result_type: Optional[Type] = None,
243+
execution_timeout: Optional[timedelta] = None,
244+
run_timeout: Optional[timedelta] = None,
245+
task_timeout: Optional[timedelta] = None,
246+
id_reuse_policy: temporalio.common.WorkflowIDReusePolicy = temporalio.common.WorkflowIDReusePolicy.ALLOW_DUPLICATE,
247+
id_conflict_policy: temporalio.common.WorkflowIDConflictPolicy = temporalio.common.WorkflowIDConflictPolicy.UNSPECIFIED,
248+
retry_policy: Optional[temporalio.common.RetryPolicy] = None,
249+
cron_schedule: str = "",
250+
memo: Optional[Mapping[str, Any]] = None,
251+
search_attributes: Optional[
252+
Union[
253+
temporalio.common.TypedSearchAttributes,
254+
temporalio.common.SearchAttributes,
255+
]
256+
] = None,
257+
static_summary: Optional[str] = None,
258+
static_details: Optional[str] = None,
259+
start_delay: Optional[timedelta] = None,
260+
start_signal: Optional[str] = None,
261+
start_signal_args: Sequence[Any] = [],
262+
rpc_metadata: Mapping[str, str] = {},
263+
rpc_timeout: Optional[timedelta] = None,
264+
request_eager_start: bool = False,
265+
priority: temporalio.common.Priority = temporalio.common.Priority.default,
266+
versioning_override: Optional[temporalio.common.VersioningOverride] = None,
228267
) -> WorkflowHandle[ReturnType]:
229268
"""Start a workflow that will deliver the result of the Nexus operation.
230269
@@ -266,8 +305,10 @@ async def start_workflow(
266305
wf_handle = await self.temporal_context.client.start_workflow( # type: ignore
267306
workflow=workflow,
268307
arg=arg,
308+
args=args,
269309
id=id,
270310
task_queue=task_queue or self.temporal_context.info().task_queue,
311+
result_type=result_type,
271312
execution_timeout=execution_timeout,
272313
run_timeout=run_timeout,
273314
task_timeout=task_timeout,

0 commit comments

Comments
 (0)