Run a flow when another flow...

You can run a flow when another flow reaches a certain condition, or you can run a flow when a work item in another flow reaches a certain condition. In either case, you use a proxy event to trigger the flow. As its name indicates, the proxy event acts as a proxy in the current flow for another flow or a work item that runs within another flow

Run a flow when another flow completes

Procedure

  1. In the Flow Editor, open the flow definition.
  2. Right-click in an empty space in the flow definition and select Flow Attribute. The Flow Attributes dialog box displays.
  3. Click the Triggering Events tab.
  4. Click Add to define an event to trigger the flow. The Trigger Flow with Events dialog box displays.
  5. In the Select type of event field, select Proxy Event.
  6. In the Create proxy for... field, select Flow.
  7. In the Flow name field, specify the name of the flow definition whose condition will trigger this flow. Ensure you specify the name of the flow definition, not its file name. The next occurrence of this flow will trigger the flow you are presently creating.
  8. Optional. In the Owner field, specify the name of the user who owns the flow. If you own the flow, you do not need to specify a name—the name will default to your own.
  9. In the Duration field, specify the number of minutes in the past to detect the proxy event.
  10. In the Event type field, select The flow completes successfully.
  11. In the Description field, add any descriptive text that may be used for understanding this event. For example, if this event requires special instructions for operations staff, place those instructions here.
  12. Click OK. The Triggering Event(s) tab reappears, and the proxy event you defined appears in the list.
  13. Click OK.
  14. From the Action menu, select Submit to submit the flow. The flow definition is submitted to Process Manager, where it is triggered when the specified file event is true.

Examples

  • Triggering when a flow has exit code greater than 3:

    The following proxy event triggers the flow when the flow testflow exits with an exit code greater than 3:

  • Triggering when 5 or more jobs in a flow fail

    The following proxy event triggers the flow when 5 or more jobs in the flow testflow fail:

    From the command line

    1. On the command line, to achieve the same results, type the following:

      jsub -p “flow(numexit(bhorner:testflow)>=5)”

    2. Press Enter.

Calculation of number of jobs in a flow

When Process Manager calculates the number of jobs in a flow, for successful jobs, failed jobs, and so on, it does not count the jobs in a subflow, and it counts a job array as a single job. It also does not count other work items in the flow, such as events or alarms.

Run a flow when a proxy job completes

Procedure

  1. In the Flow Editor, open the flow definition.
  2. Right-click in an empty space in the flow definition and select Flow Attribute. The Flow Attributes dialog box displays.
  3. Click the Triggering Events tab.
  4. Click Add to define an event to trigger the flow. The Trigger Flow with Events dialog box displays.
  5. In the Select type of event field, select Proxy Event.
  6. In the Create proxy for... box, leave the default at Job.
  7. In the Job name field, specify the fully qualified name of the job, in the following format:

    flow_name:subflow_name:job_name

    If the job is not defined within a subflow, simply specify the flow name and the job name, separated by a colon.

    Note:

    You cannot specify a proxy for a manual job.

  8. If the flow containing the job is not owned by your user ID, in the Owner field, specify the user ID that owns the flow containing the proxy job.
  9. In the Duration field, specify the number of minutes in the past to detect the proxy event.
  10. In the Event type field, select the type of dependency you want to use to trigger the flow, and the appropriate operator and values.
  11. In the Description field, add any descriptive text that may be used for understanding this event.
  12. Click OK. The Triggering Event(s) tab reappears, and the proxy event you defined appears in the list.
  13. Click OK.
  14. From the Action menu, select Submit to submit the flow. The flow definition is submitted to Process Manager, where it is triggered when the specified file event is true.

From the command line—trigger when job fails

Procedure

  1. On the command line, to trigger when the job fails, type the following:

    jsub -p “job(exit(bhorner:testflow:J2))”

  2. Press Enter.