Agent Task Scheduling

Agent Gateway Tasks

Agent gateway tasks are enormously useful for applying an action to many agent gateways at once. To create a new task, or to view running tasks, navigate to Config -> Enterprise Administration -> Agent Tasks. The Gateway Tasks page will display scheduled tasks, currently executing tasks, and unscheduled tasks that can be run on demand. To create a new task, Click the “Create new Gateway Task” link. You will enter the Gateway Task wizard.

Step 1: Choose Type

You must select the type of task that you wish to execute. After you have selected a type of task, click the Next button.

images/download/attachments/6035498/EAM_Agent_Schedule_-_Choose_Task_Type_2.png

Step 2: Task Scheduling

Set the task name to a descriptive name of your choice. The following scheduling options are available:

Execute immediately : the task will begin execution as soon as you complete the wizard.

Execute on demand : the task will not be scheduled, but is available for immediate execution at any time after you complete the wizard.

Execute once, scheduled : the task will run once at the date and time that you specify.

Execute once, delayed : the task will run once after the specified number of seconds, minutes, hours, or days.

Execute on schedule : this type of schedule uses UNIX cron type scheduling, where a pattern of 5 numbers determines the recurring schedule. For example, “30 3 * * *” means run a task every day at exactly 3:30 AM. Use the dropdowns next to the pattern textboxes to build out the pattern for the schedule.

After you have determined your task schedule, click the Next button.

images/download/attachments/6035498/EAM_AGent_Schedule_-_Cron_Tab_3.png

Step 3: Agent Selection

In this step, you will select the agent groups or individual agents that will be included when the task executes. You can select agents that are not currently connected, but you cannot select pending agents.

Depending on the type of task, you may need to complete another page to add some information required for that task. If not, you can click the Finish button to schedule the task.

images/download/attachments/6035498/EAM_Agent_Schedule_-_Select_Groups_4.png

Gateway Task Results

Gateway task execution is reported in the agent_events table in the controller’s configured database. The individual result of the task execution for each agent is report as a separate entry. For example, the following query will return the results of all task executions:

select * from agent_events where event_category = 'task' order by event_time desc;

A task that completed normally for an agent will contain the text NORMAL in the event_level field. If an error occurred for an agent, the event_level field is set to ERROR, and the error message is recorded in the message field.


Running a task outside its schedule

You can run any task outside the task’s normal schedule by clicking the “run now” link on the right side of the task. Keep in mind:

  • Tasks that have been scheduled to run immediately are already running, and the “run now” link will not be visible.

  • A task that has been scheduled to execute only once at a scheduled time or after a delay will be rescheduled to run immediately. The task will not run again after it has been rescheduled.

  • A scheduled task will continue to run at its normally scheduled time, even if you run the task now.

Pausing and Canceling Tasks

This feature is new in Ignition version 7.8.1

Pause and Resume

After most tasks are created, they are put onto the task schedule. The exception to this is on demand tasks, which are not put on the schedule until you click the "run now" link. After a task has been added to the schedule, you can pause and resume the task. The state of the task (scheduled, running, waiting) and the scheduling configuration affect how the task is paused and resumed.

Task configuration

Pause action

Resume Action

Task is currently running or waiting

System will attempt to cancel outstanding calls to remote servers.

System will run task again against any servers that were outstanding when task was paused.

Task is scheduled once at a specific date and time

The task will be temporarily taken off the schedule.

If the specified time has not yet arrived, the task will be put back onto the schedule at the original time. If the specified time has already passed, the task will execute immediately upon resume.

Task is scheduled once after a specified delay

The task will be temporarily taken off the schedule.

The task will be put back onto the schedule at the original calculated time. For example, if the delay is set to 2 hours, and the task is paused for 1 hour, the task will fire in 1 hour after resume. If the delay period has already passed, it will fire immediately after resume.

Task is on a recurring schedule

All future iterations of the task will be temporarily taken off the schedule.

The task will not fire if task iterations have been missed when the task was paused. The task will return to firing on its normal schedule.

Cancel

Scheduled one-shot tasks can be cancelled at any time before the task starts. Scheduled one-shot tasks include tasks that are scheduled to fire once after a delay or fire at a specific time. Running tasks can also be cancelled, but there are no guarantees about how much of the task is processed at the time of cancel. Keep in mind that cancelling a task will cause also delete the task at the same time, and it cannot be retrieved after cancel.