Skip to content

Commit 79f2ccc

Browse files
committed
Add NexusOperationCancellationType enum
1 parent 126bcd8 commit 79f2ccc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

temporalio/workflow.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5117,6 +5117,32 @@ def _to_proto(self) -> temporalio.bridge.proto.common.VersioningIntent.ValueType
51175117
ServiceT = TypeVar("ServiceT")
51185118

51195119

5120+
class NexusOperationCancellationType(IntEnum):
5121+
"""Defines behavior of the parent workflow when CancellationScope that wraps Nexus operation
5122+
is canceled. The result of the cancellation independently of the type is a
5123+
CanceledFailure thrown from the Nexus operation method. If the caller exits without waiting, the
5124+
cancellation request may not be delivered to the handler, regardless of indicated cancellation
5125+
type.
5126+
"""
5127+
5128+
WAIT_COMPLETED = 0
5129+
"""Wait for operation completion. Operation may or may not complete as cancelled. Default."""
5130+
5131+
ABANDON = 1
5132+
"""Do not request cancellation of the operation."""
5133+
5134+
TRY_CANCEL = 2
5135+
"""Initiate a cancellation request and immediately report cancellation to the caller. Note that it
5136+
doesn't guarantee that cancellation is delivered to the operation handler if the caller exits
5137+
before the delivery is done.
5138+
"""
5139+
5140+
WAIT_REQUESTED = 3
5141+
"""Request cancellation of the operation and wait for confirmation that the request was received.
5142+
Doesn't wait for actual cancellation.
5143+
"""
5144+
5145+
51205146
class NexusClient(ABC, Generic[ServiceT]):
51215147
"""A client for invoking Nexus operations.
51225148

0 commit comments

Comments
 (0)