Jpp  18.0.1-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
qlib.sh File Reference

Go to the source code of this file.

Functions

function put_queue ()
 
function puts_queue ()
 
function queue ()
 
 configure_job ()
 
 reset_job_config ()
 
 submit_job ()
 

Function Documentation

function put_queue ( )

Definition at line 19 of file qlib.sh.

20 {
21  queue_name=$1
22  shift
23 
24  echo -n "$*;" >> $queue_name
25 }
const int n
Definition: JPolint.hh:697
then echo
Definition: JQAQC.sh:90
function puts_queue ( )

Definition at line 34 of file qlib.sh.

35 {
36  queue_name=$1
37  shift
38 
39  echo "$*" >> $queue_name
40 }
then echo
Definition: JQAQC.sh:90
function queue ( )

Definition at line 50 of file qlib.sh.

51 {
52  queue_name=$1
53  queue_size=$2
54  sleep_time=$3
55 
56  if [[ -e $queue_name ]]; then
57 
58  if [[ -p $queue_name ]]; then
59  fatal "Queue $queue_name in use."
60  fi
61  else
62 
63  mkfifo $queue_name # create a new FIFO
64  fi
65 
66  fd=7 # file descriptor
67 
68  eval "exec $fd<>$queue_name" # attach file descriptor to FIFO
69 
70  while read job <& $fd; do # read job from file descriptor
71 
72  if [[ -n $job ]]; then
73 
74  if [[ $job = "exit" ]]; then
75  break
76  fi
77 
78  notice "submit $job"
79  eval exec $job & # submit job
80 
81  # wait for free slot
82 
83  while (( ${#jobstates} >= $queue_size )); do
84  sleep $sleep_time
85  done
86  fi
87  done
88 
89  rm -f $queue_name # remove FIFO
90 }
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
Definition: JDataQuality.sh:19
o $QUALITY_ROOT d $DEBUG!CHECK_EXIT_CODE JPlot1D f
Definition: JDataQuality.sh:76
const int n
Definition: JPolint.hh:697
then rm
Definition: sftpput.zsh:30
then JCalibrateToT a
Definition: JTuneHV.sh:116
Q FIFO
Definition: JDataQuality.sh:61
esac done
Definition: JAddHDE.sh:21
configure_job ( )

Definition at line 100 of file qlib.sh.

101 {
102  case $# in
103  2) local groupsize=$2;
104  local exec_filename=$1;;
105  *) fatal "configure_job(): Invalid number of arguments."
106  esac
107 
108  if [[ ! ${exec_filename} =~ '%' ]]; then
109  fatal "configure_job(): Missing wildcard character in ${exec_filename}."
110  fi
111 
112  if [[ -z $TASKID ]]; then # Initialize task ID
113  export TASKID=1
114  fi
115 
116  if [[ -z $GROUPID ]]; then # Initialize task group ID
117  export GROUPID=1
118  fi
119 
120  local integer SUBTASKID=$(( TASKID % groupsize ))
121 
122  if (( SUBTASKID == 1 || groupsize == 1 )); then # configure job start
123 
124  export EXEC_FILE=${exec_filename/\%/${GROUPID}}
125  export LOG_FILE=${EXEC_FILE:r}.log
126 
127  export START_JOB
128 
129  rm -f ${EXEC_FILE}
130 
131  elif (( SUBTASKID > 1 )); then
132  unset START_JOB
133  unset SUBMIT_JOB
134  fi
135 
136  if (( SUBTASKID == 0 )); then # configure job submission
137 
138  export SUBMIT_JOB
139  (( ++GROUPID ))
140  fi
141 
142  (( ++TASKID ))
143 }
o $QUALITY_ROOT d $DEBUG!CHECK_EXIT_CODE JPlot1D f
Definition: JDataQuality.sh:76
data_type r[M+1]
Definition: JPolint.hh:779
then rm
Definition: sftpput.zsh:30
skip elif((BINFRAC< 1.0))
void configure(const T &value, const JAbstractCollection< JAbscissa_t > &bounds, JBool< false > option)
Configuration of value.
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
Definition: JCanberra.sh:46
reset_job_config ( )

Definition at line 148 of file qlib.sh.

149 {
150  unset TASKID
151  unset GROUPID
152  unset START_JOB
153  unset SUMBIT_JOB
154 }
submit_job ( )

Definition at line 164 of file qlib.sh.

165 {
166  local scratchdir=${TMPDIR:-/tmp}
167 
168  case $# in
169  4) local dependencies=($4);&
170  3) scratchdir=$3;&
171  2) local queue_name=$2;&
172  1) local exec_file=$1;;
173  *) local exec_file=${argv[1]}
174  local queue_name=${argv[2]}
175  scratchdir=${argv[3]}
176  local dependencies=(${argv[4,-2]})
177  esac
178 
179  chmod +x ${exec_file}
180 
181  if (( ${+queue_name} )); then
182 
183  if ( is_CCNikhef ); then
184 
185  local depstr="depend=afterok$(printf ':%s' ${dependencies[@]})"
186 
187  set_array JOBIDS \
188  ${JOBIDS[@]} \
189  ${$(qsub \
190  -N ${exec_file:t:r}.${USER} \
191  ${dependencies:+-W ${depstr}} \
192  -q ${queue_name} \
193  -o ${scratchdir} \
194  -e ${scratchdir} \
195  -j oe \
196  ${exec_file})%%.*}
197  else
198 
199  if (( ${+dependencies} )); then
200 
201  local sleep_time=60
202 
203  for dep in ${dependencies[@]}; do
204 
205  cat > ${scratchdir}/await_${dep}.sh <<EOF
206 #!/bin/zsh
207 
208 while [[ -e /proc/${dep} ]]; do
209  sleep ${sleep_time}
210 done
211 
212 rm -f \$0
213 EOF
214  put_queue ${queue_name} ${scratchdir}/await_${dep}.sh
215  done
216  fi
217 
218  puts_queue ${queue_name} ${exec_file}.sh
219  fi
220 
221  else
222 
223  zsh ${exec_file}
224  fi
225 }
set_variable USER
Definition: test-tuna.sh:26
then JLigier sh continue fi cat
Definition: JDAQDriver.sh:51
o $QUALITY_ROOT d $DEBUG!CHECK_EXIT_CODE JPlot1D f
Definition: JDataQuality.sh:76
usr share Modules init zsh export TMPDIR
data_type r[M+1]
Definition: JPolint.hh:779
then fatal Wrong number of arguments fi JConvertDetectorFormat a o
function puts_queue()
Definition: qlib.sh:34
then rm
Definition: sftpput.zsh:30
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition: JMuonPostfit.sh:40
function put_queue()
Definition: qlib.sh:19
int j
Definition: JPolint.hh:703
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
Definition: JCanberra.sh:46
esac done
Definition: JAddHDE.sh:21