Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /job_submission_condor/scripts/submit.sh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #!/bin/bash
0002 set -Euo pipefail
0003 trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
0004 IFS=$'\n\t'
0005 
0006 # check arguments
0007 if [ $# -lt 2 ] ; then
0008   echo "Usage: "
0009   echo "  $0 <template> <type> <input> [n_chunk=10000] [n_chunks=1]"
0010   echo
0011   echo "A typical npsim run requires from 0.5 to 5 core-seconds per event,"
0012   echo "and uses under 3 GB of memory. The output ROOT file for"
0013   echo "10k events take up about 2 GB in disk space."
0014   exit
0015 fi
0016 
0017 # startup
0018 date
0019 
0020 # Parse arguments
0021 # - condor template
0022 TEMPLATE=${1}
0023 shift
0024 # - type of simulation
0025 TYPE=${1}
0026 shift
0027 # - input file
0028 INPUT=${1}
0029 shift
0030 # - number of events per task
0031 EVENTS_PER_TASK=${1:-10000}
0032 shift
0033 # - number of tasks
0034 NUMBER_OF_TASKS=${1:-1}
0035 
0036 # create command line
0037 EXECUTABLE="./scripts/run.sh"
0038 ARGUMENTS="${TYPE} ${INPUT} ${EVENTS_PER_TASK} \$(Process)"
0039 
0040 # construct environment file
0041 ENVIRONMENT=environment.sh
0042 sed "
0043   s|%S3_ACCESS_KEY%|${S3_ACCESS_KEY:-}|g;
0044   s|%S3_SECRET_KEY%|${S3_SECRET_KEY:-}|g;
0045   s|%S3RW_ACCESS_KEY%|${S3RW_ACCESS_KEY:-}|g;
0046   s|%S3RW_SECRET_KEY%|${S3RW_SECRET_KEY:-}|g;
0047   s|%PBEAM%|${PBEAM}|g;
0048 " templates/${TEMPLATE}.sh.in > ${ENVIRONMENT}
0049 
0050 # construct submission file
0051 SUBMIT_FILE=$(basename ${TEMPLATE}.submit)
0052 sed "
0053   s|%EXECUTABLE%|${EXECUTABLE}|g;
0054   s|%ARGUMENTS%|${ARGUMENTS}|g;
0055   s|%QUEUE%|${NUMBER_OF_TASKS}|g;
0056   s|%JUGGLER_TAG%|${JUGGLER_TAG:-nightly}|g;
0057   s|%ENVIRONMENT%|${ENVIRONMENT}|g;
0058 " templates/${TEMPLATE}.submit.in > ${SUBMIT_FILE}
0059 
0060 # submit job
0061 condor_submit ${SUBMIT_FILE}