class OperationTaskCancellation(ABC):
Indicates whether a a Nexus task has been cancelled during a sync operation or before an async operation has returned a token.
Nexus worker implementations are expected to provide an implementation that enables cooperative cancellation for both sync and async operation handlers.
Operation Handler implementations are expected to periodically check is_cancelled or use wait_until_cancelled / wait_until_cancelled_sync to cancel in flight work when appropriate.
| Method | cancellation |
Provide additional context for the cancellation, if available. |
| Method | is |
Return True if the associated task has been cancelled. |
| Async Method | wait |
Await cancellation using async primitives. Nexus worker implementations may return True for is_cancelled before this method returns and therefore may cause a race condition if both are used in tandem. |
| Method | wait |
Block until cancellation occurs or the optional timeout elapses. Nexus worker implementations may return True for is_cancelled before this method returns and therefore may cause a race condition if both are used in tandem. |
Await cancellation using async primitives. Nexus worker implementations may return True for is_cancelled before this method returns and therefore may cause a race condition if both are used in tandem.
Block until cancellation occurs or the optional timeout elapses. Nexus worker implementations may return True for is_cancelled before this method returns and therefore may cause a race condition if both are used in tandem.