Home | Tandem | My Tandem Resources | NetBatch Tutorial

 

 

********************************************************************************************

 

                  Scheduling Jobs for Dummies!

 

                        (Using NetBatch)

 

********************************************************************************************

 

Contents:

 

Introduction to NetBatch

Starting the Scheduler

Communicating with the scheduler

Initializing the scheduler

Submitting and Running Jobs

Job Control command

Winding up

 

 

Introduction to NetBatch:

=========================

NetBatch is a batch job-scheduling program that allows you to schedule (and run!) batch jobs.

NonStop servers are (famous for and) used for OLTP applications but even in OLTP environment you

will have certain jobs that you need to do in batch, like printing annual/monthly reports,

generating system performance statistics, etc.

 

 

 

Starting the Scheduler:

=======================

Issue the following command on TACL prompt to start the scheduler.

 

TACL> NETBATCH/NAME $NBS, NOWAIT, CPU 0/SUBVOL!

 

SUBVOL is the subvolume on your system where you want NetBatch to store its log files, and a bang (!)

after subvolume name instructs the scheduler to cold-start (purge and recreate all its files).

 

There is nothing special about the name $NBS; you can give any name you wish to run your scheduler with.

 

 

 

Communicating with the scheduler:

=================================

BATCHCOM is the utility used for communicating with the NetBatch scheduler.

 

TACL> BATCHCOM $NBS

 

This will display the Batchcom banner and the Batchcom prompt which is a closing curly bracket '}'

 

 

 

Initializing the scheduler:

===========================

You can have an obey file containing the commands and you can obey the file at Batchcom prompt like

 

1> OBEY SUBVOL.NBOBEY

 

Again, SUBVOL.NBOBEY is only a representative name; you can have any existing obey file's name.

 

Or, you can manually enter all commands one-at-a-time at the Batchcom prompt. The commands are

 

ADD SCHEDULER

START SCHEDULER

ADD CLASS DEFAULT

ADD EXECUTOR E1, CPU 0

ADD EXECUTOR E2, CPU 1

START EXECUTOR *

This makes your scheduler ready to accept jobs that you want to run.

 

A CLASS in NetBatch is a collection of related/unrelated jobs. All jobs in NetBatch need to belong to a CLASS.

Hence, you can mention a class to the time of submitting a job. If you don't, the job will be added to the

class DEFAULT - hence it is mandatory to have that class added to the scheduler.

 

An Executor is a logical pipeline (or a queue) to a CPU. A CPU may be linked to multiple EXECUTORs, whereas

an EXECUTOR is linked to only one CPU. A CLASS can be linked to an EXECUTOR. This way you can control the

CPU on which the NetBatch jobs (belonging to that class) run. If you don't link a CLASS to an EXECUTOR,

the jobs in the CLASS will run on any available EXECUTOR.

 

 

 

Submitting and Running jobs:

============================

You can submit jobs to the scheduler by using the SUBMIT JOB or SUBMIT JOB command at

Batchcom prompt. Commands for submitting jobs can be as long and complex as you desire.

We will see some sample ones.

 

ADD JOB1, E-P DELAY, S-M "10 SECONDS"

 

This job is named JOB1 and it is identical to issuing the command

 

DELAY 10 SECONDS

 

at the TACL prompt. E-P stands for Executor Program, the program

that is going to execute your jobs. Remember, NetBatch is a scheduler, it decides

when to run which jobs and manages resources associated, it does not 'run' jobs. All jobs

should have an executor program. Unless specifically mentioned while adding the job, TACL is the Executor-Program.

 

S-M stands for startup-message, the message that is required by the E-P to do the

desired job. Here the desired job is only to issue a delay of 10 seconds.

 

Here, the job executes immediately upon issuing the above command.

 

Note: E-P (executor program) is TACL by default.

 

ADD JOB2, E-P DELAY, S-M "2 SECONDS", EVERY 5 MINUTES, AFTER 13:00

 

Here the job is made to run every 5 minutes after 1 pm. The job will not run immediately

upon submission. You can, if you wish, also give EVERY 10 HOURS (or EVERY 10 DAYS

for that matter).

 

Nobody said you can use only DELAY as the E-P. You can use ANY 100 or 700 code file as

an E-P for a job depending upon the job requirements.

 

ADD JOB3, E-P FUP, S-M "INFO *", OUT $DATA09.SUBVOL.FUPOUT

 

The above job uses FUP as the executor-program and is identical to issuing command FUP INFO *

on the TACL prompt. The output of this job (i.e. the output of FUP INFO * command) goes to a disk file.

 

Note: By default the output of all the jobs scheduled by NetBatch goes to the spooler location $S.#BATCH

 

If you have a job that uses multiple executor-programs you can use an obey file and

use TACL as the executor-program (E-P).

 

ADD JOB4, IN $DATA09.SUBVOL.INFILE, AT 16:00

 

And the contents of INFILE can be anything that can be obeyed at TACL.

 

Sample INFILE:

 

DELAY 2 SECONDS

FILEINFO

#PUSH VAR

#SET VAR "THIS IS AN INFILE"

#OUTPUTV VAR

WHO

TIME

FUP INFO *

VOLUME

 

The AT attribute of this job specifies that the job is to be executed EXACTLY at that time.

(you may not always be able to set the AT attribute of a job, due to restrictions placed on the scheduler

by your system administrator. Similarly, the RUNNOW command may too be restricted) 

 

 

Job Control Commands:

=====================

You can see the status of your submitted jobs using

 

STATUS <JOB-NAME> or

 

STATUS * (for status of all jobs)

 

command on the Batchcom prompt.

 

It is to be noted here that a job, if not a recursive job (i.e. not with EVERY attribute),

gets deleted after first (and only) execution.

 

You can delete a job using

 

DELETE <JOB-NAME> or

 

DELETE JOB * (for deleting all jobs)

 

command on the BATCHCOM prompt.

 

You can put the execution of a job in HOLD state using

 

ALTER <JOB-NAME>, HOLD ON

 

A job in HOLD state will not start execution unless its HOLD attribute is removed by

 

ALTER <JOB-NAME>, HOLD OFF

 

 

 

Winding Up:

===========

After you are done with the NetBatch scheduling and after all jobs scheduled by NetBatch have completed

execution and you no longer need the scheduler you can use the following Batchcom commands

 

SHUTDOWN

 

EXIT

 

The first command shuts down the scheduler and the second command ends the Batchcom session.

 

 

For more advanced topics, refer to the NetBatch Manuals in NTL/TIM.

 

---------------------------------------------------------------------------------

Privacy