What are flows and what can I do with them?

Flows are work items that are connected together in a defined sequence. These work items can be jobs, other flows, or even applications.

You connect work items together in flows

You define dependencies between work items in a flow. The flow's details are defined in a flow definition.

For example, in a simple flow, you are defining three jobs: Start, Processing, Finish. Each job starts after the previous one completes successfully.

Flow with three jobs: Start, Processing, Finish.
Tip:

Use an example to create a simple flow. On the Workload tab, select the menu Workload > Definitions > Flow Definitions. Select New > Flow Definition. In the Create Draft Definition dialog, choose Create definition by: > Importing an example definition, Sample.xml.

You define what happens if work items in the flow fail or succeed

You can define what happens if work items in the flow fail or succeed. In the example, the flow defines that if any of the jobs fail, you want to send an email to the administrator.

Image with a branch to send an email to the administrator
Tip:

Learn more about alarms with the example flow event_and_alarm.xml. On the Workload tab, select the menu Workload > Definitions > Flow Definitions. Select New > Flow Definition. In the Create Draft Definition dialog, choose Create definition by: > Importing an example definition. Choose the event_and_alarm.xml example flow, which is triggered with time and file events; otherwise, it alerts the administrator.

You can also define what to do if work items exit with different exit codes. In the example, the flow has different branches that run depending on the exit code from the first job. If the exit code is equal to or larger than 4, an email is sent as the job is considered failed.

Flow has different branches that will run depending on the exit code from the first job

You can include flows in other flows

Flows can also include other flows. When a flow is included in another flow, it is referred to as a subflow. You can include a flow in another flow by copying an existing flow into another flow, or by linking the other flow by reference.

To be able to link to another flow, the flow that you want to link to must be Published. The advantage of linking a flow as a subflow is that you can maintain the linked flow separately. Whenever the linked flow is updated, you can choose to automatically update all flows that link to it with the new version. An example of a flow that links two subflows:
Flow with two linked flows
Tip:

Learn more about flows that are included in other flows by reference with the example file dynamic_flow.xml. On the Workload tab, select the menu Workload > Definitions > Flow Definitions. Select New > Flow Definition. In the Create Draft Definition dialog, choose Create definition by: > Importing an example definition. Choose he dynamic_flow.xml example. which inserts subflows by reference and passes variables between a parent flow and subflows.

You can automatically submit flows

You can define a flow to be submitted at specific times and days with a calendar event trigger. You can use the built-in calendars in your flow definition or you can create your own. To change existing built-in calendars, you need to be the Process Manager administrator and install the Calendar Editor Java Client on your desktop.

You can also define a file event to submit a flow if a file exists in a specific location, or a file reaches a certain size.

You can also combine triggers with AND and OR to indicate that multiple event triggers need to be satisfied.

In this example, the subflow flow_simple is only submitted if it is 10:00 AM on a weekday and the file myfile arrives in the /tmp directory on the Process Manager server host.

Example with a calendar event trigger
Tip:

Learn more about automatically submitting flows with the example file event_and_alarm.xml. On the Workload tab, select the menu Workload > Definitions > Flow Definitions. Select New > Flow Definition. In the Create Draft Definition dialog, choose Create definition by: > Importing an example definition. Choose the event_and_alarm.xml example flow, which is triggered with time and file events.

You can use variables throughout the flow

When you create flows, you define flow input variables. Input variables are the variables that are required to be entered for the flow to run.

These flow input variables automatically become environment variables that can be used by work items in the flow.

In the example, the variable evaluator is used to decide whether to run the subflows in parallel or sequentially as arrays according to the value of the variables MYVAR and VAR2. When MYVAR equals 1 and VAR2 is larger than 0, the subflow is run in parallel as an array.

Variable evaluator used in a flow to determine flow branches

You can run jobs or flows repeatedly with arrays

You can add job arrays in a flow to run the same job repeatedly but with different input files. You can use a job array to submit, control, and monitor all of the jobs as a single unit. Each job that is submitted from a job array is assigned the same job ID as the job array and is uniquely referenced with an array index.

You can also use flow arrays to run the same subflow repeatedly in parallel, or sequentially. The subflow run as many times as the size of the array.

Tip:

Learn more about evaluating variables in your flow and using flow arrays with the example file flow_array_eval.xml. On the Workload tab, select the menu Workload > Definitions > Flow Definitions. Select New > Flow Definition. In the Create Draft Definition dialog, choose Create definition by: > Importing an example definition. Choose the flow_array_eval.xml example flow, which evaluates variables to run the flow array sequentially or in parallel.