[Contents] [Prev] [Next] [End]


Chapter 4. Calendars


What is a Calendar?

A calendar consists of a sequence of time events defined using one or more time expressions. The happening of a time event associated with a calendar can trigger the execution of your production jobs. Calendars are defined and manipulated independently of jobs. This allows multiple jobs to share the same calendar. There are three types of calendars you can use to submit your job:

Calendar Specification

A calendar has a name, an owner (user), and a description. The name of the calendar1. and its owner are assigned when it is created. The current status of a calendar is determined by the status of time events associated with the calendar. A calendar is active if one or more of the associated time events are active and inactive if none of the associated time events is active.

Time Event

A time event in JobScheduler consists of a starting time and duration in which the event remains active. The happening of a time event changes the status of calendar from inactive to active. Time events are defined using a time expression.

Time Expression

A time expression is a convenient syntax for defining time events. It is a string consisting of five mandatory fields used to control the starting time of an event and an optional field specifying the duration of an event. To prevent the shell from interpreting special characters, the time expression should be placed within quotes. A time expression has the following format:

year:month:day:hour:min[%duration]

The fields are defined as follows:

year
A four-digit number of the form 19nn or 20nn.
month
One of the strings Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, or Dec, or a number between 1 and 12, where 1 corresponds to January and 12 to December.
day
A number between 1 and 31 to indicate the day of the month, a dayName which is one of the strings Mon, Tue, Wed, Thu, Fri, Sat or Sun to indicate a day of the week, or a string of the form dayName[n], where n indicates the week of the month, for example, Mon[2] to indicate the second Monday of the month.
Placing a ~ (tilde) in front of the day number indicates the day starting from the end of the month, for example, ~1 indicates the last day of the month. dayName[~n] indicates the day from the end of the month, for example, Mon[~2] indicates the second to last Monday of the month.
hour
A number between 0 and 23.
minute
A number between 0 and 59.
duration
A number of the form nD, nH, or nM to indicate the duration of the time event, where n is a positive number and D, H, and M are units2. indicating days, hours, and minutes, respectively. If no unit is specified, then the duration is considered to be minutes. If a duration is not specified, the default is one minute.

The values for the first five fields may be specified as follows:

There can be no space within a time expression.

Example Time Expressions

*:*:*:12:0%30 
Defines a time event, which occurs at noon every day and lasts for 30 minutes.
1997:*:Mon-Fri:9-17:* 
Defines a time event which occurs every hour of the working day---from 9 a.m. to 5 p.m. on the weekdays in 1997.
*:Mar,Jun,Sep,Dec:Mon[1],Tue[2],Wed[3],Thu[4],Fri[5]:23:30%1H 
Defines a time event which occurs at 11:30 p.m. on the first Monday, the second Tuesday, the third Wednesday, the fourth Thursday, and the fifth Friday of the months March, June, September, and December and lasts for one hour.

Time Expression List

To specify complex or non-uniform events, several time expressions can be combined into a time expression list, with expressions separated by a space. The time expression list is used to generate the time events for a calendar.

*:*:*:12:0%30 *:Mar:Mon,Tue:22:30 
Defines a time event which occurs at noon every day and lasts for 30 minutes and an event which also occurs at 10:30 p.m. on Mondays and Tuesdays in March.

Note
If a time expression list contains time expressions specifying overlapping events, then they are handled in such a way that the happening of a new event terminates a previous event that would otherwise still be active until the end of the duration.

Creating Calendars

You use the bcaladd command to create a new calendar in the system. Each calendar has a name, an optional description, and a time expression list defining the time events.

The time expression list is specified with the -t option. To prevent the shell from interpreting any blank or special characters, the time expression list should be placed within quotes.

The optional description is a string of text declared with the -d option. If the string contains blanks or special characters, it should be placed within quotes as well.

Example of Creating a Calendar

% bcaladd -d "Daily Calendar" -t "*:*:*:08:0%30" daily
Calendar <daily> is created.

This creates a calendar named daily with the description 'Daily Calendar'. It is active every day at 8 a.m. for a period of 30 minutes.

Using the GUI to Create Calendars

You may find it more convenient to create your calendars using the GUI application, xbcal, as shown in Figure 6.

Figure 6. xbcal Calendar Creation Window

xbcal Calendar Creation Window

Each item in the 'Time Expression' area has an 'extras' button  which leads to a further pop-up window. These pop-ups allow you to select the details for each field.

Figure 7 shows the resulting pop-up from clicking the button beside the Years item.

Figure 7. xbcal Calendar Year Window

xbcal Calendar Year Window

Clicking the button beside the Months item results in the pop-up shown in Figure 8.

Figure 8. xbcal Calendar Months Window

xbcal Calendar Months Window

Figure 9 shows the resulting pop-up from selecting the Days item. This pop-up has two separate windows. The first allows you to select days of the month. The second allows you to select days of the week. Selecting the 'Reverse' button  reverses the meaning of the day selections. See 'Time Expression' for further details.

Figure 9. xbcal Calendar Days Window

