7 # ----------------------------------------------------------------------------------------
8 # Simple desktop batch queue processor.
10 # The batch queue is defined by a standard FIFO and
11 # the entries in the queue are processed line-by-line.
12 # Each entry is executed as a separate process in the background,
13 # commonly referred to as a job.
14 # The number of jobs that can simultaneously run is limited by the queue size.
15 # The batch queue can be terminated by submitting a job with contents "exit".
17 # The batch queue may also be an existing regular file.
18 # The entries in the queue are processed as normal but
19 # the batch queue will terminate when the end-of-file is reached.
21 # A job can be submitted using the puts_queue function (see qlib.sh or qlib.csh).
22 # A series of joint commands can be submitted using a sequence of
23 # calls to put_queue, terminated by a single puts_queue call.
24 # ----------------------------------------------------------------------------------------
26 if [ -z $JPP_DIR ];
then
27 echo "Variable JPP_DIR undefined."
31 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/
null
41 print -u2
"$script [queue name [queue size]] <option>"
42 print -u2
"Possible options: start, stop, continue, restart."
50 *) fatal
"Wrong number of options.";;
53 if ( is_CCLyon );
then
54 fatal
"This batch queue processor is intended for use on a desktop."
57 if (( $QUEUE_SIZE < 1 ));
then
58 fatal
"Invalid queue size $QUEUE_SIZE."
62 fatal
"Invalid option $OPTION."
65 if [[
$OPTION ==
"stop" || $OPTION ==
"restart" ]];
then
67 PID=(`get_pid $COMMAND`)
71 if [[ -
n $PID ]];
then
72 notice
"Stop $COMMAND."
80 elif [[ $OPTION ==
"continue" ]];
then
82 PID=(`get_pid $COMMAND`)
86 if [[ -
n $PID ]];
then
87 notice
"$script is running with PID(s) $PID"
94 if [[ $OPTION =
"start" ]];
then
96 notice
"Start batch queue ${QUEUE_NAME} >& ${QUEUE_NAME}_log"
98 trap
"" HUP # trap hangup
100 queue $QUEUE_NAME $QUEUE_SIZE $SLEEP_TIME >& ${QUEUE_NAME}_log &
102 while [[ ! -e $QUEUE_NAME ]];
do
then usage $script< detector >< run >< outputfile > fi case set_variable OPTION
then usage $script< detector identifier >< startdate\"YYYY-MM-DDHH:MM:SS\"><finaldate\"YYYY-MM-DDHH:MM:SS\"><QA/QCfile> fi case set_variable QAQC_TXT $argv[4]
o $QUALITY_ROOT d $DEBUG!CHECK_EXIT_CODE JPlot1D f
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR if do_usage *then usage $script[(input file)+] fi set_variable DEBUG set_variable WORKDIR TMPDIR
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
then fatal The output file must have the wildcard in the name
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
then echo Submitting reweighting and histogram comparison jobs to nikhef stbc batch queue
then elif[["$OPTION"=="count"]]
*fatal Wrong option $OPTION
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
#define DEBUG(A)
Message macros.