Scheduling

In the preceding section we introduced events. In this section we’ll look at more complex date and time scheduling. We’ll also examine the ActiveBatch Date Arithmetic facility that allows you to perform your own date arithmetic and processing for your applications.

 

Date/Time Scheduling

 

Date/Time Scheduling can involve the job/plan or the schedule object. ActiveBatch offers three (3) main categories for date/time scheduling: Interval, Schedules and Constraint-based.

 

Interval

 

Date/Time interval differs from date/time scheduling in that no date is specified but implied. For example, “every 30 minutes” or “every 1 day, 6 hours and 15 minutes” explicitly specifies a frequency and the date is implied.

 


The figure on the left shows a sample interval of 1 hour. This means that if the object is submitted for execution at noon (1200) a series of predictable times will be produced (1200, 1300, 1400, etc). However, there is a possible problem with this approach. What if the job’s elapsed run-time will take more than an hour? If the job does not support multiple instances the 1300 instance, for example, might be skipped. To avoid this issue, the Compute Interval after Completion checkbox is available. By default, intervals are computed from when a job is submitted for execution. With the Compute Interval checkbox enabled, the interval is computed when the job actually ends. For example, if the job runs at 1200 and takes 30 minutes, the next scheduled run will be 1330 (that’s 1230 plus 1 hour). When using Interval scheduling, this approach may be a more desirable action.

 

Schedules

 

Use of Schedules provide the best granularity of selecting both eligible days or dates for execution as well as times when the object may be executed.

 

 

With “Use Schedules” selected, you would specify one or more Schedule objects to associate with the Plan or Job. When you specify more than one (1) Schedule, a union of dates and times will be formed (duplicates are ignored).

Note: If you select “Use Schedules” and then specify no Schedule objects, the Plan/Job/Reference object will not execute.

 

Constraint-Based

 

Constraint-based scheduling (CBS) indicates that when the constraints for an object have been met, the object should execute. Constraint-based scheduling arms once at the beginning of the calendar day (0000) or business day (0000 or as specified). Objects which are eligible to execute based on the day/dates specified in Schedule(s) objects may run. ActiveBatch allows you to influence the earliest starting time or latest execution time. We’ll discuss CBS more in the sections that follow.

 

 

Time Zone and Missed Scheduling

 

As we dive into the time portion of scheduling we need to relate a time zone to that time. By default, all times are taken from the Job Scheduler Service (JSS) machine (or the Job Scheduler time zone). The dropdown below allows you to specify any possible time zone. If specified, all times will be viewed from that time zone’s perspective. For example, assume the JSS time zone is US Eastern Time and the current time in that zone is 1200. If US PST is specified and the time specified is 1200, the scheduled time will not execute until 1500 (or 1200 PT). ActiveBatch properly applies Standard or Daylight Savings rules (as appropriate) to all times.

 

 

The “Run Last Missed Schedule” checkbox, only applicable for Interval or Date/Time Scheduling, indicates what ActiveBatch should do if a scheduled time was missed (for example, the JSS service or machine was done). If enabled, any missed schedules will cause the object to be executed immediately (assuming the day/date is still eligible). Regardless of how many missed schedules, the object will be run once to make up for the missed opportunity. If disabled, any missed schedules are ignored. Typically you will want to enable this checkbox when the object is not run frequently in any particular day. On the other hand, if the object is executed every hour then the missed schedule is probably not significant.

 

Date/Time Scheduling with Schedule Object

 

The predominant way of performing date/time scheduling is with a Schedule object. ActiveBatch does support associating one or more schedules with a Plan or Job. The Schedule itself consists of three (3) parts: Time Specification, Date Specification and Effective Range.

Let’s examine this type of scheduling by presenting several different requirements and how they would be addressed using Best Practices.

 

#1: Need to schedule a Plan every Monday, Wednesday and Friday at 0600 and 1800.

 

Solution: Create a Schedule MWF with no Time specification and with a Day specification of Weekly: Monday, Wednesday and Friday. Associate that schedule with the Plan and enter times embedded with the Plan. For example:

 

 

The advantage to not specifying times within a Schedule object is that the object becomes very shareable. When you think about scheduling of business workflows, it is typical that many workflows run on the same day but not at the same time. As the Schedule object is meant to be reusable (as with every object) specifying the time reduces the share ability of the object. On the other hand, if you need to schedule an object on specific days/dates and times with little benefit to sharing that object then specifying the time works well.

 

#2: Need to schedule a Job on the first and last business day of the month at 1200.

 

Solution: Create a Schedule BUSFirstLast with no Time specification. The Day specification is as follows:

 

 

Note that the Calendar Type is Business. This means that one or more Calendar objects have been specified that indicate which days are business days, which days are non-working days and which business days have holidays.

 

 

#3: Need to schedule my End-of-Day workflow so it begins at 1900 except on half-day holidays when I need it to start at 1300.

 

Solution: Create two (2) Calendars separating the full-day holidays from the half-day holidays. Create two (2) Schedules with no time specification. Day Specification is Business Calendar type. For one of the Schedules (BUSDAILY) associate both Calendars as Exclusion; for the other Schedule (HALFBUSDAILY) associate the full-day holidays Calendar as Exclusion and the half-day holidays as Inclusion. Then associate the Schedules to the Plan with the following times:

 

 

