This feature is not yet available in
workflow-py. See our
Roadmap for feature parity plans and
Changelog for updates.
- cancel a running workflow run
- notify a workflow run waiting for an event
- get workflow runs waiting for some event
Trigger Workflow
Using thetrigger
method, you can start a workflow run and get its run id.
failureUrl
and useFailureFunction
are provided, useFailureFunction
takes precedence and the value of the url
parameter is used as failureUrl
.
If workflowRunId
parameter isn’t passed, a run id will be generated randomly. If workflowRunId
is passed, wfr_
prefix will be added to it.
For other alternatives of starting a workflow, see the documentation on starting a workflow run.
Get Workflow Logs
Using thelog
method, you can use the List Workflow Runs API:
cursor
and runs
. Using the cursor
, you can continue the search later.
runs
will be a list of runs. Each run has these fields:
workflowRunId
: ID of the workflowworkflowUrl
: URL of the workflowworkflowState
: State of the workflow run.workflowRunCreatedAt
: number; Time when the workflow run started (as unix timestamp)workflowRunCompletedAt
; If run has completed, time when workflow run completed (as unix timestamp)failureFunction
: Information on the message published when the workflow failed andfailureUrl
orfailureFunction
were calleddlqId
: If the workflow run has failed, DLQ id associated with the workflow run.workflowRunResponse
: Result returned at the end of the workflow.invoker
: If the workflow was invoked; run id, url and created time of the invoking workflow.steps
: List of steps showing the progress of the workflow.
steps
field contains a list of steps. Each step is in one of the following three formats:
Cancel Workflow Runs
There are multiple ways you can cancel workflow runs:- pass one or more workflow run ids to cancel them
- pass a workflow url to cancel all runs starting with this url
- cancel all pending or active workflow runs
Cancel a set of workflow runs
Cancel workflows starting with a url
If you have an endpoint calledhttps://your-endpoint.com
and you
want to cancel all workflow runs on it, you can use urlStartingWith
.
Note that this will cancel workflows in all endpoints under
https://your-endpoint.com
.
Cancel all workflows
To cancel all pending and currently running workflows, you can do it like this:Dead Letter Queue (DLQ)
The DLQ functionality allows you to manage failed workflow runs that have been moved to the dead letter queue.List DLQ Messages
Resume Failed Workflows
Resume a workflow from where it failed:Restart Failed Workflows
Restart a workflow from the beginning:resume
and restart
:
- Resume: Continues execution from where the workflow failed
- Restart: Starts execution from the beginning with the same initial payload
Retry Failure Function
If a workflow’sfailureFunction
or failureUrl
request has failed, you can retry it using the retryFailureFunction
method:
failureUrl
or failureFunction
request has failed.
Notify Waiting Workflow
To notify a workflow waiting for an event, you can use thenotify
method:
eventData
will be available to the workflow run in the
eventData
field of the context.waitForEvent
method.
Get Waiters of Event
To get the list of waiters for some event id, you can use thegetWaiters
method:
Waiter
objects:
Waiter