Scheduling

Agent control center provides an agent scheduling facility that enables you to automatically run your agents at predetermined time slots whenever you need it to run. This can be done every hour, every day, month, year and so on based on the requirement.

You can schedule agents using the Agent Control center scheduler.

Agent Schedule

To view and add job schedules of an agent, select Job Schedules from the agent context menu in the Agent Repository.

Schedule_on_ACC.jpg

Job schedules page shows the details regarding the status of all schedules.

Job_Schedule_details.jpg

Click on Add Schedule button to add a New schedule.

Add_Schedule_button.jpg

Adding Job Schedule in ACC is possible in 2 different ways.

  1. Basic Schedule
  2. Advanced Schedule (Schedule using CRON)

Basic Schedule

basic schedule can run an agent in a specified number of days, hours, minutes or seconds.

Basic_scheduling_Window.jpg

Start time and time zone specify the time an agent will run.

There is an option to schedule a job minutes wise, seconds wise, hours wise and days wise by selecting from the drop-down.

basic_schedule_with_minutes_seconds_details.png

CRON Schedule

CRON expression can be used to add a more complex schedule. Please see CRON expressions for more information. 

CRON schedule provides a facility to schedule an agent on a particular weekday or a particular time frame of a day.

Adding_Job_schedule_using_CRON_expression.jpg

Log level is the log level used when the agent is run. The log level can be High, Medium, Low or None.

Session ID can be used to start multiple sessions of an agent e.g. if someone wants to run the agent in five sessions then 1-5/5 can be written in session ID and it will run the agent in five sessions with session IDs 1/5, 2/5, 3/5/, 4/5 and 5/5. The Session ID field will be disabled with a message “No session support” if the agent is not configured to support the sessions. 

Input parameters can be used to provide input data for the agent. See Input Parameters for more information.

Job Schedules page shows the status of the agents run.

In order to view the Job Schedules page, Navigate to the Job Schedules of the context Menu of the Agent Repository page.

Agent_scheduled_on_ACC_and_running_status.jpg

Note: In order to edit or disable the schedule you can do it using the options Edit/Disable from the context Menu of the Schedules page of ACC.

Edit_or_disable_schedule.jpg

Multiple Schedules can be added for an agent, navigate to Agents -> Schedules -> Select Schedulers by Server or Cluster, select the agent you desired to view the Job History, click on Job History from the Context Menu in order to view the Job History details.

Job_History_page.jpg

Note: When a scheduled job is in execution then the new schedules can’t be added for that job. One should wait for the completion of the job to add new schedules however the schedule can be edited for that job even when it is in execution.

Sequentum Enterprise provides an agent scheduling facility that enables you to automatically run your agents at predetermined time slots whenever you need it to run. This can be done every hour, every day, month, year and so on.

You can schedule agents using the Sequentum Enterprise scheduler or the Windows Task Scheduler. We recommend you use the Sequentum Enterprise scheduler for new agents since it provides more advanced features and integrates more tightly with the rest of the Sequentum Enterprise application. The Windows Task Scheduler integration is provided for backward compatibility. Please read the Windows Task Scheduler if you prefer to use this scheduler.

Sequentum Enterprise Scheduler

If you have an agent loaded in Sequentum Enterprise, you will be able to access the Scheduling feature. From the Agent menu at the top of the Sequentum Enterprise application. Simply Click on the Schedules menu option to display the Scheduling window.

ScheduleNew.png

If one or more schedules already exists for the current agent, a Window listing all schedules will open, and you can edit existing schedules or add more schedules from there.

SchedulesWindow.png

Cron Expressions

The Sequentum Enterprise Scheduler uses Cron expressions to define when the scheduler should run an agent. If you set up a basic schedule, Sequentum Enterprise will automatically convert the basic schedule into a Cron expression. When you edit an existing schedule, the Cron expression will always be shown, but you can simply switch back to the basic schedule if you don't want to work with Cron expressions.

Please read Cron Expressions for more information about Cron syntax.

Schedule via scripting

Schedules can also be added via scripting and it allows you to use the Cron schedules in your script to add a schedule. It can be added by using the below two methods:

1. Add Schedule script method allows you to add an agent schedule which can be a "once off" schedule which automatically gets deleted once the agent run has successfully completed. This type of scheduling method allows you to add temporary schedules which get removed on its own once the agent completes its execution successfully.

The sample script below can be used either in the Agent Initialization Scripts or in the Data Export Scripts.