#4: Need to schedule my Report workflows to run on the last day of a quarter.

Solution: Create a Schedule of type Fiscal Calendar. Indicate the starting base date of the fiscal year and fiscal week breakdown for the quarter.

 

 

#5: Need to schedule a workflow on the second business day of the month, unless that day is a Tuesday in which case, schedule the run for Wednesday (or the next business day).

 

Solution: Create a Schedule of type Calendar. Select “Custom Calendar” and enter the following Date Arithmetic specification.

 

 

Date/Time Constraints

 

The previous sections described the different ways in which you can schedule a job based on date/time requirements. This section delves into some of the ways in which you can refine when a job/plan will execute.

 

 Business Calendar

 

A business day is defined as a day of the week that does not include non-business days and holidays. Non-business days tend to be fixed days. In the United States and much of the world, Saturday and Sunday (weekend) are considered nonbusiness days. Holidays are exceptions to days that we would normally do business. ActiveBatch provides an object for the representation of these non-work days and holidays. The object is a Calendar. ActiveBatch supports the creation of many calendars and you may select whether to use the non-work day portion, the holiday portion or both.

 

 

The above figure is representative of a United States Calendar. Non-Business Days are Saturday and Sunday and several holidays are listed. Note Thanksgiving is represented as a 2 day holiday. That’s because many companies also give the Friday after Thanksgiving Day as a holiday. Relative holidays by definition are established to avoid weekend (or nonbusiness days). Fixed holidays, on the other hand, can fall on a non-business day. ActiveBatch provides a mechanism for dealing with those days called “On Non-Business Day”. That means that when a holiday happens to fall on a non-business day, how should ActiveBatch handle that condition. Your choices are: Skip (or do nothing), Use Closest (meaning next or previous to the nearest business day; i.e. Saturday becomes Friday, Sunday becomes Monday), Use Next (meaning advance to the next business day), and Use Previous (meaning go backwards to the previous Business Day).

 

You can associate Calendars with a Schedule to form a Business Schedule. Doing so means you associate the Calendar on the Exclusion List. Days on a Calendar becoming excluded from the Schedule. You can also associate Calendars on an Inclusion List. This means that certain dates should be considered as “included” in terms of the Schedule’s dates.

 

You can also associate a Calendar with a Job or Plan. The advantage of associating Calendars at this level is that you can decide, on a case-by-case basis, how to proceed if there’s a conflict.

 

 

When a plan or job has been associated with a calendar and a normal business day conflicts with a holiday the job author has the choice of: (1) skip execution (default), (2) execute the object on the previous business day or (3) execute the object on the next business day.

 

Exclusion Dates

 

ActiveBatch also provides a general date/time exclusion facility.

 

 

You may exclude based on day, date, date range and/or time range. The exclusion date/time facility allows you to exclude one or more occurrences of a repeating job/plan.

 

Maximum Dispatch Time

 

This job property allows you to control the amount of time that a job may wait from dispatch to the start of execution. For example, a max dispatch time of 1 hour would mean a job instantiated at 8am must begin executing at 9am or the job is aborted (cancelled) prior to execution.

 

 

Constraint-Based Scheduling

 

ActiveBatch provides many types of trigger mechanisms that start a workflow. Date/Time, Events, etc. Constraint-based scheduling (CBS) is a variation of trigger based scheduling. Instead of specifying a time, enabling CBS allows ActiveBatch to arm the Plan or Job once per day (either Calendar or Business day) and to execute the object whenever the object’s constraints are met. For example, assume EndOfDay is a Plan that is waiting for several related Plans to complete. Rather than indicate that the plan is to start at 1900 (7pm) regardless of when the other plans complete, CBS provides a more efficient method of starting the workflow.

 

 

While a time specification isn’t needed, CBS still requires a Schedule(s) to determine day eligibility. If you omit the Schedule, the object will not execute. Based on the above example, this object will be eligible to run at midnight (0000) (unless Business Day Semantics is enabled; see next section). You can influence the starting time through the “Earliest Time” property. So if you wanted to ensure that EndOfDay didn’t start before 1800 (or 6pm) you would specify this:

 

 

Enabling the “Latest Time” would indicate to ActiveBatch the latest time for starting the object. Once the latest time is reached, the object will not execute for that day.

 

Business Day Semantics

 

ActiveBatch has always supported the concepts of a Business Day from the perspective of Working Days versus NonWorking Days. In this section, Business Day semantics refers to when the start of a business day is define. By default, a Calendar or Business Day begins at midnight (0000). With ActiveBatch you can indicate the time when a Business Day should start. This can be important for many businesses where an End-of-Day workflow can run past midnight but the Business Date is not intended to change until that workflow ends (or when the Production day begins). The ActiveBatch Administrator can define the start of the Business Day. For example, if the Business Day is defined to begin at 0600 (and ends at 0559) then midnight is meaningless. The next day won’t begin until 0600.

By default, Plan and Job objects use Calendar Day semantics. To indicate that a Plan or Job is to use Business Day semantics, enable this checkbox:

 

 

Enabling this checkbox has several ramifications in terms of: Constraint-based Scheduling and Job level constraints.