How to restart a timeouted/failed/canceled/terminated cadence workflow

1.5k views Asked by At

Hi I have a workflow with 2 activities. Scenario. one activities is completed while executing second, URL link to which I need to communicate is down. Now when that URL is up workflows is timed out. So How can I restart Timed out workflow?

This question is inspired by a Github issue.

1

There are 1 answers

0
Long Quanzheng On

Cadence allows you easily restart any workflow that is already closed in any status: timeouted/failed/canceled/terminated. And even closed with success status: completed or continuedAsNew.

  1. You can use CLI command to reset a workflow to LastDecisionCompleted or FirstDecisionCompleted resetType. LastDecisionCompleted will reset to the last point if you want to save the progress of workflows has made before timeouted. FirstDecisionCompleted will reset to beginning of workflow, like really restarting by saving only the start parameters of workflow:
./cadence workflow reset -w <wid> --reset_type LastDecisionCompleted --reason "some_reason"

  1. If you have many workflows to reset, and your Cadence cluster has advanced visibility feature enabling your search/filter workflows by query, then you can also use batch-reset command like this:
./cadence workflow reset-batch --query <query> --reset_type LastDecisionCompleted --reason "some_reason"

  1. You can also use reset API in client sdk to reset a workflow to a particular point.

Reset is one of the most powerful feature in Cadence for operation. Not only resetting to FirstDecisionCompleted and LastDecisionCompleted, you can easily manipulate workflow to go back to any point of time like using time machine. There are more resetTypes supported if you use "--help" to read the command manual.