job

Package: WA2L/edrc 1.5.57
Section: General Commands (1)
Updated: 24 October 2024
Index Return to Main Contents

 

NAME

job - job sequencer

 

SYNOPSIS

edrc/bin/job [ -h | -V ]

job

job [ -i check_interval ] [ -q queue ]

job ( -l | -L ) [ -q queue ]

job -Q

job -r ( id | last )

job [ -f ] -s ( id | last )

job -p ( id | last )

job -a [ -q queue ]

job -c ( id | last )

 

AVAILABILITY

WA2L/edrc

 

DESCRIPTION

job sequencer.

This command can be used to serialize jobs on a UNIX system within the environment of the current user (in the user context of the user).

It has a similar user interface to the at command.

To define a new job, start job, then add the commands to be executed interactively in the job> prompt.

To end adding commands to a job, press [Ctrl] + [D] or enter a . (dot) as last command.

The advantages of this command are multiple queue support, execution of jobs in the current user environment and a logging facility.

Be aware, that the directories edrc/bin/ and edrc/lib/ are added to the $PATH environment variable and therefore all WA2L/edrc commands are also available for use in defined jobs without the need to alter the environment beforehand.

 

Background

The command was developed to optimize simulation calculations where only a number of licenses are available to simultaneously perform calculation runs.

The situation was, that a user needed to wait until the calculation of a coworker has been finished to start the own calculation.
This meant that the time during off-office hours were lost when a calculation ended after office hours.

Using the job sequencer the calculations could be en-queued and when one calculation finished, the following job started automatically. For each simultaneous calculation an own queue was used.
So the licenses could be used most efficiently and also night times were efficiently used to run calculations.

The job sequencer was developed in year 2000 as a stand alone utility and then later integrated into WA2L/edrc.

 

OPTIONS

-h
usage message.

-V
print program version.

-l
list all jobs in queue.

-L
list last jobs in queue.

-Q
list all queues.

-i interval
interval of check if previous job has completed.

-r id
remove job from queue.

-s id
stab job in run state.

-p id
print job properties.

-a
print job execution report for accounting purposes in CSV format.

To pretty-print the CSV output, use:

  job -a | csv list

To select a specific project (e.g. APOLLO), the 'csv where projectname' command could be used:

  job -a | csv where APOLLO | csv list

To show specific columns of the CSV output, the 'csv select columns' command could be used in addition:

  job -a | csv where APOLLO | csv select "TAG;DURATION_S" | csv list

-c id
print job commands including changing to the working directory from where the job was started.

This can be used to re-run a job using:

  job -c 10123 | job

last
resolves to the JOB-ID of the last job enqueued by the user.

-f
force stabbing of job in run state with running processes.

-q queue
queuename if not default.

 

ENVIRONMENT

$PATH
the directories edrc/bin/ and edrc/lib/ are added to the $PATH environment variable.

Therefore all WA2L/edrc commands are available for use in jobs.

 

EXIT STATUS

0
no error.

4
usage printed.

5
command aborted.

6
version printed.

11
cannot create temporary directory in /tmp/; this might be an indicator of system intrusion.

 

FILES

etc/job.cfg
configuration file for the job, jobwatch, and joblog commands.

lib/job/FUNCTION
functions that can be used in a job.

Currently available FUNCTIONs are:

JOBBANNER text
print a banner (that is not limited to 10 characters).

JOBTITLE text
print a title with ### prepended.

JOBSUBTITLE text
print a sub-title with === prepended.

JOBSUBSUBTITLE text
print a sub-sub-title with --- prepended.

JOBTAG tag
tag a job for accounting. A tag could be a specific project name to identify which job was executed for what project.

Allowed characters for a tag are: a-Z, 0-9, /, =, -, _, . and ,.

JOBCOMPLETED [ "command" ]
set the job completion criteria to command:

  :
  job>JOBCOMPLETED "/opt/mycalc/bin/checkflag"
  :

whereas the command needs to return 0 when the job is completed and a value different to 0 when the job is not jet completed.

If the command is not set, the commands to check job completion need to be provided thru stdin, as for example:

  :
  job>JOBCOMPLETED <<EOC
  job>    if [ -f /tmp/mycalc.flag ]; then
  job>        exit 0
  job>    else
  job>        exit 1
  job>    fi
  job>EOC
  :

The job completion critera needs to be set in cases where for instance the commands defined in the job run in the background. In this case the job command would report the done state too early.

The JOBCOMPLETED function should be set prior to the job workload commands.

/var/tmp/job/job.log
log file of job.

/var/tmp/job/
spool directory of job.

/var/tmp/job/.seq
job id counter.

~/.job.last
job id of the last job enqueued.

/var/tmp/job/<JOBID>/
spool directory of a job with the id <JOBID> consisting of the following state files:

cmd
commands to run in the job.

env
user environment (variables).

state
state of the job.

pid
process id of the job.

time.enqueue
time stamp when the job was created.

time.end
time stamp when the job has ended.

time.run
time stamp when commands in the job were started (when the job came into the run state).

exec
job execution file.

user
user that created the job.

cwd
current working directory from where the job command was issued.

compl
job completion criteria resolution.

log
output (stderr and stdout) of the commands in the job.

version
version of the job command at the time when the job was created.

queue
job queue.

tag
job tag.

 

EXAMPLES

-

 

SEE ALSO

edrcintro(1), csv(3), job.cfg(4), joblog(1), jobwatch(1)

 

NOTES

-

 

BUGS

-

 

AUTHOR

job was developed by Christian Walther. Send suggestions and bug reports to wa2l@users.sourceforge.net .

 

COPYRIGHT

Copyright © 2020 by Christian Walther

This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


 

Index

NAME
SYNOPSIS
AVAILABILITY
DESCRIPTION
Background
OPTIONS
ENVIRONMENT
EXIT STATUS
FILES
EXAMPLES
SEE ALSO
NOTES
BUGS
AUTHOR
COPYRIGHT

This document was created by man2html using the manual pages.
Time: 19:37:31 GMT, April 03, 2025