var inputParameters = new Dictionary<string, string>();
inputParameters.Add("run_id_", "new");
var logFile = @"C:\logs\log.txt";
var cronExpression = "0 0 */4 * * *"; // Cron expression for schedule that runs a job every 4 hours.
var isDeleteScheduleOnSuccess = true; // One-off schedule
var sessionID = "1-5/5"; // The session to schedule. Otherwise, set to null.

// Adds a one-off schedule that will execute every 4 hours.
// The agent will run every 4 hours from now, and will delete the schedule if the agent
// completes successfully. Otherwise, the agent will run again after 4 hours.
args.AddSchedule(args.Agent, sessionID, cronExpression, inputParameters, DateTime.Now, isDeleteScheduleOnSuccess, AgentLogLevel.High, logFile, true);

2. The schedule can be specified as once off and will then be removed if the scheduled run completes successfully, fails or can be set to remove always. This is a more useful method and provides more flexibility to the user for adding a temporary schedule via scripting.

var inputParameters = new Dictionary<string, string>();
inputParameters.Add("run_id_", "new","run_method_", "ContinueAndRetryErrorsRefreshAgent");
var logFile = Path.Combine(args.Agent.DirectoryName, "Log", "ScheduledRun.log");
var isDeleteScheduleOnSuccess = true; // One-off schedule
var sessionID = ""; // The session to schedule. Otherwise, set to null.

// Cron expression for schedule that runs after 1 minute.
var nextSchedule = DateTime.Now.AddMinutes(1);
var cronExpression = string.Format("0 {0:mm} {0:HH} * * *",nextSchedule);

// Adds a one-off schedule that will execute 1 minute from now.
// The schedule will get deleted if the agent completes successfully.
args.AddSchedule(args.Agent, sessionID, cronExpression, inputParameters, DateTime.Now, isDeleteScheduleOnSuccess, AgentLogLevel.High, logFile,true);

Although both scripts are used for adding temporary schedules, the second script provides more flexibility as it covers all points for which a user would always want to get the temporary schedule removed.

Scheduler Windows Service

The Scheduler depends on the Sequentum Enterprise Windows service, and the service must be running for the scheduler to be operational. If the service is not running, a message will be displayed at the top of the Scheduler Windows with a link allowing you to start the service. We recommend you configure the service to start automatically when your computer starts.

configureservice.png

Make sure the Sequentum Scheduler is enabled before you start the service. Remote procedure calls and Web request are used by the API and are not required by the scheduler.

Cron Expressions

The Sequentum Enterprise Scheduler uses Cron expressions to define when the scheduler should run an agent. The scheduler supports standard Cron expressions with seconds, but without year, so the expressions consist of 6 parts.

Field Name

Mandatory

Allowed Values

Allowed Special Characters

Seconds

Yes

0-59

, - * /

Minutes

Yes

0-59

, - * /

Hours

Yes

0-23

, - * /

Day of Month

Yes

1-31

, - * ? / L W

Month

Yes

1-12 or JAN-DEC

, - * /

Day of Week

Yes

0-7 or SUN-SAT

, - * ? / L #

 

Cron Expression Examples

Cron Expression

Meaning

* * * * * *

Execute a job every second

0 */5 * * * *

Execute a job every 5 minutes

0 0 * * * *

Execute a job every hour

0 0 12 * * *

Executes a job at 12 pm (noon) every day

0 0/5 14,18 * * *

Executes a job every 5 minutes starting at 2 pm and ending at 2:55 pm, AND fire every 5 minutes starting at 6 pm and ending at 6:55 pm, every day

0 0 0 * * 3

Executes a job at midnight every Wednesday

0 15 10 L * *

Executes a job at 10:15 am on the last day of every month

0 15 10 15 * *

Executes a job at 10:15 am on the 15th day of every month

0 0 0 1,2 * *

Executes a job at midnight of the 1st, 2nd day of each month

0 15 10 * * 5#3

Executes a job at 10:15 am on the third Friday of every month

Special characters

Asterisk ( * ) - The asterisk indicates that the cron expression matches for all values of the field. E.g. using an asterisk in the 2nd field (minute) indicates every minute. * is a non-restricted character.

Slash ( / ) - Slashes describe increments of ranges. For example, 3-59/15 in the 2nd field (minutes) indicate the third minute of the hour and every 15 minutes thereafter. The form "*/..." is equivalent to the form "first-last/...", that is, an increment over the largest possible range of the field.

