Example: Scheduling Tasks with Time and Calendar Conditions

In this example, a Schedule automates the cyclical execution of three tasks, two Workflows (JOBP.X and JOBP.Y) and one Job (JOBS.AA), each with different time constraints.

What Will You Learn?

What Does this Example Cover?

A Schedule object automates the execution of three tasks. Each task should start at a specific time. The following time constraints apply:

The Schedule should execute once a day, that is, its Period Duration is 1. A new period should start at 00:00 (Period Turnaround Time). This is the time at which completed tasks are removed from the Schedule and loaded anew to be executed again the next day.

Overview

The following list provides an overview of the steps you must carry out:

  1. Create and Define the Schedule Object
  2. Add Tasks to the Schedule
  3. Apply Time and Calendar Conditions to the Tasks
  4. Activate the Schedule Object
  5. ENDED_TIMEOUT Status - Resetting the Task
  6. What Happens Now?

Create and Define the Schedule Object

  1. Log in to your Client and open the Process Assembly perspective.
  2. Navigate to the folder in which you want to create the Schedule object.
  3. Click Add Object on the toolbar (alternatively, right-click anywhere on the list and select Add > Add Object).
  4. Select Schedule (JSCH) and click Add.
  5. The Schedule definition pages open displaying the Schedule page. Switch to the Attributes page.

    Here you define Schedule settings such as its periodicity (in our case one day) and the time at which a new period starts (00:00).

    Screenshot of the Attributes page of a Schedule object

Add Tasks to the Schedule

  1. Open the Schedule page.
  2. Activate the first row by clicking on it and click the folder icon. This opens the Select Object dialog.
  3. Search for and select the first task (JOBP.X) and click OK. It is inserted in the task list.
  4. Click Add Row on the toolbar and add the second (JOBP.Y) and third (JOBS.AA) tasks to the Schedule.

    By default, added tasks are set to Active. This means that they will be executed according to the Schedule and task settings you are about to define. If you deactivate this checkbox, the task remains in the Schedule but it is not executed.

Note: The Schedule now contains all the tasks that it will automate. Now you define the task start times and their calendar conditions.

Apply Time and Calendar Conditions to the Tasks

  1. Select JOBP.X to activate it and type the time you want it to start its execution. In our case, this is 07:00.

    JOBP.X needs no further time or calendar settings, so you can proceed with the next task.

  2. Select JOBP.Y to activate it and type 13:00 in Start Time.
  3. Click the Properties button on the toolbar. This opens a pane at the bottom half of the window that displays the task properties.
  4. On the Calendar tab activate the Set Calendar Conditions checkbox.
  5. Specify when you want the task to be executed taking the Calendar definitions into account. In our case, this is Execute if one condition matches.
  6. Add a Calendar.

    1. Activate the first row by clicking on it or click Add Row to add a new one.
    2. Select a Calendar from the list. In our case, it is called USEFUL.CALENDAR.

      Alternatively, start typing the name of the Calendar to activate the "select as you type" function.

    3. Select a Calendar Event. In our case it is FIRST_OF_MONTH.
  7. Select JOBS.AA to activate it and type 19:00 in Start Time.
  8. Assign it a Calendar and a Calendar Event as described above. In our case, this is again USEFUL.CALENDAR but the Calendar Event is WEDNESDAY.

    Screenshot of the Schedule page showing the populated Calendar tab

Note: The Schedule object is ready. Now you must activate it.

Activate the Schedule Object

Expand the Execute button on the toolbar and select Execute Once.The Schedule is started. A message is displayed at the top of the window that confirms it.

The Schedule is now in Active status, which means that it will execute the first task as soon as all the required conditions are met considering the Schedule Period Turnaround Time and Period Duration as well as the Start Time and Calendar Condition of each task.

You can open the Process Monitoring perspective and search for it in the list of tasks to check it.

Screenshot showing the task in the Process Monitoring perspective

To check the status of the tasks in the Schedule and follow their progress, modify its parameters, open the execution data and reports, etc., you need the Schedule Monitor. Click Last Monitor on the toolbar to open it.

Screenshot of the Schedule monitor

ENDED_TIMEOUT Status - Resetting the Task

In our example, JOBP.X has a different status, namely ENDED_TIMEOUT - Start time exceeded. This is because its Start Time is set to 07:00 and we have defined the Schedule, added JOBP.X and defined its Start Time after 07:00 today. JOBP.X has no further date/time restrictions, it should execute everyday, that is, today the Schedule has missed an execution.

To activate this task and make sure that the Schedule processes it appropriately, select it and click Reset Task.

Screenshot showing the Reset Task button

As a result, JOBP.X executes immediately.

What Happens Now?

  1. As soon as the Period Turnaround Time arrives, the tasks are Waiting for Start Time.

    Graphic showing the start of the period turnaround

  2. At 07.00 JOBP.X becomes Active; it is executing. The other two tasks are still in waiting status until 13:00 and 19:00 respectively:

    Graphic illustrating the execution during the period turnaround

  3. At the end of the day, JOBP.X ended OK whereas the other two tasks are inactive because the Calendar conditions did not allow them to execute. JOBP.Y should be executed on the first day of the month and JOBS.AA on Wednesdays only; neither of these conditions apply on Monday 31 March:

    Graphic illustrating the execution during the period turnaround

  4. The next day the tasks are loaded again at midnight and are waiting for their Start Times:

    Graphic illustrating the execution during the period turnaround

  5. On Tuesday 1 April, JOBP.X executes at 07:00 and JOBP.Y at 13:00 (it is the first of the month so the Calendar conditions are met). JOBS.AA does not execute because it is not a Wednesday:

    Graphic illustrating the execution during the period turnaround

  6. The next day, JOBP.X executes at 07:00 and JOBS.AA at 19:00 (it is a Wednesday). JOBP.Y does not execute because it is not the first of the month:

    Graphic illustrating the execution during the period turnaround

Useful Links

This example contains references to a number of functions that you might want to know a bit more about.