Skip to content

Commit 64af17e

Browse files
committed
Tie IntEnum to proto enum
1 parent d5c6951 commit 64af17e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

temporalio/workflow.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5129,10 +5129,12 @@ class NexusOperationCancellationType(IntEnum):
51295129
of this enum define what is guaranteed to have happened by that point.
51305130
"""
51315131

5132-
ABANDON = 1
5132+
ABANDON = int(temporalio.bridge.proto.nexus.NexusOperationCancellationType.ABANDON)
51335133
"""Do not send any cancellation request to the operation handler; just report cancellation to the caller"""
51345134

5135-
TRY_CANCEL = 2
5135+
TRY_CANCEL = int(
5136+
temporalio.bridge.proto.nexus.NexusOperationCancellationType.TRY_CANCEL
5137+
)
51365138
"""Send a cancellation request but immediately report cancellation to the caller. Note that this
51375139
does not guarantee that cancellation is delivered to the operation handler if the caller exits
51385140
before the delivery is done.
@@ -5141,13 +5143,17 @@ class NexusOperationCancellationType(IntEnum):
51415143
# TODO(nexus-preview): core needs to be updated to handle
51425144
# NexusOperationCancelRequestCompleted and NexusOperationCancelRequestFailed
51435145
# see https://github.com/temporalio/sdk-core/issues/911
5144-
# WAIT_REQUESTED = 3
5146+
# WAIT_REQUESTED = int(
5147+
# temporalio.bridge.proto.nexus.NexusOperationCancellationType.WAIT_CANCELLATION_REQUESTED
5148+
# )
51455149
# """Send a cancellation request and wait for confirmation that the request was received.
51465150
# Does not wait for the operation to complete.
51475151
# """
51485152

5149-
WAIT_COMPLETED = 0
5150-
"""Send a cancellation request and wait for the operation to complete. This is the default.
5153+
WAIT_COMPLETED = int(
5154+
temporalio.bridge.proto.nexus.NexusOperationCancellationType.WAIT_CANCELLATION_COMPLETED
5155+
)
5156+
"""Send a cancellation request and wait for the operation to complete.
51515157
Note that the operation may not complete as cancelled (for example, if it catches the
51525158
:py:exc:`asyncio.CancelledError` resulting from the cancellation request)."""
51535159

0 commit comments

Comments
 (0)