2 #------------------------------------------------------------------
4 # Purpose: A general purpose larsoft batch submit script.
8 # submit_lar.sh [options]
12 # -c, --config <arg> - Configuration (fcl) file (required).
13 # -s, --source <arg> - Input file (full path).
14 # -S, --source-list <arg> - Input file list (full path, one per line).
15 # -o, --output <arg> - Output file name.
16 # -n, --nevts <arg> - Number of events to process.
17 # --nskip <arg> - Number of events to skip.
18 # --nfile <arg> - Number of files to process (use with option -S).
19 # --nfile_skip <arg> - Number of files to skip (use with option -S).
20 # --args <args...> - Arguments for lar command line (place at end).
24 # -r, --release <arg> - Release tag (default "development").
25 # -q, -b, --build <arg> - Release build qualifier (default "debug", or "prof").
26 # --localdir <arg> - Larsoft local test release directory (default none).
27 # --localtar <arg> - Tarball of local test release.
28 # --mrb - Use mrb-style environment initialization (see below).
29 # --srt - Use srt-style environment initialization (see below).
33 # -N, --numjobs - Number of jobs to submit (default 1).
34 # --opportunistic - Use opportunistic grid.
35 # --OS <arg> - Specify OS (comma-separated list with no spaces, e.g. SL5,SL6).
39 # --ubfcl <arg> - Ubfcl version (default none).
43 # -h, --help - Print help.
44 # --group <arg> - Group or experiment (default $GROUP).
45 # --workdir <arg> - Work directory (default current directory).
46 # --outdir <arg> - Output directory.
47 # --cluster <arg> - Job cluster.
48 # --process <arg> - Process within cluster.
49 # --procmap <arg> - Name of process map file (override $PROCESS).
50 # --init-script <arg> - User initialization script execute.
51 # --init-source <arg> - User initialization script to source (bash).
52 # --end-script <arg> - User end-of-job script to execute.
56 # MRB vs. SRT environment setup.
58 # Environmental setup inside the worker batch script is controlled by
59 # options --release (-r), --build (-b, -q), --localdir, and --localtar. These options are
60 # interpreted differently depending on whether one is using an MRB (--mrb)
61 # or SRT (--srt) environment. Options --srt and --mrb are mutually
62 # exclusive. If neither is specified, --mrb is the default.
64 # For SRT-style environment:
66 # a) Use option --release or -r to specify larsoft frozen release.
67 # b) Use option --build, -b, or -q to specify build type ("debug" or "prof")
68 # c) If you have a local test release, specify the (bluearc) location of
69 # the test release using --localdir, or use --localtar to specify the
70 # absolute or relative path of the local release tarball.
72 # For MRB-style environment:
74 # a) Use option --release or -r to specify uboonecode version. Note that
75 # larsoft is setup as a dependent product of uboonecode.
76 # b) Use option --build or -b to specify build full qualifiers (e.g.
77 # "debug:e4" or "e4:prof").
78 # c) Options --localdir and --localtar are used in a similar way as for
79 # SRT. Here, --localdir should point to, or your tarball should be
80 # made relative to, the mrb localProducts directory ($MRB_INSTALL).
81 # If your local test release includes uboonecode, then you do not
82 # need options --release or --build.
86 # 1. Each batch worker is uniquely identified by two numbers stored
87 # in environment variables $CLUSTER and $PROCESS (the latter is
88 # a small integer that starts from zero and varies for different
89 # jobs in a parallel job group). These environment variables are
90 # normally set by the batch system, but can be overridden by options
91 # --cluster and --process (e.g. to rerun failed jobs).
93 # It is not allowed to specify multiple jobs (-N option with >1 job)
94 # and to specify --process at the same time.
96 # 2. The work directory must be set to an existing directory owned
97 # by the submitter and readable by the batch worker. Files from the
98 # work directory are copied to the batch worker scratch directory at
99 # the start of the job.
101 # 3. The job configuration file (-c option), initialization and end-of-job
102 # scripts (optins --init-script, --init-source, --end-script) may
103 # be stored in the work directory specified by option --workdir, or they
104 # may be specified as absolute paths.
106 # 4. The output directory must exist and be writable by the batch
107 # worker (i.e. be group-writable for grid jobs). The worker
108 # makes a new subdirectory called ${CLUSTER}_${PROCESS} in the output
109 # directory and copies all files in the batch scratch directory there
110 # at the end of the job. If the output directory is not specified, the
111 # default is /grid/data/<group>/outstage/<user> (user is defined as
112 # owner of work directory).
114 # 5. The number of jobs option (-N or --numjobs) is used in two ways.
115 # It is passed to jobsub to generate the requested number of batch jobs,
116 # and it is passed to condor_lar.sh (as option --njobs) to control how
117 # condor_lar.sh delivers files and events to individual workers.
119 # Created: H. Greenlee, 29-Aug-2012
121 #------------------------------------------------------------------
154 while [ $# -gt 0 ];
do
159 awk
'/^# Usage:/,/^# End options/{print $0}' $0 | cut -c3- | head -
n -2
165 if [ $# -gt 1 ]; then
173 if [ $# -gt 1 ]; then
181 if [ $# -gt 1 ]; then
189 if [ $# -gt 1 ]; then
197 if [ $# -gt 1 ]; then
203 # Number of events to skip.
205 if [ $# -gt 1 ]; then
211 # Number of files to process.
213 if [ $# -gt 1 ]; then
219 # Number of files to skip.
221 if [ $# -gt 1 ]; then
227 # General arguments for lar command line.
229 if [ $# -gt 1 ]; then
238 if [ $# -gt 1 ]; then
244 # Release build qualifier.
246 if [ $# -gt 1 ]; then
252 # Local test release directory.
254 if [ $# -gt 1 ]; then
260 # Local test release tarball.
262 if [ $# -gt 1 ]; then
280 if [ $# -gt 1 ]; then
286 # Number of batch jobs.
288 if [ $# -gt 1 ]; then
294 # Opportunistic grid flag.
301 if [ $# -gt 1 ]; then
309 if [ $# -gt 1 ]; then
317 if [ $# -gt 1 ]; then
325 if [ $# -gt 1 ]; then
333 if [ $# -gt 1 ]; then
339 # Process within cluster.
341 if [ $# -gt 1 ]; then
349 if [ $# -gt 1 ]; then
355 # User initialization script.
357 if [ $# -gt 1 ]; then
363 # User source initialization script.
365 if [ $# -gt 1 ]; then
371 # User end-of-job script.
373 if [ $# -gt 1 ]; then
381 echo
"Unknown option $1"
387 # Do
MRB/
SRT checks,
and set some environment-specific defaults.
392 if [ $MRB -eq 0 -
a $SRT -eq 0 ]; then
398 if [ $MRB -ne 0 -
a $SRT -ne 0 ]; then
399 echo
"Both --mrb and --srt were specified."
405 if [ $MRB -ne 0 ]; then
406 if [
x$QUAL =
x ]; then
413 if [ $SRT -ne 0 ]; then
414 if [
x$REL =
x ]; then
417 if [
x$QUAL =
x ]; then
423 #echo
"INFILE=$INFILE"
424 #echo
"INLIST=$INLIST"
425 #echo
"OUTFILE=$OUTFILE"
429 #echo
"NFILE_SKIP=$NFILE_SKIP"
433 #echo
"LOCALDIR=$LOCALDIR"
434 #echo
"LOCALTAR=$LOCALTAR"
438 #echo
"NUMJOBS=$NUMJOBS"
439 #echo
"OPPORTUNISTIC=$OPPORTUNISTIC"
441 #echo
"WORKDIR=$WORKDIR"
442 #echo
"OUTDIR=$OUTDIR"
445 #echo
"PROCMAP=$PROCMAP"
446 #echo
"INITSCRIPT=$INITSCRIPT"
447 #echo
"INITSOURCE=$INITSOURCE"
448 #echo
"ENDSCRIPT=$ENDSCRIPT"
450 # Done with arguments.
454 if [
x$GROUP =
x ]; then
455 echo
"Group not specified."
458 if [
x$OUTDIR =
x ]; then
459 echo
"Output directory not specified."
462 if [
x$WORKDIR =
x ]; then
463 echo
"Work directory not specified."
466 if [
x$FCL =
x ]; then
467 echo
"Configuration file not specified."
474 if [
x$GRP !=
x ]; then
477 if [ $NUMJOBS -gt 1 ]; then
481 if [ $OPPORTUNISTIC -ne 0 ]; then
484 if [
x$OS !=
x ]; then
488 # Construct condor_lar.sh
options.
491 if [
x$FCL !=
x ]; then
494 if [
x$INFILE !=
x ]; then
497 if [
x$INLIST !=
x ]; then
500 if [
x$OUTFILE !=
x ]; then
503 if [ $NEVT -gt 0 ]; then
506 if [ $NSKIP -gt 0 ]; then
509 if [ $NFILE -gt 0 ]; then
512 if [ $NFILE_SKIP -gt 0 ]; then
513 BATCH_OPTS=
"$BATCH_OPTS --nfile_skip $NFILE_SKIP"
515 if [ $NUMJOBS -gt 1 ]; then
518 if [
x$REL !=
x ]; then
521 if [
x$QUAL !=
x ]; then
524 if [
x$LOCALDIR !=
x ]; then
527 if [
x$LOCALTAR !=
x ]; then
530 if [ $MRB -ne 0 ]; then
533 if [ $SRT -ne 0 ]; then
536 if [
x$UBFCL !=
x ]; then
539 if [
x$GRP !=
x ]; then
542 if [
x$WORKDIR !=
x ]; then
545 if [
x$OUTDIR !=
x ]; then
548 if [
x$CLUS !=
x ]; then
551 if [
x$PROC !=
x ]; then
554 if [
x$PROCMAP !=
x ]; then
557 if [
x$INITSCRIPT !=
x ]; then
558 BATCH_OPTS=
"$BATCH_OPTS --init-script $INITSCRIPT"
560 if [
x$INITSOURCE !=
x ]; then
561 BATCH_OPTS=
"$BATCH_OPTS --init-source $INITSOURCE"
563 if [
x$ENDSCRIPT !=
x ]; then
564 BATCH_OPTS=
"$BATCH_OPTS --end-script $ENDSCRIPT"
567 if [ -
n "$ARGS" ]; then
573 cp `which condor_lar.sh` $WORKDIR
578 CMD=
"jobsub $JOBSUB_OPTS condor_lar.sh $BATCH_OPTS"
opportunistic OPPORTUNISTIC
see a below echo S(symbol in a section other than those above)
process_name opflash particleana ie x
esac done echo Signal files are
then echo Configuration file not specified exit fi JOBSUB_OPTS
then echo Sam station was not specified(use option--sam_station)." exit 1 fi if [ x$SAM_GROUP
constexpr BitMask< Storage > Set(Flag_t< Storage > flag)
Returns a bit mask which sets the specified flag.
auto end(FixedBins< T, C > const &) noexcept
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)
then echo Cowardly refusing to create a new FHiCL file with the same name as the original one('${SourceName}')." >&2 exit 1 fi echo "'$
then echo Work directory not specified exit fi echo Work directory
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
then echo File list $list not found else cat $list while read file do echo $file sed s
BEGIN_PROLOG sequence::SlidingWindowTriggerPatternsOppositeWindows END_PROLOG simSlidingORM6O6 effSlidingORW output
process_name largeant stream1 can override from command line with o or output physics producers generator N
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker options