new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Temporal · Develop · all subjects

nexus/cancellation

8 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Cancel Nexus Operation from caller Workflow

To cancel a Nexus Operation from within a Workflow, create a Go context using workflow.WithCancel API, which returns a new context and a cancel function. When called, the cancel function cancels the context and any SDK method passed this context. Only asynchronous operations can be canceled in Nexus, as cancelation is sent using an operation token. The Workflow or other resources backing the operation may choose to ignore the cancelation request. Once the caller Workflow completes, the caller's Nexus Machinery will not make further attempts to cancel operations that are still running.

Canceling Nexus Operations from Workflow

To cancel a Nexus Operation from within a Workflow, create a CancellationScope using Workflow.newCancellationScope API. Any SDK methods started in this scope, such as Nexus operations, will be associated with it. Call cancel() on the scope to cancel the context and any SDK method started in the scope. Only asynchronous operations can be canceled, as cancelation is sent using an operation token.

Cancel a Nexus Operation from Workflow

To cancel a Nexus Operation from within a Workflow, call `handle.cancel()` on the operation handle. Only asynchronous operations can be canceled in Nexus, since cancellation is sent using an operation token. The Workflow or other resources backing the operation may choose to ignore the cancellation request. If ignored, the operation may enter a terminal state.

Nexus Operation cancellation types

When a Nexus operation is started, the caller can specify different cancellation types that control how the caller reacts to cancellation: - `ABANDON` - Do not request cancellation of the operation. - `TRY_CANCEL` - Initiate a cancellation request and immediately report cancellation to the caller. Note this type doesn't guarantee cancellation is delivered if the caller exits before delivery. - `WAIT_REQUESTED` - Request cancellation of the operation and wait for confirmation that the request was received. Doesn't wait for actual cancellation. - `WAIT_COMPLETED` - Wait for operation completion. Operation may or may not complete as cancelled. The default is `WAIT_COMPLETED`. Users can set a different option for `cancellation_type` when starting or executing an operation.

Nexus Operation lifecycle after caller Workflow completes

Once the caller Workflow completes, the caller's Nexus Machinery will not make any further attempts to cancel operations that are still running. It is okay to leave operations running in some use cases. To ensure cancellations are delivered, wait for all pending operations to finish before exiting the Workflow.

Nexus Operations execute within Cancellation Scopes

Nexus Operations execute within Cancellation Scopes. Requesting cancellation of a Cancellation Scope results in requesting cancellation for all cancellable operations owned by that scope. The Workflow itself defines the root Cancellation Scope. Requesting cancellation of the Workflow propagates cancellation to all cancellable operations including Nexus Operations. Create explicit Cancellation Scopes for more granular control over specific Nexus Operation cancellation.

Only asynchronous Nexus Operations can be canceled

Only asynchronous Nexus Operations can be canceled, since cancellation is sent using an operation token. Synchronous operations do not support cancellation. The Workflow or other resources backing the operation may choose to ignore the cancellation request.

Ensure Nexus cancellations are delivered before workflow exit

Once the caller Workflow completes, the caller's Nexus Machinery will not make any further attempts to cancel operations that are still running. To ensure cancellations are delivered, wait for all pending operations to finish before exiting the Workflow. It is okay to leave operations running in some use cases, but cancellation delivery is not guaranteed after workflow completion.

Give your agent this brain