Skip to content

Commit 5a868c0

Browse files
committed
Document entrypoint functions
1 parent c44306f commit 5a868c0

File tree

1 file changed

+81
-10
lines changed

1 file changed

+81
-10
lines changed

temporalio/client.py

Lines changed: 81 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,40 @@ async def execute_update_with_start( # type: ignore
851851
rpc_metadata: Mapping[str, str] = {},
852852
rpc_timeout: Optional[timedelta] = None,
853853
) -> Any:
854+
"""Send an update-with-start request and wait for the update to complete.
855+
856+
A WorkflowIDConflictPolicy must be set in the start_workflow_operation. If the
857+
specified workflow execution is not running, a new workflow execution is started
858+
and the update is sent in the first workflow task. Alternatively if the specified
859+
workflow execution is running then, if the WorkflowIDConflictPolicy is
860+
USE_EXISTING, the update is issued against the specified workflow, and if the
861+
WorkflowIDConflictPolicy is FAIL, an error is returned. This call will block until
862+
the update has completed, and return the update result. Note that this means that
863+
the call will not return successfully until the update has been delivered to a
864+
worker.
865+
866+
Args:
867+
update: Update function or name on the workflow. arg: Single argument to the
868+
update. args: Multiple arguments to the update. Cannot be set if arg is.
869+
start_workflow_operation: a WithStartWorkflowOperation definining the
870+
WorkflowIDConflictPolicy and how to start the workflow in the event that a
871+
workflow is started.
872+
id: ID of the update. If not set, the default is a new UUID. result_type: For
873+
string updates, this can set the specific result
874+
type hint to deserialize into.
875+
rpc_metadata: Headers used on the RPC call. Keys here override
876+
client-level RPC metadata keys.
877+
rpc_timeout: Optional RPC deadline to set for the RPC call.
878+
879+
Raises:
880+
WorkflowUpdateFailedError: If the update failed.
881+
WorkflowUpdateRPCTimeoutOrCancelledError: This update call timed out
882+
or was cancelled. This doesn't mean the update itself was timed out or
883+
cancelled.
884+
885+
RPCError: There was some issue starting the workflow or sending the update to
886+
the workflow.
887+
"""
854888
handle = await self._start_update_with_start(
855889
update,
856890
arg,
@@ -940,6 +974,43 @@ async def start_update_with_start( # type: ignore
940974
rpc_metadata: Mapping[str, str] = {},
941975
rpc_timeout: Optional[timedelta] = None,
942976
) -> WorkflowUpdateHandle[Any]:
977+
"""Send an update-with-start request and wait for it to be accepted.
978+
979+
A WorkflowIDConflictPolicy must be set in the start_workflow_operation. If the
980+
specified workflow execution is not running, a new workflow execution is started
981+
and the update is sent in the first workflow task. Alternatively if the specified
982+
workflow execution is running then, if the WorkflowIDConflictPolicy is
983+
USE_EXISTING, the update is issued against the specified workflow, and if the
984+
WorkflowIDConflictPolicy is FAIL, an error is returned. This call will block until
985+
the update has been accepted, and return a WorkflowUpdateHandle. Note that this
986+
means that the call will not return successfully until the update has been
987+
delivered to a worker.
988+
989+
Args:
990+
update: Update function or name on the workflow. arg: Single argument to the
991+
update. args: Multiple arguments to the update. Cannot be set if arg is.
992+
start_workflow_operation: a WithStartWorkflowOperation definining the
993+
WorkflowIDConflictPolicy and how to start the workflow in the event that a
994+
workflow is started.
995+
wait_for_stage: Required stage to wait until returning: either ACCEPTED or
996+
COMPLETED. ADMITTED is not currently supported. See
997+
https://docs.temporal.io/workflows#update for more details.
998+
id: ID of the update. If not set, the default is a new UUID. result_type: For
999+
string updates, this can set the specific result
1000+
type hint to deserialize into.
1001+
rpc_metadata: Headers used on the RPC call. Keys here override
1002+
client-level RPC metadata keys.
1003+
rpc_timeout: Optional RPC deadline to set for the RPC call.
1004+
1005+
Raises:
1006+
WorkflowUpdateFailedError: If the update failed.
1007+
WorkflowUpdateRPCTimeoutOrCancelledError: This update call timed out
1008+
or was cancelled. This doesn't mean the update itself was timed out or
1009+
cancelled.
1010+
1011+
RPCError: There was some issue starting the workflow or sending the update to
1012+
the workflow.
1013+
"""
9431014
return await self._start_update_with_start(
9441015
update,
9451016
arg,
@@ -2186,23 +2257,23 @@ async def start_update(
21862257
unrelated to the started workflow.
21872258
21882259
Args:
2189-
update: Update function or name on the workflow.
2190-
arg: Single argument to the update.
2191-
wait_for_stage: Required stage to wait until returning. ADMITTED is
2192-
not currently supported. See https://docs.temporal.io/workflows#update
2193-
for more details.
2194-
args: Multiple arguments to the update. Cannot be set if arg is.
2195-
id: ID of the update. If not set, the default is a new UUID.
2196-
result_type: For string updates, this can set the specific result
2260+
update: Update function or name on the workflow. arg: Single argument to the
2261+
update.
2262+
wait_for_stage: Required stage to wait until returning: either ACCEPTED or
2263+
COMPLETED. ADMITTED is not currently supported. See
2264+
https://docs.temporal.io/workflows#update for more details.
2265+
args: Multiple arguments to the update. Cannot be set if arg is. id: ID of the
2266+
update. If not set, the default is a new UUID. result_type: For string
2267+
updates, this can set the specific result
21972268
type hint to deserialize into.
21982269
rpc_metadata: Headers used on the RPC call. Keys here override
21992270
client-level RPC metadata keys.
22002271
rpc_timeout: Optional RPC deadline to set for the RPC call.
22012272
22022273
Raises:
22032274
WorkflowUpdateRPCTimeoutOrCancelledError: This update call timed out
2204-
or was cancelled. This doesn't mean the update itself was timed
2205-
out or cancelled.
2275+
or was cancelled. This doesn't mean the update itself was timed out or
2276+
cancelled.
22062277
RPCError: There was some issue sending the update to the workflow.
22072278
"""
22082279
return await self._start_update(

0 commit comments

Comments
 (0)