Comma (,) - Commas are used to separate items of a list. For example, using "1,2,5" in the 6th field (day of the week) means Mondays, Wednesdays, and Fridays.

Hyphen ( - ) - Hyphens define ranges. For example, using "MON-FRI" in the 6th field (day of the week) means all weekdays, but not weekends.

L - 'L' stands for "last". When used in the day-of-week field, it allows you to specify constructs such as "the last Friday" ("5L") of a given month. In the day-of-month field, it specifies the last day of the month.

W - The 'W' character is allowed for the day-of-month field. This character is used to specify the weekday (Monday-Friday) nearest the given day. As an example, if you were to specify "15W" as the value for the day-of-month field, the meaning is: "the nearest weekday to the 15th of the month." So, if the 15th is a Saturday, the job executes on Friday the 14th. If the 15th is a Sunday, the job executes on Monday the 16th. If the 15th is a Tuesday, then it executes on Tuesday the 15th. However, if you specify "1W" as the value for day-of-month, and the 1st is a Saturday, the job executes on Monday the 3rd, as it does not 'jump' over the boundary of a month's days. The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.

Hash ( # ) - '#' is allowed for the day-of-week field, and must be followed by a number between one and five. For example, 5#2 indicates "the second Friday" of a given month.

Question mark ( ? ) - It is used instead of '*' for leaving either day-of-month or day-of-week blank. ? is a restricted character.

Windows Task Scheduler

Sequentum Enterprise allows you to add tasks to the Windows Task Scheduler, as an alternative to the Sequentum Enterprise Scheduler.

If you have an Agent loaded in Sequentum Enterprise, you will be able to access the Scheduling feature. From the Tools menu at the top of the Sequentum Enterprise application. Simply Click on the Add Schedule menu option in the Deprecated options group to display the Scheduling window.

TaskScheduler.png

Sequentum Enterprise's Scheduling Window

The Enable schedule checkbox allows you to easily turn scheduling on or off for the agent. Click the Enable schedule checkbox so you can begin configuring the schedule details.

The Run interval fields allow you to select how often your agent will run. This can be set in seconds, minutes, hours or days. Start date and Start time enable to preciously control from when the agent will start executing.

The log feature allows you to record when the agent runs. The log level setting you choose (i.e. none, Low, Medium, High) will determine the level of detail that is recorded about each run. For instance, you may want to track all error messages or issues encountered by the running agent so you might choose "High". However, be mindful that a high level of logging may slow the Agent performance.

Sequentum Enterprise also includes some scheduling security features. If you don't want your Agent to run when you aren't logged on to your computer, simply click the Run only if user is logged on the checkbox.

If you don't set the option Run only if user is logged on, the agent will run in a special Windows desktop session that does not allow input focus. This is a Windows security feature and cannot be circumvented. This may cause JavaScript on some websites to work incorrectly and the agent may not be able to extract data correctly. This scenario is very rare, but if it occurs you will need to set the scheduling option Run only if user is logged on and make sure the user is always logged on to the computer when the agent is running.

When using the option Run task as current user you may get an error Access Denied. To avoid this error you can run Sequentum Enterprise as an administrator or you can clear the option Run task as current user and enter your username and password instead. To run Sequentum Enterprise Enterprise as an administrator, right click on the Sequentum Enterprise Enterprise program file or shortcut and select Run as administrator from the context menu.

Using Windows Task Scheduler

Should you want to manage multiple agents from one place or are looking for additional controls, or calendar functionality, you can utilize the Windows Task Scheduler instead. To do this, simply click on the Open Windows Scheduler button on the Scheduling window.

Windows Task Scheduler is used to create and manage common tasks that your computer will carry out automatically at the times you specify. In this instance, the task will be to run a web data extraction agent(s) at the scheduled time(s) you require.

To setup a basic agent schedule task, simply go to the Action menu and select the Basic Task Wizard. This wizard will lead you through the required steps to setup your schedule task.

CreateBasicTask.png

Windows Task Scheduler - Using the Basic Task Wizard

For more advanced scheduling options or settings such as multiple task actions or triggers, use the Create Task command in the Actions menu.

CreateTask.png

Windows Task Scheduler - Create Task Command (for advanced options)

Tasks are stored in folders in the Task Scheduler Library. To view or perform an operation on an individual task, select it in the Task Scheduler Library and click on a command in the Action menu.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.