starts multiple commands (possibly on multiple hosts or on a
labschedule [<option>] ... <executable> [<arguments>]
- -f, --for=<WORDLIST>
- loop through all words from <WORDLIST>;
in the command line the corresponding loop variable (%1, %2, ...)
will be replaced by words from <WORDLIST>.
(See the 'for-loop' section below for details.)
- only the first <N> loops will form individual
'labrun' calls; the remaining loops will incorporated into
labschedule --direct ... <executable> ...)
- define macro (%LABEL will be expanded to WORDLIST)
- execute on hosts <HOSTLIST> (default: localhost)
- maximum tasks started on one host (default: 1)
- condition to test to determine if host can accept another task
(typically for multi-user hosts; see the 'check'
- -n, --name=<TAG>
- <TAG> for log files (default:
- -l, --log=<DIR>
- <DIR> for log files (default:
- -i, --ignore
- ignore error codes from failed experiments, continuing with the rest
of the loop (default: abort)
- keep old (incomplete, failed) log files (default: delete them)
- don't skip previously performed runs (default: skip)
- prefix for each command (default:
ssh %host; cd %curdir)
- don't use 'labrun
as command executed
- additional labrun option;
use multiple --labrunflag options for multiple labrun options
- -d, --direct
- execute loops directly (see 'direct' section below)
- -b, --batch
- run in background
- -p, --print
- do not perform the commands, just print them
- -v, --verbose
- verbose mode
- do not read
@ FILE (some) command-line options are read
FILE (see section ).
For every combination of the words in each of the
--for commands, an
experiment is started. In addition to the log and output files
produced by labrun, labschedule keeps track of its own actions in
three files: a .log file that logs all relevant actions, a
.out file that holds the output of all successful runs, and a
.err file that holds the output of all failed runs.
- Defining For-Loops:
- The word lists for the for-loops can be defined in several ways.
The following expressions are possible:
Each of the three statements may be followed by a
- will be replaced by shell variable <ENVVAR>,
- will be replaced by file <FILE>,
- will be replaced by output of
If the regular expression
only the match corresponding to the parentheses will be
Otherwise the first word after the regular expression
will be taken.
<PATTERN> may not contain spaces. Use
\s instead. Some documentation for regular
expressions is given in Section .
Furthermore, the characters
? in words will
be interpreted as a shell would.
eval(EXPRESSION) will be replaced by the evaluation of the python
EXPRESSION, range(X) is a shortcut for
eval(range(X)) and will be replaced by the words
. The functions of the python
modules ``random'' and ``math'' can be used.
- Expansion of Variables:
- Some variables are expanded before executing a command. These can be used
in --check, --labrunflag, --prefix, --for, and in the arguments to the experiment.
More variables can be defined by the --macro=LABEL=WORDLIST option.
Valid LABELs are alphanumeric and begin with a letter. Two predefined
- the current directory
- full path to the log directory
- the host for the current experiment
ssh %host cd %curdir; or an empty string
- the name, provided by --name (default: schedule)
- number of tasks per host, provided by --maxtasks
- nesting level, provided by --nesting
- %1, %2, ...
- will be replaced by the current word from the
first, second, and so on --for word list.
Here one can use modifiers similar to those of tcsh,
(e.g., %1:h). Example (if %1 gives
||(regular expression substitution /from/to/,
any character may be delimiter)
%idle=`%prefix vmstat 1 2`:(?s).*\D(\d+)
reads the host's idle percentage (useful for --check)
((?s) makes .* match also newlines,
(\d+) returns the last number printed by
- %check=%idle > 5
(useful for --check=%check on multi-user systems, see below)
- Checking Idle Time:
By default, every host gets assigned %maxtasks tasks.
On multiuser systems it may be advisable to
check if the host can accept a further task.
This can be done with the --check switch:
- expression to check, if host can accept another task.
The results of commands, contents of files, and values
of environment variables can be incorporated into
EXP in the same way they can for for loop values.
(See two sections above).
- --check=`ssh %host w`:load.average < %maxtasks
reads the load of the host using the w command.
--check=`ssh %host vmstat 1 2`:[^@]*([0-9]+) > 5
--check=`%prefix vmstat 1 2`:[^@]*([0-9]+) > 5
--check=%idle > 5
reads the idle percentage of the host using the
vmstat command (all variants resolve to the same
- Using the --direct switch:
- The --direct switch is used internally for performing multiple runs
of a program as one experiment when --nesting is
used. If both --direct, and --nesting=<LEVEL>
are given, labschedule assumes that <LEVEL> loops have
already be processed (i.e., the first --for of the command
line will be treated as <LEVEL>+1). The main benefit from
using --nesting is that output of multiple commands is
put in one log and output file.
Nevertheless, the switch is useful for completely different things:
labschedule --direct --for=*.ps ps2pdf %1 %1:r.pdf
call ps2pdf on all *.ps files of the current
labschedule -d -f*.jpg sh -c 'djpeg %1|pnmscale 0.5|cjpeg>sml/%1'
make small jpgs in a different directory (we have to add
sh -c because we want the special characters |
and > (see Section ) to be
interpreted by shell)
labschedule --direct --for='hert polzin kettner schaefer' finger %1
finger the explab developers