/usr/share/arc/submit-gridfactory-job is in nordugrid-arc-arex 1.1.1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | #!/bin/sh
echo "Environment variables:"
printenv |sort
#set -x
#
# Input: path to grami file (same as Globus).
#
echo "----- starting submit_gridfactory_job -----" 1>&2
joboption_lrms=gridfactory
# ARC1 passes first the config file.
if [ "$1" = "--config" ]; then shift; ARC_CONFIG=$1; shift; fi
basedir=`dirname $0`
basedir=`cd $basedir > /dev/null && pwd` || exit $?
pkgdatadir="$basedir"
. ${pkgdatadir}/submit_common.sh || exit $?
##############################################################
# Parse grami file, read arc config
##############################################################
arg_file=$1
init $arg_file
echo "joboption_user=`whoami`" >> $arg_file
##############################################################
# Zero stage of runtime environments
##############################################################
joboption_args=`basename "$joboption_arg_0"`
# File name to be used for temporary job script
LRMS_JOB_SCRIPT=`mktemp ${TMPDIR}/gridfactory_job_script.XXXXXX`
if [ -z "$LRMS_JOB_SCRIPT" ] ; then
echo "Creation of temporary file failed"
exit 1
fi
#chmod u+x ${LRMS_JOB_SCRIPT}
LRMS_JOB_SCRIPT_OUT="${LRMS_JOB_SCRIPT}.out"
touch $LRMS_JOB_SCRIPT_OUT
LRMS_JOB_SCRIPT_ERR="${LRMS_JOB_SCRIPT}.err"
touch $LRMS_JOB_SCRIPT_ERR
if [ ! -f "$LRMS_JOB_SCRIPT" ] || [ ! -f "$LRMS_JOB_SCRIPT_OUT" ] || [ ! -f "$LRMS_JOB_SCRIPT_ERR" ] ; then
echo "Something is wrong. Either somebody is playing bad or can't write to ${TMPDIR}"
exit 1
fi
##############################################################
# Create job script
##############################################################
echo "# GridFactory batch job script built by grid-manager" > $LRMS_JOB_SCRIPT
# Job name (Replace blanks with underscore and set max limit on length)
if [ ! -z "${joboption_jobname}" ] ; then
jobname=`echo "$joboption_jobname" | \
sed 's/[^[:alnum:]]/_/g' | \
sed 's/\(...............\).*/\1/'`
else
jobname=`basename "$joboption_arg_0"`
fi
echo "#GRIDFACTORY -n $jobname" >> $LRMS_JOB_SCRIPT
# Executable
if test -n "x$joboption_rsl_executable"; then
echo "#GRIDFACTORY -e $joboption_rsl_executable" >> $LRMS_JOB_SCRIPT
fi
# Input files (skip every other filename which is just a checksums)
skip=
inputfiles=
for file in $joboption_rsl_inputfiles; do
if test "x$skip" = "x"
then
###Needed to be fixed
###echo "#GRIDFACTORY -i $joboption_directory/$file" >> $LRMS_JOB_SCRIPT
inputfiles="$inputfiles -i $file"
skip=1
else
skip=
fi
done
# Output files (skip every other filename which is just a space or url)
skip=
tmp_str=`echo "$joboption_rsl_outputfiles"|tr ' ' ':'`
OIFS=$IFS
IFS=:
for file in $tmp_str; do
if test "x$skip" = "x"
then
if test "$file" != "$joboption_stdout" -a "$file" != "$joboption_stderr" -a "$file" != "$joboption_gmlog"
then
echo "#GRIDFACTORY -o $file" >> $LRMS_JOB_SCRIPT
fi
skip=1
else
skip=
fi
done
IFS=$OIFS
# Memory
[ -n "$joboption_memory" ] && echo "#GRIDFACTORY -m $joboption_memory" >> $LRMS_JOB_SCRIPT
# CPUtime
[ -n "$joboption_cputime" ] && echo "#GRIDFACTORY -t $joboption_cputime" >> $LRMS_JOB_SCRIPT
# Runtime environments
if test -n "$joboption_runtime_0"; then
for rte in "$joboption_runtime_0"; do
if echo $rte|grep ^VM/; then
echo "#GRIDFACTORY -y $rte" >> $LRMS_JOB_SCRIPT
else
echo "#GRIDFACTORY -r $rte" >> $LRMS_JOB_SCRIPT
fi
done
fi
##############################################################
# Check for existence of executable,
##############################################################
if [ -z "${joboption_arg_0}" ] ; then
echo 'Executable is not specified' 1>&2
exit 1
fi
# Executable
echo $joboption_args |grep -q ^/ || joboption_args="./$joboption_args"
echo "$joboption_args" >> $LRMS_JOB_SCRIPT
echo "exitcode=\$?" >> $LRMS_JOB_SCRIPT
echo "echo exitcode \$exitcode" >> $LRMS_JOB_SCRIPT
echo "exit \$exitcode" >> $LRMS_JOB_SCRIPT
#######################################
# Execute psub command
#######################################
GF_PSUB="$GF_BIN_PATH/psub.sh $inputfiles -b localhost"
cd "$joboption_directory"
echo $GF_PSUB $LRMS_JOB_SCRIPT 1>&2
echo "Job script:" 1>&2
echo "---------------------------------------------------------------------------"
cat $LRMS_JOB_SCRIPT 1>&2
echo "---------------------------------------------------------------------------"
GF_RESULT=1
GF_TRIES=0
while [ "$GF_TRIES" -lt '10' ] ; do
$GF_PSUB $LRMS_JOB_SCRIPT 1>$LRMS_JOB_SCRIPT_OUT 2>$LRMS_JOB_SCRIPT_ERR
GF_RESULT="$?"
if [ "$GF_RESULT" -eq '0' ] ; then
break
fi
GF_TRIES=$(( GF_TRIES + 1 ))
sleep 2
done
if [ $GF_RESULT -eq '0' ] ; then
job_id=`cat $LRMS_JOB_SCRIPT_OUT|grep file`
if [ "${job_id}" = "" ] ; then
echo "job *NOT* submitted successfully!" 1>&2
echo "failed getting the gridfactory jobid for the job!" 1>&2
echo "Submission: Local submission client behaved unexpectedly.">>"${joboption_controldir}/job.${joboption_gridid}.lrms_done"
else
echo "joboption_jobid=$job_id" >> $arg_file
echo "job submitted successfully!" 1>&2
echo "gridfactory jobid: $job_id" 1>&2
# Remove temporary job script file
rm -f $LRMS_JOB_SCRIPT $LRMS_JOB_SCRIPT_OUT $LRMS_JOB_SCRIPT_ERR
echo "----- exiting submit_gridfactory_job -----" 1>&2
echo "" 1>&2
exit 0
fi
else
echo "job *NOT* submitted successfully!" 1>&2
echo "got error code from psub: $GF_RESULT !" 1>&2
echo "Submission: Local submission client failed.">>"$failures_file"
fi
echo "Output is:" 1>&2
cat $LRMS_JOB_SCRIPT_OUT 1>&2
echo "Error output is:"
cat $LRMS_JOB_SCRIPT_ERR 1>&2
rm -f "$LRMS_JOB_SCRIPT" "$LRMS_JOB_SCRIPT_OUT" "$LRMS_JOB_SCRIPT_ERR"
echo "----- exiting submit_gridfactory_job -----" 1>&2
echo "" 1>&2
exit 1
|