Schedule your flow

You can schedule a flow to run at a particular date and time, when a file arrives, or a combination of these. You schedule a flow using an event.

Run a flow at a specific time

In the flow definition

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 Time Event.
  6. In the Calendar name field, select the calendar that resolves to the dates on which you want this flow to run.
  7. In the Time zone section, specify the time zone for this time event.
  8. In the Hours and Minutes fields, specify the time when you want the flow to start running.
    Note:

    Do not schedule your flow to start between 2:00 a.m. and 3:00 a.m. on the day that daylight savings time begins (the second Sunday in March), as the flow will not run and any subflows that are scheduled to start after this flow will also not run.

    This is because the 2:00 a.m. to 3:00 a.m. hour is removed to start daylight savings time in North America.

  9. In the Duration of event field, specify the number of minutes after the specified time that the flow can start. This is useful if there is a time window in which the flow can start. If the flow must start exactly at the specified time, leave the duration at 1 minute.
  10. Optional. In the End after ... occurrences field, specify the maximum number of occurrences of this time event before you want it to end.
  11. Click OK. The Triggering Event(s) tab reappears, and the time event you defined appears in the list.
  12. Click OK.
  13. From the Action menu, select Submit to submit the flow. The flow definition is submitted to Process Manager, where it will be scheduled at the specified time, on each day that the specified calendar is true.

From the command line

Procedure
  1. On the command line, type the following:

    jsub -T time_event flow_file_name

    where time_event is the definition of the time event that triggers this flow and flow_file_name is the full path name of the file containing the flow definition.

  2. Press Enter.

Run a flow at multiple times on a single date

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 Time Event.
  6. In the Calendar name field, select the calendar that resolves to the dates on which you want this flow to run.
  7. In the Time zone section, specify the time zone for this time event.
  8. In the Hours and Minutes fields, specify an expression that resolves to the times when you want the flow to start running. Be sure to specify the times as they appear on a 24-hour clock, where valid values for hours are from 0 to 23. For the syntax of the time expression, see Specifying time expressions.
  9. In the Duration of event field, specify the number of minutes after the specified times that the flow can start. This is especially useful if the flow is triggered by multiple events, requiring that you define a time window in which the flow can start. If the flow must start exactly at the specified time, leave the duration at 1 minute.
  10. Optional. In the End after ... occurrences field, specify the maximum number of occurrences of this time event before you want it to end.
  11. Click OK. The Triggering Event(s) tab reappears, and the time event you defined appears in the list.
  12. Click OK.
  13. From the Action menu, select Submit to submit the flow. The flow definition is submitted to Process Manager, where it will be scheduled at the specified times, each day the calendar is true.

Specifying time expressions

You can specify several times for the event to trigger. You can:

Procedure

  • Specify a list of times separated by commas. For example, to run the flow at 2:00 p.m., 3:00 p.m. and 5:00 p.m., specify the following in the Hours field:
    14,15,17
    
  • Specify a range of hours. For example, to run the flow every hour from 1:00 a.m. to 5:00 a.m., specify the following in the Hours field:
    1-5
    
  • Specify a combination of the above. For example, to run the flow at 2:00 p.m., 3:00 p.m., and every hour from 7:00 p.m. to 10:00 p.m., specify the following in the Hours field:
    14,15,19-22
    
  • Use the Minutes field to modify the value in the Hours field. For example, specify the following in the Hours field:
    7,9,11-13
    

    and the following in the Minutes field:

    15,30
    

    to run the flow at 7:15, 7:30, 9:15, 9:30, 11:15, 11:30, 12:15, 12:30, 13:15 and 13:30.

  • Use an asterisk (*) in the Hours field to specify every hour. For example, to run a flow every hour, in the Hours field, specify an asterisk (*). Do not use an asterisk(*) in the Minutes field as it will be too frequent. For minutes, use 5 minutes as the minimum time.

Run a flow based on file activity

In the flow definition

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 File Event.
  6. In the File name field, specify the specify the full path name of the file as the Process Manager Server sees it, that is to be monitored for the activity, or click Browse to locate the file in the file system.

    When specifying the file name, you can also specify wildcard characters: * to represent a string or ? to represent a single character. For example, a*.dat* matches abc.dat, another.dat and abc.dat23. S??day* matches Satdays.tar and Sundays.dat. *e matches smile.

    For arrival/exist/size/age events, every matched file triggers the event. For example, if you specify a dependency on the arrival of *.tar, the dependency is met when 1.tar arrives, and again when 2.tar arrives.

    Note: There are some differences between UNIX and Windows when using wildcard characters. Because UNIX is case-sensitive and Windows is not, if you specify A*, on UNIX it matches only files beginning with A. On Windows, it matches files beginning with A and a. Also, on UNIX, if you specify ??, it matches exactly two characters. On Windows, it matches one or two characters. These behaviors are consistent with UNIX ls command behavior, and Windows dir command behavior.

    You can also specify a variable for the file name, provided your system is configured to support them. See User variables within a flow definition for more information about user variables.

  7. In the Condition field, specify the condition that matches the activity you want to monitor the file for. Choose from the following:
    • exists

    • does not exist

    • age

    • arrival

    • size

  8. Depending on the condition you choose, you may need to further qualify the condition with the input fields that follow the condition. For example, when you choose size, you need to specify an operator (greater than, and so on) and the size, in bytes.
  9. Click OK. The Triggering Event(s) tab reappears, and the file event you defined appears in the list.
  10. Click OK.
  11. 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 file exists

    The following file event triggers the flow when the file /tmp/core exists:

    When triggering a flow when a file exists, keep the following in mind:

    • Process Manager polls periodically to see if the file exists. When it does, the flow is triggered. The default polling interval is 30 seconds. Check with your Process Manager administrator to see what your polling interval is set to.

    • Unless the file is deleted, after the flow is triggered, it will trigger again each time Process Manager polls and finds the file exists, unless you combine this event with another such as a time event.

  • Triggering when a file is deleted

    The following file event triggers the flow when the file tmp/update is deleted:

    After the flow is triggered, it will trigger again each time Process Manager polls and finds the file does not exist, unless you combine this event with another such as a time event.

  • Triggering when a file is more than 15 minutes old

    The following file event triggers the flow when the file /tmp/data is more than 15 minutes old:

  • Triggering whenever a file arrives

    The following file event triggers the flow every time a tar file arrives in the tmp directory:

From the command line

Procedure

On the command line, enter the following command:

jsub -F “file_eventflow_file_name

where file_event is the definition of the file event that triggers this flow and flow_file_name is the full path name of the file containing the flow definition. For example:

jsub -F "arrival(/tmp/*.tar)" testflow.xml