Scheduling and Running Tasks (2.13)
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
Before you can schedule any task, you must define and enable at least one entity .
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 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. Note that this field is set automatically if you specify Task Group as a schedule group.
-
Task Group —Optionally select the task group that this task should be in. If the task group is a schedule group, the system automatically sets Entity equal to the entity for that task group.
-
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).
-
Business Event 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 ScheduleDetails 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.
This option is not available for a task within a schedule group.
If Dependency Inactivity Timeout is reached before the dependency is satisfied, the system can create a workflow item and notify the users associated with Workflow Role for Handling Exceptions. A user can then decide whether to retry the task or abort it. On retry, the system evaluates the dependency expression again at that later time, so the result can differ if the date has changed or if the relevant event has arrived in the meantime.
-
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 a 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 a 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.
-
Run With Group —The task will be run when the parent schedule group is run.
This option is available only to a task within a schedule group.
-
-
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:
-
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.
Dependency expressions are based on business event tags. A tag can be produced by another Business Scheduler task or by a business event recorded in the system. The dependency functions described later in this section determine how and when the tagged event satisfies the dependency.
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.
-
For a dependency that is satisfied by another scheduled task, assign that task a Business Event Tag.
-
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.
A dependency can also be satisfied by a business event that has been recorded with the corresponding tag.
Functions Available in Dependency Expressions
This section provides reference information on the functions that can be used in dependency expressions.
Choose the function based on how strictly the timing of the event should be interpreted: use TODAY() for same-day requirements, WINDOW() when timing may vary within a range, and WHEN() when the task must react only to new events.
Where tag is the tag of the event to wait for. This dependency expression means to wait until a business event identified by tag has happened on the same calendar day on which the system is evaluating the dependency.
Use this function when the dependency must be satisfied by an event that occurs on the same day.
Unlike the WINDOW() function, TODAY() does not span days. This distinction is important if a task is retried after midnight. For example, suppose a task starts waiting at 10 PM with the dependency expression TODAY(backup), and the backup event arrives at 11 PM. If a user retries the waiting task at 12:05 AM, TODAY(backup) is no longer satisfied, because the most recent backup event happened on the previous day.
Where tag is the tag of the event to wait for. This dependency expression means to wait until a business event identified by tag happens after the task enters the RunningWait state.
Use this function especially with tasks configured as Run After Dependency. In that run mode, the task returns to RunningWait after each successful run and waits for the next qualifying event. The WHEN() function ensures that only new events are considered. Events with the same tag that happened before the task returned to RunningWait are ignored.
This behavior differs from TODAY() and WINDOW(). If a task is configured as Run After Dependency and its dependency is satisfied by TODAY() or WINDOW(), the task may run again immediately after finishing, because the same event can still satisfy the dependency expression.
If a new business event arrives while the task is still running (and has not yet returned to RunningWait), that event is not considered by WHEN().
Where:
-
tag is the tag of the event to wait for.
-
lower is a positive number of hours. This argument specifies how old the event can be, measured 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, measured from the moment the system began checking for it.
This dependency expression means if the tagged event has already occurred within the previous lower hours, or else it will continue waiting for up to higher hours for that event to happen.
Unlike TODAY(), WINDOW() can span midnight and therefore can be useful when the dependency might be satisfied shortly before or shortly after the dependent task starts waiting. For example, WINDOW(backup,1,4) means that the event can have happened as much as one hour before the task began waiting, or as late as four hours afterward.
Use WINDOW() when there is expected timing uncertainty in the dependency event, especially for the first task in a chain of dependent tasks. After that first task completes, later tasks can often use TODAY() against the first task's tag when stricter same-day behavior is desirable.
For example, suppose a task starts running at 11 PM with the dependency expression WINDOW(backup,1,4). If the backup event happened at 10:30 PM, the dependency is already satisfied. If it has not happened yet, the system can continue waiting until 3 AM for that event to arrive.
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, double click. The task details open.
-
Click Edit Task in the upper right.
-
Modify details here in the same way as when you schedule a task.
-
Click Submit.
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 double click the task. The task details open.
-
Click Manually Run Now.
-
Click Run Task to confirm. If the task has dependencies, click either Force Run, to run it without running the dependencies, or Run With Dependencies, to run both this task and any dependent tasks.
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, double click. The task details page opens.
-
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, double click. The task details page opens.
-
Click Delete.
-
Click Delete to confirm.
If the associated resource for the task is still in a running state, you will need to abort that task or allow it to finish running before you can delete the task.