4 # \author mdejong, bjjung
6 #--------------------------------------------------------------------------------------
8 # Utility script for batch queue functions.
10 #--------------------------------------------------------------------------------------
14 # Put command(s) in given queue; do not submit job.
17 # \param 2-N command(s)
24 echo -
n "$*;" >> $queue_name
29 # Put command(s) in given queue and submit job.
32 # \param 2-N command(s)
39 echo "$*" >> $queue_name
48 # \param 3 sleep time [s]
56 if [[ -e $queue_name ]];
then
58 if [[ -p $queue_name ]];
then
59 fatal
"Queue $queue_name in use."
63 mkfifo $queue_name # create
a new FIFO
66 fd=7 #
file descriptor
68 eval
"exec $fd<>$queue_name" # attach
file descriptor to
FIFO
70 while read job <& $fd;
do #
read job from
file descriptor
72 if [[ -
n $job ]];
then
74 if [[ $job =
"exit" ]];
then
79 eval exec $job & # submit job
83 while (( ${#jobstates} >= $queue_size ));
do
93 # Function to configure jobs.\n
94 # Sets the environment variable EXEC_FILE, LOG_FILE as well as START_JOB and SUBMIT_JOB\n
95 # depending upon whether a new job should be set up or submitted.
97 # \param groupsize task group size
98 # \param exec_filename execution file name
103 2) local groupsize=$2;
104 local exec_filename=$1;;
105 *) fatal
"configure_job(): Invalid number of arguments."
108 if [[ ! ${exec_filename} =~
'%' ]];
then
109 fatal
"configure_job(): Missing wildcard character in ${exec_filename}."
112 if [[ -z $TASKID ]];
then # Initialize task
ID
116 if [[ -z $GROUPID ]];
then # Initialize task group
ID
120 local integer SUBTASKID=$(( TASKID % groupsize ))
122 if (( groupsize == 1 ));
then
124 export EXEC_FILE=${exec_filename/\%/${GROUPID}}
125 export LOG_FILE=${EXEC_FILE:
r}.log
134 export EXEC_FILE=${exec_filename/\%/${GROUPID}}
135 export LOG_FILE=${EXEC_FILE:
r}.log
162 # Function to reset job configuration variables.
175 # Function to submit a job.
177 # \param exec_file job script
178 # \param queue_name batch queue name
179 # \param scratchdir scratch directory
180 # \param dependencies dependency PIDs
184 local scratchdir=${
TMPDIR:-/tmp}
187 4) dependencies=($4);&
189 2) local queue_name=$2;&
190 1) local exec_file=$1;;
191 *) local exec_file=${argv[1]}
192 local queue_name=${argv[2]}
193 scratchdir=${argv[3]}
194 dependencies=(${argv[4,-1]})
197 chmod +
x ${exec_file}
199 if (( ${+queue_name} ));
then
201 if ( is_CCNikhef );
then
203 local depstr=
"depend=afterok$(printf ':%s' ${dependencies[@]})"
206 -
N ${exec_file:t:
r}.${
USER} -
V \
207 ${dependencies:+-W ${depstr}} \
215 if (( ${+dependencies} ));
then
219 local depstr=$(printf
'_%s' ${dependencies[@]})
221 set_variable wait_script ${scratchdir}/await${depstr}.sh
223 if [[ ! -
f ${wait_script} ]];
then
225 exec 9> ${wait_script}
231 for dep
in ${dependencies[@]};
do
235 while [[ -e /proc/${dep} ]];
do
243 N=\$(ps |
grep "${wait_script:t:r}" | wc -l)
245 if (( N == 1 ));
then
250 chmod
u+
x ${wait_script}
255 sed -
i "1a\\\n${wait_script}\n" ${exec_file}
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
then usage $script[< detector identifier >< run range >]< QA/QCfile > nExample script to produce data quality plots nWhen a detector identifier and run range are data are downloaded from the database nand subsequently stored in the given QA QC file
o $QUALITY_ROOT d $DEBUG!CHECK_EXIT_CODE JPlot1D f
usr share Modules init zsh export TMPDIR
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
then fatal Wrong number of arguments fi JConvertDetectorFormat a o
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
skip elif((BINFRAC< 1.0))
do grep(chi2\[.\]\|gradient\)" $INPUT_FILE > $WORKDIR/stage.txt awk 'BEGIN
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
then echo Submitting reweighting and histogram comparison jobs to nikhef stbc batch queue
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] 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