#!/usr/bin/env bash #----------------------------------------------------------------------- # example: # # submit_prod_concat -b cdfpewk -d tewk0e -s 1:29 \ # -i cdfopr@fcdflnx3.fnal.gov:/cdf/opr2/cdfopr/mcProduction/tewk0e/2004_06_04.18_33_26 \ # -o cdfmc@fcdfdata031:/cdf/scratch/cdfmc/from_toronto/532pre1_manyruns_val/concatenated \ # -c cafcondor # # note: "-i" and "-o" parameters should be qualified with user@host, # host has to be qualified with the domain name # # defaults: # -------- # -b [ book ] : "cdfpewk" # -c [ farm ] : "local" (means local node) # -o [ output_dir ] : fcdfsgi2:/cdf/data36a/ewk/datasets/cdfpewk/$DATASET ) # -r (remote_tcl_dir: fcdflnx3:/cdf/opr2/cdfopr/datasets/cdfpewk/$DATASET/requests #------------------------------------------------------------------------------ BOOK=cdfpewk dataset=0 job_sections=0 caf="local" remote_tcl_dir="" output_dir= nevents=0 release=`cat .base_release` tarball=$CDF_TARBALL_DIR/stnmaker_${release}.tgz exefile=bin/$BFARCH/stnmaker.exe export OPTIND=1 while getopts :b:c:d:n:o:i:r:s:t:vw:x: OPT; do case $OPT in b) # input dataset name export BOOK=$OPTARG if [ .$DEBUG_SCRIPT != "." ] ; then echo BOOK=$OPTARG ; fi ;; c) # mode: caf/not caf caf=$OPTARG if [ .$DEBUG_SCRIPT != "." ] ; then echo caf=$OPTARG ; fi ;; d) # input dataset name export dataset=$OPTARG if [ .$DEBUG_SCRIPT != "." ] ; then echo dataset=$OPTARG ; fi ;; n) # mode: caf/not caf nevents=$OPTARG ;; o) # output dir output_dir=$OPTARG ;; i) # input_tcl_file, assume lnx3 input_tcl_file=$OPTARG if [ .$DEBUG_SCRIPT != "." ] ; then echo input_tcl_file=$OPTARG ; fi ;; s) # sections job_sections=$OPTARG if [ .$DEBUG_SCRIPT != "." ] ; then echo job_sections=$OPTARG ; fi ;; t) # tarball tarball=$OPTARG if [ .$DEBUG_SCRIPT != "." ] ; then echo tarball=$OPTARG ; fi ;; *) echo OTHER: $OPT $OPTARG usage ;; esac done if [ .$output_dir == "." ] ; then ruser=cdfopr rhost=fcdfsgi2.fnal.gov rdir=/cdf/data36/ewk/datasets/$BOOK/$dataset else . cdfopr/scripts/parse_output_dir $output_dir export ruser=$OP1 export rhost=$OP2 export rdir=$OP3 fi output_node=${ruser}@${rhost} output_dir=$rdir . cdfopr/scripts/parse_job_sections $job_sections job1=$OP1 job2=$OP2 #----------------------------------------------------------------------- # input tcl files - on FCDFLNX3 # remote tcl dir so far assumed to be on FCDFLNX3 #----------------------------------------------------------------------- parameters="-e $exefile -j stnmaker.concat" parameters=${parameters}" -d $dataset " parameters=${parameters}" -i $input_tcl_file" parameters=${parameters}" -o ${output_node}:$output_dir" if [ $nevents != 0 ] ; then parameters=${parameters}" -n $nevents" ; fi echo caf=$caf echo parameters=$parameters if [ $caf == "local" ] ; then #----------------------------------------------------------------------- # local job #----------------------------------------------------------------------- ./cdfopr/scripts/run.sh -v -J $job1 $parameters else #----------------------------------------------------------------------- # remote job #----------------------------------------------------------------------- source ~cdfsoft/cdf2.shrc setup cdfsoft2 development if [ $caf == "cafcondor" ] ; then queue=short ; else queue=cdfopr ; fi parameters="-v -J $ "${parameters} output_tarball=${output_node}:$output_dir/concat_$dataset.$.tgz CafSubmit --tarFile=$tarball \ --outLocation=$output_tarball \ --farm=$caf \ --dhaccess=MCGen \ --procType=short \ --email=${user}@fnal.gov \ --start=$job1 --end=$job2 \ "./cdfopr/scripts/run.sh $parameters -x CAF=$caf" $ fi