What is a workflow policy?

Workflow policies

A policy allows you to configure a workflow execution removal operation to execute on a perpetual schedule. You can configure a simple schedule, or create a custom schedule using a cron expression.

The policy can perform a delete operation to clean up the list of executions, or a cancel operation to stop running executions.

Choose Policies from the drop-down list at the top left of the page to open the Policies view.

When you create a policy you specify the schedule, age of executions to clean up, and filters. You can filter based on tags and/or execution state. For example, you can configure one policy to delete failed workflow executions weekly, and another to delete successful workflow executions with the testing tag daily.

The default policy is pre-loaded with installation of NSP. By default, executions are retained for 30 days.

You can also manage policies using the Workflow Manager API; see the Network Automation tutorial on the Network Developer Portal.

Canceling running executions

You can configure a cancel policy to terminate hanging workflow executions. The policy defines the length of time you want to allow execution tasks to remain in a running state.

For example, if each task in a workflow is expected to take an hour or less to run, you can configure a policy to cancel an execution of this workflow when a task has been running for two hours. Alternatively, you can create a policy to cancel all workflow executions with tasks that have been running for longer than a specified length of time.

The duration parameter, or retention period, for cancel policies is based on the time since a task was completed, that is, since the workflow execution was updated. For example, if the workflow has two tasks and the retention period is three hours, the policy is triggered if either task is running for three hours.