Managing Deployment Workflows

Workflows are automation process algorithms. They describe the flow of the automation by determining which tasks will be executed and when. A task may be an operation (implemented by a plugin), or other actions including running arbitrary code. Workflows are written in Python, using a dedicated framework and APIs.

Workflows are deployment-specific. Each deployment has its own set of workflows, which are declared in the Blueprint. Executions of a workflow are in the context of that deployment.

Controlling workflows (i.e. executing, cancelling, etc.) is achieved using REST calls to the management server. In this guide, the examples use Cloudify CLI commands, which in turn call the REST API calls.

Executing Workflows

Workflows can be executed directly. You can execute workflows from the CLI as follows:
cfy executions start my_workflow -d my_deployment

This executes the my_workflow workflow on the my_deployment deployment.

Workflows run on deployment-dedicated workers on the management server, on top of the Cloudify workflow engine.

When a workflow is executed, an execution object is created for the deployment, containing both static and dynamic information about the workflow’s execution run. The status field in the Execution object is an important dynamic field that conveys the current state of the execution.

An execution is considered to be a running execution until it reaches one of the three final statuses: terminated, failed or cancelled. For more information, see the Workflow Execution Statuses section on this page.

Queuing Executions

In general, executions run in parallel. There are a few exceptions:

If you start an execution and receive one of the following errors: “You cannot start an execution if there is a running system-wide execution” / “The following executions are currently running for this deployment…” / “You cannot start a system-wide execution if there are other executions running.”, you can add the execution to the executions queue:

Queued executions will begin automatically when possible.

Scheduling Executions

Cloudify allows the user to create schedules for running executions at specified times, both single-use and recurring. Execution schedules, also known as deployment schedules, belong to a specific deployment and can be created in two ways:

  1. By using the dedicated CLI command: cfy deployments schedule create
  2. By specifying under the deployment_settings section in a blueprint, the default schedules that should be created for any deployment based on this blueprint.

Each deployment schedule contains the following information, provided by the user:

The schedules are then polled by the cloudify-execution-scheduler service, which runs continuously in the background.

Writing a Custom Workflow

If you are an advanced user, you might want to create custom workflows. For more information, see Creating Custom Workflows.