Skip to content

Commit 6c50143

Browse files
committed
address comments 2, fix docstrings, clarify signatures and errors
1 parent 5a61843 commit 6c50143

6 files changed

Lines changed: 13 additions & 13 deletions

File tree

temporalio/client/_interceptor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ class StartWorkflowUpdateInput:
322322
ret_type: type | None
323323
rpc_metadata: Mapping[str, str | bytes]
324324
rpc_timeout: timedelta | None
325-
# The following options are for Nexus Operation-backed updates. Experimental and unstable
325+
# The following options are for Workflow Updates exposed as Nexus Operations. Experimental and unstable
326326
callbacks: Sequence[Callback] | None = None
327327
links: Sequence[temporalio.api.common.v1.Link] | None = None
328328
request_id: str | None = None

temporalio/client/_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ async def _start_update(
956956
result_type: type | None = None,
957957
rpc_metadata: Mapping[str, str | bytes] = {},
958958
rpc_timeout: timedelta | None = None,
959-
# The following options are for Nexus Operation-backed updates. Experimental and unstable
959+
# The following options are for Workflow Updates exposed as Nexus Operations. Experimental and unstable
960960
callbacks: Sequence[Callback] | None = None,
961961
links: Sequence[temporalio.api.common.v1.Link] | None = None,
962962
request_id: str | None = None,

temporalio/nexus/_operation_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ async def _start_nexus_backing_workflow(
717717
return WorkflowHandle[ReturnType]._unsafe_from_client_workflow_handle(wf_handle)
718718

719719

720-
async def _start_nexus_backed_workflow_update( # pyright: ignore[reportUnusedFunction]
720+
async def _start_nexus_operation_workflow_update( # pyright: ignore[reportUnusedFunction]
721721
*,
722722
temporal_context: _TemporalStartOperationContext,
723723
workflow_id: str,

temporalio/nexus/_operation_handlers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class CancelUpdateWorkflowOptions:
154154
update_id: str
155155
"""The ID of the update to cancel."""
156156
run_id: str
157-
"""The workflow runID that accepted the update"""
157+
"""The workflow runID that accepted the update."""
158158

159159

160160
class TemporalOperationHandler(OperationHandler[InputT, OutputT], ABC):
@@ -239,17 +239,17 @@ async def cancel_workflow_update(
239239
ctx: TemporalCancelOperationContext, # pyright: ignore[reportUnusedParameter]
240240
options: CancelUpdateWorkflowOptions, # pyright: ignore[reportUnusedParameter]
241241
) -> None:
242-
"""Cancels the workflow update backing the Nexus operation. Cancellation is not natively supported for update-workflow Nexus operations.
243-
Inherit a TemporalOperationHandler and override this method to run cancellable workflow updates.
242+
"""Cancels the Workflow Update triggered by the Nexus operation. There is no native way to cancel an accepted Update, so cancellation depends on the Update handler itself.
243+
Override this method and coordinate with the specific Update handler to trigger a cancellation.
244244
245245
246246
.. warning::
247247
This API is experimental and unstable.
248248
"""
249249
raise HandlerError(
250250
"""
251-
Cancellation is not natively supported for update-workflow Nexus operations.
252-
Inherit a TemporalOperationHandler and override this method to run cancellable workflow updates.
251+
There is no native way to cancel an accepted Update, so cancellation depends on the Update handler itself.
252+
Override this method and coordinate with the specific Update handler to trigger a cancellation.
253253
""",
254254
type=HandlerErrorType.NOT_IMPLEMENTED,
255255
)

temporalio/nexus/_temporal_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
import temporalio.common
2323
from temporalio.nexus._operation_context import (
24-
_start_nexus_backed_workflow_update,
2524
_start_nexus_backing_workflow,
25+
_start_nexus_operation_workflow_update,
2626
_TemporalStartOperationContext,
2727
)
2828
from temporalio.types import (
@@ -361,7 +361,7 @@ async def start_workflow_update(
361361
run_id: str | None = None,
362362
first_execution_run_id: str | None = None,
363363
) -> TemporalOperationResult[Any]:
364-
"""Start a workflow update as the backing asynchronous Nexus operation.
364+
"""Start a Workflow Update-backed Nexus Operation.
365365
366366
.. warning::
367367
This API is experimental and unstable.
@@ -481,14 +481,14 @@ async def start_workflow_update(
481481
run_id: str | None = None,
482482
first_execution_run_id: str | None = None,
483483
) -> TemporalOperationResult[Any]:
484-
"""Start a workflow update as the backing asynchronous Nexus operation."""
484+
"""Start a Workflow Update-backed Nexus Operation."""
485485
if not self._temporal_context.nexus_context.callback_url:
486486
raise HandlerError(
487487
"callback URL is required for a workflow update Nexus operation",
488488
type=HandlerErrorType.BAD_REQUEST,
489489
)
490490
with self._reserve_async_start():
491-
update_handle = await _start_nexus_backed_workflow_update(
491+
update_handle = await _start_nexus_operation_workflow_update(
492492
temporal_context=self._temporal_context,
493493
workflow_id=workflow_id,
494494
update=update,

temporalio/nexus/_token.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def decode(cls, token: str) -> Self:
107107
update_id = token_details.get("uid")
108108
if not isinstance(update_id, str | None):
109109
raise TypeError(
110-
f"invalid token: expected update_id id to be a string or None, got {type(update_id)}"
110+
f"invalid token: expected update_id to be a string or None, got {type(update_id)}"
111111
)
112112

113113
if token_type == OperationTokenType.UPDATE_WORKFLOW and not update_id:

0 commit comments

Comments
 (0)