We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking "Accept", you agree to our use of cookies.
Learn more.

Runs Client

The runs client is a client for interacting with task and workflow runs within Hatchet.

Methods

branchDurableTask()

Fork (reset) a durable task from a specific node, triggering re-execution from that point.

Parameters

ParameterTypeDefault valueDescription
taskExternalIdstringundefinedThe external ID of the durable task to reset.
nodeIdnumberundefinedThe node ID to replay from.
branchIdnumber0-

Returns

Promise<AxiosResponse<V1BranchDurableTaskResponse, any, { }>>

cancel()

Cancels a task or workflow run by its ID.

Parameters

ParameterTypeDescription
optsCancelRunOptsThe options for the cancel operation.

Returns

Promise<AxiosResponse<V1CancelledTasks, any, { }>>

A promise that resolves to the cancelled run.

get()

Gets a task or workflow run by its ID.

Parameters

ParameterTypeDescription
runstring | WorkflowRunRef<T>The ID of the run to get.

Returns

Promise<V1WorkflowRunDetails>

A promise that resolves to the run.

get_status()

Gets the status of a task or workflow run by its ID.

Parameters

ParameterTypeDescription
runstring | WorkflowRunRef<T>The ID of the run to get the status of.

Returns

Promise<V1TaskStatus>

A promise that resolves to the status of the run.

getTaskExternalId()

Resolve the task external ID for a workflow run. For runs with multiple tasks, returns the first task’s external ID.

Parameters

ParameterTypeDescription
workflowRunIdstringThe workflow run ID to look up.

Returns

Promise<string>

The task external ID.

list()

Lists all task and workflow runs for the current tenant.

Parameters

ParameterTypeDescription
opts?Partial<ListRunsOpts>The options for the list operation.

Returns

Promise<V1TaskSummaryList>

A promise that resolves to the list of runs.

replay()

Replays a task or workflow run by its ID.

Parameters

ParameterTypeDescription
optsReplayRunOptsThe options for the replay operation.

Returns

Promise<AxiosResponse<V1ReplayedTasks, any, { }>>

A promise that resolves to the replayed run.

restoreTask()

Restore an evicted durable task so it can resume execution.

Parameters

ParameterTypeDescription
taskExternalIdstringThe external ID of the evicted task.

Returns

Promise<AxiosResponse<V1RestoreTaskResponse, any, { }>>

subscribeToStream()

Subscribes to a stream of events for a task or workflow run by its ID.

Parameters

ParameterTypeDescription
workflowRunIdstringThe ID of the run to subscribe to.

Returns

AsyncIterableIterator<string>

A promise that resolves to the stream of events.