Cancel Workflow Execution

async AsyncCogniteClient.workflows.executions.cancel(
id: str,
reason: str | None,
) WorkflowExecution

Cancel a workflow execution.

Note

Cancelling a workflow will immediately cancel the in_progress tasks, but not their spawned work in other services (like transformations and functions).

Parameters:
  • id (str) – The server-generated id of the workflow execution.

  • reason (str | None) – The reason for the cancellation, this will be put within the execution’s reasonForIncompletion field. It is defaulted to ‘cancelled’ if not provided.

Returns:

The canceled workflow execution.

Return type:

WorkflowExecution

Examples

Trigger a workflow execution for the workflow “foo”, version 1 and cancel it:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> res = client.workflows.executions.run("foo", "1")
>>> client.workflows.executions.cancel(id="foo", reason="test cancellation")