xbcal Calendar Days Window

Clicking the button beside the Hours item results in the pop-up shown in Figure 10.

Figure 10. xbcal Calendar Hours Window

xbcal Calendar Hours Window

Figure 11 shows the resulting pop-up from selecting the button beside the Minutes item.

Figure 11. xbcal Calendar Minutes Window

xbcal Calendar Minutes Window

The last pop-up is the Duration window, shown in Figure 12.

Figure 12. xbcal Calendar Duration Window

xbcal Calendar Duration Window

Displaying Calendars

You can display all the defined calendars by using the bcal command.

% bcal
CALENDAR_NAME      OWNER      STATUS    DURATION         NEXT_EVENT_TIME
Daily              SYS       inactive       -        Wed Dec 25 06:00:00 1996
Holiday            SYS       inactive       -        Wed Dec 25 00:00:00 1996
Midnight           SYS       inactive       -        Wed Dec 25 00:00:00 1996
daily              user1     inactive       -        Wed Dec 25 08:00:00 1996
hourly             user1      active        7        Tue Dec 24 16:00:00 1996
complex            user1     inactive       -        Wed Dec 25 17:00:00 1996

The CALENDAR_NAME field lists the name of the calendar.

The OWNER field shows the user name of the calendar owner. By default, you will see all your calendars as well as the system calendars.

The STATUS field can be either active or inactive. If the current time is within a time event of the calendar, the status will be active; otherwise, it will be inactive.

The DURATION field of an inactive calendar is set to '-'. For an active calendar, this field indicates the time (in minutes) that the calendar will remain active.

The NEXT_EVENT_TIME field indicates the starting time for the next time event associated with the calendar.

Displaying Details

You can use the -l option to display more detail about your calendars.

% bcal -l
CALENDAR:  daily
  -- Daily Calendar

OWNER     STATUS           CREATION_TIME                  LAST_MODIFY_TIME
user1    inactive     Fri Dec 13 14:19:39 1996        Tue Dec 17 14:12:02 1996

TIME_EXPR_LIST:  *:*:*:8:0%30
LAST_EVENT_TIME: <Tue Dec 24 08:00:00 1996> to <Tue Dec 24 08:30:00 1996>
NEXT_EVENT_TIME: <Wed Dec 25 08:00:00 1996> to <Wed Dec 25 08:30:00 1996>
-------------------------------------------------------------------------------


CALENDAR:  hourly
  -- Hourly Thirty Minute Calendar

OWNER     STATUS           CREATION_TIME                  LAST_MODIFY_TIME
user1     active      Mon Dec 16 15:18:18 1996                   -

TIME_EXPR_LIST:  *:*:*:*:0%30
LAST_EVENT_TIME: <Tue Dec 24 15:00:00 1996> to <Tue Dec 24 15:30:00 1996>
NEXT_EVENT_TIME: <Tue Dec 24 16:00:00 1996> to <Tue Dec 24 16:30:00 1996>
-------------------------------------------------------------------------------


CALENDAR:  complex
  -- Complicated Hourly Calendar

OWNER     STATUS           CREATION_TIME                  LAST_MODIFY_TIME
user1    inactive     Tue Dec 17 14:26:55 1996                   -

TIME_EXPR_LIST:  1996:*:Mon[1],Mon[3],Mon[4],Tue[1],Tue[2],Tue[4],Tue[5],Wed[2]
,Wed[3],Wed[5],Thu[1],Thu[3],Thu[4],Fri[1],Fri[2],Fri[4],Fri[5]:17,21,23:*%1h
LAST_EVENT_TIME: <Tue Dec 24 23:00:00 1996> to <Wed Dec 25 00:00:00 1996>
NEXT_EVENT_TIME: <Thu Dec 26 17:00:00 1996> to <Thu Dec 26 18:00:00 1996>

By default, bcal shows all of your calendars plus all of the system calendars. See 'System Calendars' for more details. You can specify a calendar by name.

% bcal hourly
CALENDAR_NAME      OWNER      STATUS    DURATION         NEXT_EVENT_TIME
hourly             user1      active        7        Tue Dec 24 16:00:00 1996

The -u user_name option displays calendars of the named user.

% bcal -u sysmgr
CALENDAR_NAME      OWNER      STATUS    DURATION         NEXT_EVENT_TIME
security           sysmgr    inactive        -        Tue Jan 01 00:10:00 1997

Note
The -u option is not applicable to system calendars.

You can see the calendars of all users if you use the reserved name all.

System Calendars

System calendars are read-only calendars defined in the JobScheduler configuration by the cluster administrator. System calendars are owned by the virtual user SYS and can be viewed by everybody. You cannot modify or delete the system calendars.

System calendars can be used as normal calendars. When a system calendar is defined, its name becomes a reserved calendar name in the cluster.

Note
The calendar name is case sensitive. If a system calendar is named Daily, you can still create a calendar named daily. If you try to create a calendar with the same name as an existing calendar, the JobScheduler system will return an error.

