Search This Blog

Wednesday, November 25, 2009

Batch Scheduling

The People Tools process scheduler allows you to run jobs on a regular schedule. This wiki page goes through the two ways to set up batch scheduling using recurrences.

Batch Scheduling Terminology

However, before setting up batch scheduling, there's some terminology that you'll need to be aware of:

·       A job is a collection of one or more processes that run together.

·       A recurrence defines a regular event. For example a daily recurrence would be for every day of the week. A recurrence includes a start request date and time, an end request date and time, and repeat information (e.g. repeat every 1 hour for 24 hours).

·       A schedule job set definition is a job that has been scheduled to run on a regular basis (with a recurrence) using specific run control(s) and parameters.

The navigations you'll need to know are:

·       People Tools > Process Scheduler > Jobs

·       People Tools > Process Scheduler > Recurrences

·       People Tools > Process Scheduler > Schedule Job set Definitions

Recurrences through the Process Scheduler

The first (and simplest) way to schedule something to run on a regular basis is to select a recurrence when you schedule a process through the process scheduler. For example, if you wanted to run the system audit process through system process requests each day, navigate to People Tools > Process Scheduler > System Process Requests then select the system audit process to be run. At the process scheduler request page, you would then select a recurrence. Here's an example screenshot.

You can use this technique for any process you can run through the process scheduler and gives you access to this page first.

Now if you go to the process monitor you'll see your SYSAUDIT process running as per normal, but it now includes a green recurrence icon after the process name that looks like this:

Note that you will probably end up with two items in the process monitor. The first item is your request running today and the second will be the queued request for tomorrow (or sometime in the future depending on your recurrence). You can see this in the screenshot above. Process instance 2173557 was initiated on 05/01/2009 and has run to success and posted. Process instance 2173558 will run on 06/01/2009 at 12:02:00 AM and is currently set to queued.

You can also click on the green recurrence icon to manage the process further. This gives you:

·       The ability to hold (suspend) the recurrence. This will change the run status to Hold. The ability to stop the request recurring

·       The ability resume the recurrence if it has been stopped or set to hold.

·       A request list with a history of the process requests that have already run through this recurrence and if/when the process will recur next

Using this method works well for simple recurrences for a single process or jobs. If you want more advanced options such running a job with difference run controls for each process then you'll need to use a schedule job set definition.

Schedule Job set Definitions

A schedule job set definition needs to run on a job. So the first step might be to create a job with one or more processes in it. For this example, I’m using the delivered All Process Types ALLTYPES Sob. This runs a COBOL, a Crystal Report and a SQR report and is available through system process requests.

Once you have a job, navigate to the Schedule JobSet Definitions page (PeopleTools > Process Scheduler > Schedule Jobset Definitions) and select Add a New Value. For this example:

·       The schedule name will be All Types Example

·       The job name is ALLTYPES (and needs to exist first)

By default a new jobset definition has a status of inactive. You'll want to leave it inactive until you know it is working correctly - especially for more volatile processes. You'll need to also specify a run control ID. Note that this is user specific - the user that creates the schedule jobset is the one that the processes will be running under. For this reason, a lot of organizations create their own batch scheduling user (e.g. PSBATCH) for the specific purpose of running batch processes and jobs. All run controls, and schedule job set definitions are then configured using that user. In this example, I'm just using the default run control ID which is my operator ID as this will always exist.

The next step is to set a begin date and time. This will be the date and time from which the job set will begin. You'll also need select your recurrence (daily for this example). You can also specify a process scheduler server if specifically required. However, it might be better to let People Tools decide what server to use. In this example, the ALLTYPES job includes a crystal report that will need to run on an NT server, however, the other processes should run on a Unix server.

Next, you'll need to specify schedule job set items. This is effectively where you choose the run controls to be used by your job/processes. Use the left hand side tree view to expand your job (click on the icons) and then for each of the three processes, specify a run control ID (I’m using my operator ID). Note that these run control IDs need to already exist and be configured before you set them up in the job set items.

Also, for the ALLTYPES job, the crystal process (XRFAPFL) needs to have its server settings changed so that the server option is Specific Server and the server name is PSNT. This is because crystal reports can only run on Windows process schedulers servers.

The final tab, schedule job set requests, is for informational purposes. It tells which requests have already been processed and when the next one is queued to run.

Before you set the job set definition status to active, use the Run Now button to run the job set definition once to check it runs to success. Also note that when you save the schedule job set definition, it may clear the recurrence name - this appears to be a bug?

Go to the process monitor and you should see the ALLTYPES job running, and hopefully it runs to success for you. Also, you should see the job set definition calendar icon. Clicking on this icon tells gives you all the schedule job set requests.

Note that your job set definition may change status to completed. This indicates that the job set has finished running and there are no more recurrences for it to process. The job set will not run again with a status of completed. Change this back to active and ensure that your recurrence settings are correct.

Recurrences

In both examples, I've been using the Daily recurrence, which I believe is delivered with People Tools. However you might want to create your own recurrence with a different recurrence pattern, and request settings.

To do this, navigate to People Tools > Process Scheduler > Recurrences, add a new value and give it an informative name.

You'll need to choose between the options, schedule next recurrence when current request is initiated OR prior recurrence has completed. This essentially specifies whether to schedule the future recurrence before or after the current recurrence process request has completed. You can choose a regular recurrence pattern, or use the customize dates option to specify one or more values in the run on specific dates grid. For example if you have a process that runs on two specific dates in a given calendar year, you can set them up this way.

The start and end request options are straightforward. The repeat is used to repeat a process within the recurrence pattern. For example if you might want your process to run every day, however, on each day you may also want it to run every 6 hours for the 24 hours of the day. That is, run 4 times each day (24 hours in day / repeat every 6 hours = 4 repeats).

The do not schedule processes missed from the recurrence pattern prevents the process scheduler from playing catch up if the start request date/time is before the current date/time. If you want processes to play catch up, then leave this unchecked, otherwise, set it to checked.

No comments:

Post a Comment