Workflow and Execution Parameters

Workflows can have parameters. Workflow parameters are declared in the blueprint, and each parameter can be declared as either mandatory or optional with a default value. To learn more about parameter declaration please refer to Creating your own workflow.

cfy workflows get my_workflow -d my_deployment

This command shows information on the my_workflow workflow of the my_deployment deployment, including the workflow’s mandatory parameters as well as the optional parameters and their default values.

Example: Retrieving a workflow’s parameters

$ cfy workflows get -d my_deployment -w my_workflow
Getting workflow 'my_workflow' of deployment 'my_deployment' [manager=11.0.0.7]

Workflows:
+--------------+---------------+-------------+------------+
| blueprint_id | deployment_id |     name    | created_at |
+--------------+---------------+-------------+------------+
| my_blueprint | my_deployment | my_workflow |    None    |
+--------------+---------------+-------------+------------+

Workflow Parameters:
    Mandatory Parameters:
        mandatory_parameter (this parameter is mandatory)
    Optional Parameters:
        optional_parameter:     optional_parameter_default_value        (this parameter is optional)
        nested_parameter:       {'key2': 'value2', 'key1': 'value1'}    (this parameter is also optional)
The workflow has a single mandatory parameter named mandatory_parameter*, and two optional parameters, one named* optional_parameter *which has a default value of* optional_parameter_default_value*, and another named* nested_parameter *which has a complex default value.*

Example: Executing a workflow with parameters

$ cfy executions start -d my_deployment -w my_workflow -p my_parameters.yaml
Executing workflow 'my_workflow' on deployment 'my_deployment' at management server 11.0.0.7 [timeout=900 seconds]
2014-12-04T10:02:47 CFY <my_deployment> Starting 'my_workflow' workflow execution
2014-12-04T10:02:47 CFY <my_deployment> 'my_workflow' workflow execution succeeded
Finished executing workflow 'my_workflow' on deployment'my_deployment'
* Run 'cfy events list --include-logs --execution-id 7cfd8b9c-dcd6-41bc-bc88-6aa0b00ffa62' for retrieving the execution's events/logs
my_parameters.yaml
mandatory_parameter: mandatory_parameter_value
nested_parameter:
  key1: overridden_value
Executing the workflow and passing the value mandatory_parameter_value for the mandatory_parameter parameter, and overriding the value of the nested_parameter parameter with a new complex value (though it could have been overridden with a non-complex value as well).

cfy executions get my_execution

Example: Retrieving an execution’s parameters

$ cfy executions get -e 7cfd8b9c-dcd6-41bc-bc88-6aa0b00ffa62
Getting execution: '7cfd8b9c-dcd6-41bc-bc88-6aa0b00ffa62' [manager=11.0.0.7]

Executions:
+--------------------------------------+-------------+------------+----------------------------+-------+
|                  id                  | workflow_id |   status   |         created_at         | error |
+--------------------------------------+-------------+------------+----------------------------+-------+
| 7cfd8b9c-dcd6-41bc-bc88-6aa0b00ffa62 | my_workflow | terminated | 2014-12-04 10:02:22.728372 |       |
+--------------------------------------+-------------+------------+----------------------------+-------+

Execution Parameters:
    nested_parameter:       {'key1': 'overridden_value'}
    optional_parameter:     optional_parameter_default_value
    mandatory_parameter:    mandatory_parameter_value

The workflow was executed with three parameters with the presented values. It can be seen that the optional parameter parameter was assigned with its default value, while the nested_parameter parameter’s value was overridden with the new complex value.