5. Scheduling Tasks

In standard setups we usually schedule the daily job daily that runs data transfer and calculates scheduled orders and then a monthly or weekly task to update the forecasts.

When data mapping has been completed (see specific module chapters such as Inventory RAW layer data mapping) we need to make sure the relevant stg elements are scheduled to be run periodically. Historically this was done through SQL Agent by scheduling jobs but after version 6.2 this is handled by the AGR Scheduler.



Manual actions

inst

Create/edit a scheduled task

To create a new scheduled task you click the + up in the right corner. The tasks that you can choose from can be found in the [Agr5DevSlot_stg].[core].[stg_run] table, for information on how to set it up check out the data-flow chapter. The Enabled switch allows you to chose whether your scheduled task is enabled or disabled. When disabled, the task will not run although it is scheduled for that time. This is done to allow for temporary disabling without losing the schedule you have set for the task.

As usually, you may edit the task by clicking the pencil.

inst

Start a task

To manually start a task you click the play button next to the pencil. inst

Here you get a couple of options. If the last run of your selected task stopped because of an error, you can choose to resume the task from the last failed step. You also have the option to run a task partially. You can leave the starting or ending point blank, then the task will run from the first step or finish on the last step respectively. inst

Stop a task

When a task has started running, the progress of it will be shown in the Status column. The play button will become a stop button, which will stop the task when clicked. Note that it may still take some time, as it depends on the task that is running how fast it can be stopped. You also get a red notification bubble up in the navigation bar, indicating that the task is running. Note that you will need to chose the Show notifications from all users in the notification dropdown to get notified when the Scheduler is running a task by its schedule. inst


History sidebar

To show the history sidebar, click the history button. inst

The history sidebar shows you details about the runs that the selected tasks has had. inst


Calendar sidebar

The best way to learn how the new calendar and scheduling feature works is to play around with it.

So dive in!

To show the calendar sidebar, click the calendar. inst

inst

A few things to notice here:

  • Check out the 24th and 26th of December, and then the 21st. See how they break the pattern? If there are some specific dates that you want to change in your schedule, you can simply just toggle them in the calendar! - you can even skip the pattern if you like!
  • The timeline on the left indicates at what time the task runs.
  • The shift dates buttons appear when you include an interval, e.g. in this example the task is scheduled every other day. You can then shift the dates in case they didn’t start on the date you desired.
  • The W button lets you decide whether you want to display the week-numbers or not.
  • If you move into the future (or the past) the year-number becomes blue. If you click it, you find your way back to the year of today.
  • If you don’t need to modify your schedule you can always hide the right side of the component by clicking the button next to save, then you get more space for the calendar itself.
  • The calendar can be set as read-only (when the user does not have the .mod feature).
  • The calendar (as well as all the date-pickers in AGR) draw themselves according to the locale you have chosen, i.e. they will start the week on Monday or Sunday according to your locale settings. The scheduler however, uses the ISO-8601 business standard which means that the week starts on a Monday in all schedules.

Pro tip: you can double-click on any weekday or month to select/deselect all!


Multi-editing

Yes. You read correctly. You can multi-edit the schedules of scheduled tasks! You can also delete multiple tasks if you want. You can even select a few and tell them all to set their schedule to the same one! Let’s check it out.

If you select more than one scheduled task, you get a colorful overview of all of them in the calendar.

inst

On the right hand side, you can see the Use settings from option. There you can make both schedules behave like the one you choose.


Scheduled tasks in the database

Table [dbo].[scheduled_tasks] contains all scheduled tasks.

There are two columns holding the status of each run:
execution_status ; Ready = 0, Running = 1, Finished = 3, Disabled = 10
last_execution_result ; New = 0, Completed = 303, Stopped = 304, Error = 306, CompletedWithErrors = 307