Workflow Versioning and Upgrades at Runtime
Learn how workflow versioning works during runtime and how to upgrade a currently running workflow.
General runtime behavior
Each workflow execution runs based on the snapshot of the workflow definition and version at the start of the execution. To get a better understanding, take a look at the following illustration:
In the illustration above, the workflow with version V1 is executed at timestamp T1 and thus uses the workflow definition at that time.
When the workflow definition is updated but with the same version V1, all previously running executions will continue based on the definition at timestamp T1. Meanwhile, any newly-triggered executions with version V1 will run based on the definition at timestamp T3.
When a new workflow version V2 is added at T2, all new executions from that point will also execute based on the latest version V2, unless V1 is explicitly specified.
Behavior during restarts
By default, all workflow restarts, retries, and task reruns will also be executed based on the snapshot of the workflow definition and version at the start of the first execution attempt.
In the illustration above, if a V1 execution is restarted after a new version V2 has been created, the restarted execution will still be based on the definition at T1. This is true even if the V1 execution is restarted after the V1 definition itself has been updated.
There is also an option to restart the execution based on the latest definitions rather than the definitions at the initial execution time. In this case, the V1 execution will restart using the definition at T2 instead.
Learn more about recovering from failures in Debugging Workflows.
Upgrading running workflows
Since all workflow executions are based on the snapshot of their definition at the start of the execution, any changes to the definition will not impact currently running executions. If necessary, running workflows can be upgraded to the latest definitions using Conductor UI or API.
To upgrade a running workflow:
- Using Conductor UI
- Using API
To run the latest version in UI, terminate the currently running execution and restart it with the latest definition.
- Go to Executions > Workflow in the left navigation menu and select the workflow to upgrade.
- In the top right, select Actions > Terminate.
- Once terminated, select Actions > Restart with latest definitions.
For consistency with your business flow, you can use the Skip Task API to skip the tasks that were previously completed.
Use the Upgrade Workflow API to upgrade the running workflow to another version.