When the JobScheduler daemons start, the system calendars are defined in the cluster.

Viewing Calendars with the GUI

You can use the xbcal GUI application to view the calendars as shown in Figure 13.

Figure 13. xbcal Calendar Listing Window

xbcal Calendar Listing Window

To view the details of a selected calendar, click 'Edit,'  which then pops up a window showing the details of the calendar.

Modifying Calendars

You can modify your calendars with the bcalmod command. This command allows you to change the description or time expressions associated with your calendar. Only the owner or an LSF administrator is allowed to modify a calendar.

% bcalmod -d "Daily Calendar @ 8:30" -t "*:*:*:08:30%30" daily
Calendar <daily> is modified.
% bcal -l daily
CALENDAR:  daily
  -- Daily Calendar @ 8:30

OWNER     STATUS           CREATION_TIME                  LAST_MODIFY_TIME
user1    inactive     Fri Dec 13 14:19:39 1996        Tue Dec 24 16:13:02 1996

TIME_EXPR_LIST:  *:*:*:8:30%30
LAST_EVENT_TIME: <Tue Dec 24 08:00:00 1996> to <Tue Dec 24 08:30:00 1996>
NEXT_EVENT_TIME: <Wed Dec 25 08:30:00 1996> to <Wed Dec 25 09:00:00 1996>

Once you have modified a calendar, all jobs that depend on the modified calendar will be scheduled according to the new time events.

Note that you cannot modify the name of a calendar using bcalmod. To modify the name of a calendar, you need to delete the existing calendar and then create a new one with the desired calendar name.

Using the GUI to Modify Calendars

A calendar can be modified using xbcal by first selecting the calendar to modify from the calendar listing window as shown in Figure 13, then click on the 'Edit' button . This will pop up a calendar edit window as shown in Figure 14.

Figure 14. xbcal Calendar Modification Window

xbcal Calendar Modification Window

After you have finished editing, choose 'Save' from the 'File' Menu, which commits the changes into the system.

Viewing the History of Calendars

Use the bcalhist command to display a history of events associated with the named calendars. These events include creation, modification and deletion.

% bcalhist daily
Fri Dec 13 14:19:39: Calendar <daily@user1> created by user <user1>; Time expre
                     ssion <*:*:*:8:*>, description <No description provided.>.
Tue Dec 17 14:12:02: Calendar <daily@user1> modified by user or administrator <
                     user1>; Time expression <*:*:*:8:*>, description <daily jo
                     blist>.
Wed Dec 18 15:13:00: Calendar <daily@user1> modified by user or administrator <
                     user1>; Time expression <*:Aug,Sep,Oct:Tue,Thu,Sun:8:45%35
                     >, description <daily job list>.
Wed Dec 18 16:35:11: Calendar <daily@user1> modified by user or administrator <
                     user1>; Time expression <*:*:*:8:45%30m>, description <Dai
                     ly Calendar @ 8:45>.

Notice the format of the calendar name in the output. You can display the history of another user's calendar by specifying calendar_name@user_name. By default, bcalhist displays only the history of your calendars.

Note
You can not display the history of system calendars. They are read-only calendars and have no modification history.

Deleting Calendars

Calendars can also be deleted. The bcaldel command removes the named calendars from the system. Only the owner or an LSF administrator is allowed to remove a calendar.

% bcaldel daily
Calendar <daily> is deleted.
% bcal daily
daily: Bad calendar name
% bcalhist daily
Fri Dec 13 14:19:39: Calendar <daily@user1> created by user <user1>; Time expre
                     ssion <*:*:*:8:*>, description <No description provided.>.
Tue Dec 17 14:12:02: Calendar <daily@user1> modified by user or administrator <
                     user1>; Time expression <*:*:*:8:*>, description <daily jo
                     b list>.
Wed Dec 18 15:13:00: Calendar <daily@user1> modified by user or administrator <
                     user1>; Time expression <*:Aug,Sep,Oct:Tue,Thu,Sun:8:45%35
                     >, description <daily job list>.
Wed Dec 18 16:35:11: Calendar <daily@user1> modified by user or administrator <
                     user1>; Time expression <*:*:*:8:45%30m>, description <Dai
                     ly Calendar @ 8:45>.
Fri Dec 20 08:53:44: Calendar <daily@user1> deleted by user or administrator <u
                     ser1>.

Deleting Calendars with the GUI

You can delete a calendar using the xbcal GUI application as shown in Figure 15.

Figure 15. Deleting a Calendar with xbcal

Deleting a Calendar with xbcal

Note
Jobs that are associated with a deleted calendar will never be dispatched. You can either delete these jobs, or modify them so that they no longer depend on the deleted calendar.


1. The 'anonymous' calendar is the exception to this rule. It does not have a name. See 'Using an Anonymous Calendar' for details.

2. The unit indicators, D, H, and M, can be upper-case or lower-case characters.


[Contents] [Prev] [Next] [End]

doc@platform.com

Copyright © 1994-1997 Platform Computing Corporation.
All rights reserved.