Scheduling and Running Tasks (2.8)
To schedule recipes and other tasks, you use the Business Scheduler, which you can also use to run tasks manually. There are three types of tasks:
-
Recipe, which runs a single recipe
-
AtScaleCube, which rebuilds a cube
-
Snapshot, which performs a snapshot run
Scheduling a Task
To schedule a task:
-
Click the Business Scheduler icon in the application menu.
The system displays a table that lists the currently defined schedule items; if needed, use the filters at the top of the table to narrow down what is shown.
-
Click Create in the upper right and then click New Task.
The system displays a table that lists the recipes, snapshots, and cube builds that can be scheduled. If needed, use the filters at the top of the table to narrow down what is shown.
-
Click the row corresponding to the item to schedule.
The system displays a page where you specify details about the item.
-
Specify the following information:
-
Task Description—Required. Type a brief description for this task.
-
Entity—Required. Select the entity whose calendar information you want to use.
-
Enabled—Optionally clear this check box if you want to disable this task (for example, if you are not ready to run or schedule it).
-
Tag, Dependency Expression, and Dependency Inactivity Timeout—See Managing Task Dependencies.
-
Workflow Role for Handling Exceptions—Required. Select the role that should receive any workflow items in case of exceptions related to this task.
-
Email Distribution List for Error Notifications—Select the email distribution list that should receive messages when this task encounters an error.
-
Email Template for Error Notifications—Select the email template list to use when sending messages when this task encounters an error. This is required if you select Email Distribution List for Error Notifications and is hidden otherwise.
-
Email Distribution List for Success Notifications—Select the email distribution list that should receive messages when this task runs successfully.
-
Email Template for Success Notifications—Select the email template list to use when sending messages when this task run successfully. This is required if you select Email Distribution List for Success Notifications and is hidden otherwise.
In the Scheduling Details section, select Run Mode. The available values are as follows:
-
Manually Run—The task is not run until a user chooses to run it.
-
Run on Schedule—The task is run at the scheduled date and time. For this run mode, specify additional options to control the scheduling.
If you specify a Dependency Expression, that dependency is considered. If it is the time for the task to run and that dependency expression is not satisfied, the task remains in the RunningWait state until a timeout occurs or the dependency is satisfied. That allows the task to wait for other tasks to run or to wait for external events that may indicate, for example, that data is ready to be retrieved.
-
Run After—The task is run only after another task has been successfully run.
For example, suppose we have a task B that should run right after another task A finishes running successfully. Task B is initially in the state RunningWait, meaning that it is waiting for task A to finish running. When task A successfully completes, task B moves into the Running state. When task B finishes running, it moves back to RunningWait.
-
Run After Dependency—The task will be run every time the dependency is satisfied. For this run mode, Dependency Expression is required, and it must include at least one condition that uses the WHEN() function. For example, suppose task C must run every time an external business event with tag DataIsReady happens (and this can happen many times a day). We can configure task C to be of type Run After Dependency with a dependency expression WHEN(DataIsReady). This task will immediately go to RunningWait, waiting for the business event DataIsReady to happen. Once we receive such an external business event, the task will run and immediately move back to RunningWait status, waiting for the next DataIsReady to be issued.
With this mode, you may or may not need a timeout (Dependency Inactivity Timeout). A timeout is probably not important if the dependency expression is a simple WHEN(). But if the dependency expression contains a TODAY() condition and that event never comes, a timeout would allow this task to fail and start a workflow that will let users know that no tag for that TODAY() has arrived yet.
-
-
Click Save Task.
Scheduling Details
If the Run Mode for a task is Run on Schedule, the Business Scheduler displays additional options to control the scheduling. The options include the following:
-
Type of frequency to run at—Required. Select the option that best describes how often to run this task.
Depending on your selection, the page may show additional items to control the scheduling, such as the specific days of the week, the specific months, and so on.
-
On Holidays —Required. Select the option that describes how to handle holidays: Don’t Run, Run Anyway, Run Next Business Day, Run Previous Business Day.
-
Run on the Following Days of the Week —Required if task runs every calendar day or every business day. Select each day on which the task should be run.
-
Start Time on Scheduled Days—Required. Select the time of day when the task should be started (using the local time zone defined for the associated entity).
-
End Time on Scheduled Days—Required if task runs more than once a day. Select the time of day after which the task should not be started (using the local time zone defined for the associated entity).
-
Schedule Task End Time—Optionally select this if you want the task to stop running at a specific date and time. If you select this option, also specify Task End Date and Task End Time.
The system displays additional fields to prompt you for information as needed. For example, if Type of frequency to run at is Run Every X Minutes, the system displays the field Run Every X Minutes, which you use to specify the number of minutes.
Managing Task Dependencies
There may be specific tasks that you want to run only after other tasks have been run, on the same day; the system provides a way to manage these dependencies. To specify that one task (task A) should not be run until another task (task B) has completed, you use the following system:
-
Decide on a unique, short tag that describes this dependency (for example, backup). Note that tags are case-sensitive.
-
When scheduling the task or tasks that need to occur first (in our example, task B), specify the Tag field, using the tag you have decided on.
-
When scheduling the dependent task (task A), specify Dependency Expression, which specifies the condition (or combination of conditions) that must be met in order for this task to be started.
In its simplest form, a dependency expression has the form FUNCTIONNAME(tag), where FUNCTIONNAME is TODAY, WHEN, or WINDOW and tag is a tag that has been applied to some other task. The meaning of the expression depends on the function. As an example, consider the following example dependency expression:
TODAY(backup)
This expression means that the task should not be started until the completion (today) of a task that is tagged with the backup tag.
You can combine dependency expressions via the keywords AND and OR, along with parentheses. For example:
TODAY(tagA) OR (TODAY(tagB) AND TODAY(tagC))
-
In addition to specifying Dependency Expression, you can specify Dependency Inactivity Timeout in seconds.
Functions Available in Dependency Expressions
This section provides reference information on the functions that can be used in dependency expressions:
Where tag is a tag of the event to wait for. This dependency expression means to wait until the completion (today) of a task that is tagged with tag.
Unlike the WINDOW() function, TODAY() considers only events within the same day.
Where tag is a tag of the event to wait for. This dependency expression means to wait until the completion of a task that is tagged with tag. When a task starts running and it has the WHEN(SomeTag) function in its dependency expression, the system will hold the task in the RunningWait status until a business event identified by SomeTag arrives. This business event must arrive/happen after the task reaches the RunningWait status. When such a business event happens, the task will then proceed to Running unless the dependency expression has other conditions that must be satisfied.
If the task takes too long to run and return to its RunningWait status, and a new business event expected by the WHEN() function arrives while the task is still running, that event will be lost since it did not arrive after the task is back in RunningWait.
Where:
-
tag is a tag of the event to wait for.
-
lower is a positive number of hours. This argument specifies how old the event can be, from the moment the system began checking for it.
-
higher is a positive number of hours. This argument specifies how long to wait for the event, from the moment when the system began checking for it.
This dependency expression means the system will either run the task if the given event was completed within the last lower hours ago or will wait higher hours for that event to complete. This window of time can span days. For example, consider a task (called Sample Task) that uses this dependency expression:
WINDOW(backup,4,4)
Suppose that Sample Task starts running at 11 PM. In this case, the system first checks to see if the backup task has completed within the last four hours (that is, after 7 PM); if so, the system starts Sample Task immediately. On the other hand, if the backup task has not completed yet, the system waits, potentially until 3 AM. At any time before 3 AM, if the backup task is completed, the system starts Sample Task after the backup task is completed.
Modifying a Task
To modify a task definition (for example, to change the schedule details):
-
Click the Business Scheduler icon in the application menu.
The system displays a table that lists the items that are currently scheduled. If needed, use the filters at the top of the table to narrow down what is shown.
-
In the row for the task, right-click and select Edit Task.
-
Modify details here in the same way as when you schedule a task.
-
Click Save Task.
The system runs the task (or attempts to) within the next minute. When it does so, it updates the Run History section of this page.
Also see Managing Task Groups for information on moving tasks into and out of groups.
Running a Task Manually
To run a task manually:
-
Click the Business Scheduler icon in the application menu.
The system displays a table that lists the items that are currently scheduled. If needed, use the filters at the top of the table to narrow down what is shown.
Tasks that can be run manually are displayed here with Next Run as Manual; these are tasks defined with the Manually Run check box selected.
-
In the row for the task, right-click and select View Task.
-
Click Manually Run Now.
-
Click Run Task to confirm.
The system runs the task (or attempts to) within the next minute. When it does so, it updates the Run History section of this page.
Aborting a Task
To stop a task that is currently running:
-
Click the Business Scheduler icon in the application menu.
-
In the row for the task, right-click and select View Task.
-
Click Abort Task.
-
Click Abort Task to confirm.
The system runs the task (or attempts to) within the next minute. When it does so, it updates the Run History section of this page.
Also see Handling Task Errors.
Deleting a Task
To delete a task definition:
-
Click the Business Scheduler icon in the application menu.
-
In the row for the task, right-click and select View Task.
-
Click Delete.
-
Click Delete to confirm.