gen_rte_list () { local rte_idx=0 local rte_name_var="RUNTIME_VALUE_${rte_idx}" rte_xrsl="" while [ -n "${!rte_name_var}" ]; do rte_cond_var="RUNTIME_CONDITION_${rte_idx}" if [ -n "${!rte_cond_var}" ]; then rte_xrsl="${rte_xrsl}(runTimeEnvironment${!rte_cond_var}\"${!rte_name_var}\")" else rte_xrsl="${rte_xrsl}(runTimeEnvironment=\"${!rte_name_var}\")" fi rte_idx=$(( rte_idx + 1 )) rte_name_var="RUNTIME_VALUE_${rte_idx}" done echo $rte_xrsl } gen_values_list () { local f1_base=$1 local f2_base=$2 f_xrsl="" f_idx=0 f_var="${f1_base}${f_idx}" while [ -n "${!f_var}" ]; do f_location_var="${f2_base}${f_idx}" f_xrsl="${f_xrsl}(\"${!f_var}\" \"${!f_location_var}\")" f_idx=$((f_idx+1)) f_var="${f1_base}${f_idx}" done echo $f_xrsl } get_jobdescription_type () { echo "xrsl" } gen_job_description () { local xrsl_f=$1 # CPUS overrides NODES/PPN way if [ -n "$CPUS" ]; then NODES=1 PPN=$CPUS else [ -z "${NODES}" ] && NODES=1 [ -z "${PPN}" ] && PPN=1 fi NPRC=$((NODES*PPN)) next_idx_var ENVIRONMENT_NAME_ ENVIRONMENT_VALUE_ RUNTIME_PBS_NODES "$NODES" next_idx_var ENVIRONMENT_NAME_ ENVIRONMENT_VALUE_ RUNTIME_PBS_PPN "$PPN" INPUTFILES=$( gen_values_list "INPUT_FILES_NAME_" "INPUT_FILES_LOCATION_" ) OUTPUTFILES=$( gen_values_list "OUTPUT_FILES_NAME_" "OUTPUT_FILES_LOCATION_" ) ENVIRONMENT=$( gen_values_list "ENVIRONMENT_NAME_" "ENVIRONMENT_VALUE_" ) RTES=$( gen_rte_list ) [ -n "$WALLTIME" ] && _WALLTIME="(wallTime=\"${WALLTIME}\")" [ -n "$CPUTIME" ] && _CPUTIME="(cpuTime=\"${CPUTIME}\")" [ -n "$NPRC" ] && _NPRC="(count=\"${NPRC}\")" [ -n "$PPN" ] && _PPN="(countpernode=\"${PPN}\")" [ -n "$DISK" ] && _DISK="(disk=\"${DISK}\")" [ -n "$MEMORY" ] && _MEMORY="(memory=\"${MEMORY}\")" [ -n "$MAILTO" ] && _NOTIFY="(notify=\"${MAILFLAGS} ${MAILTO}\")" cat < $xrsl_f & (executable="${EXECUTABLE}") ${INPUTFILES:+(inputFiles=${INPUTFILES})} ${OUTPUTFILES:+(outputFiles=${OUTPUTFILES})} ${ENVIRONMENT:+(environment=${ENVIRONMENT})} ${RTES} (stdout="${STDOUT:-stdout.log}") (stderr="${STDERR:-stderr.log}") (jobname="${JOBNAME}") ${_WALLTIME} ${_CPUTIME} ${_NPRC} ${_PPN} ${_DISK} ${_MEMORY} ${_NOTIFY} END } jobdescription_gen_params () { cat <