This file is indexed.

/usr/share/arc/submit-boinc-job is in nordugrid-arc-arex 5.3.0~rc1-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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
#!/bin/bash
# set -x
#
#  Input: path to grami file (same as Globus).
#  This script creates a temporary job script and runs it

echo "----- starting submit_boinc_job -----" 1>&2
joboption_lrms=boinc

# 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
##############################################################
init $1
echo runtimedir=$CONFIG_runtimedir
echo sratch=$CONFIG_scratchdir
joboption_directory_orig=$joboption_directory
joboption_directory='`pwd`'
joboption_stdout='`pwd`/'`basename $joboption_stdout`
joboption_stderr='`pwd`/'`basename $joboption_stderr`
read_arc_conf

# make sure session is world-writable
chmod 777 $joboption_directory

RUNTIME_NODE_SEES_FRONTEND=yes

##############################################################
# Zero stage of runtime environments
##############################################################
RTE_stage0
echo "project_root=$PROJECT_ROOT"

##############################################################
# create job script
##############################################################
mktempscript
LRMS_JOB_BOINC="${LRMS_JOB_SCRIPT}.boinc"
touch $LRMS_JOB_BOINC
chmod u+x ${LRMS_JOB_SCRIPT}


##############################################################
# Start job script
##############################################################

N=0
x=$joboption_directory_orig
while [ "$x" != "/" ]
do
 x=`dirname $x`
N=$((N+1))
done

echo '#!/bin/sh' > $LRMS_JOB_SCRIPT

echo "#job script built by grid-manager and input file for BOINC job" >> $LRMS_JOB_SCRIPT
echo "" >> $LRMS_JOB_SCRIPT
cat >> $LRMS_JOB_SCRIPT <<"FMARK"
set -x 
export RUNTIME_CONFIG_DIR=`pwd`/
#tar zxvf RTE.tar.gz
cp ../shared/ATLAS.root ./
#rename root file
#unzip RTE file
FMARK
echo tar --strip-components=$N -xvf *input.tar.gz >> $LRMS_JOB_SCRIPT

##############################################################
# non-parallel jobs
##############################################################

set_count
sourcewithargs_jobscript

##############################################################
# Override umask
##############################################################
echo "" >> $LRMS_JOB_SCRIPT
echo "# Overide umask of execution node (sometime values are really strange)" >> $LRMS_JOB_SCRIPT
echo "umask 077" >> $LRMS_JOB_SCRIPT

##############################################################
# Add environment variables
##############################################################
add_user_env

##############################################################
# Check for existance of executable,
##############################################################
if [ -z "${joboption_arg_0}" ] ; then
  echo 'Executable is not specified' 1>&2
  exit 1
fi

#######################################################################
# copy information useful for transfering files to/from node directly
#######################################################################
if [ "$joboption_localtransfer" = 'yes' ] ; then
   setup_local_transfer
fi

setup_runtime_env

##############################################################
# Add std... to job arguments
##############################################################
include_std_streams

##############################################################
#  Move files to local working directory (job is done on node only)
#  RUNTIME_JOB_DIR -> RUNTIME_LOCAL_SCRATCH_DIR/job_id
##############################################################
move_files_to_node 

echo "" >> $LRMS_JOB_SCRIPT
echo "RESULT=0" >> $LRMS_JOB_SCRIPT
echo "" >> $LRMS_JOB_SCRIPT


#####################################################
#  Download input files
#####################################################
download_input_files

echo "" >> $LRMS_JOB_SCRIPT

echo "if [ \"\$RESULT\" = '0' ] ; then" >> $LRMS_JOB_SCRIPT

##############################################################
#  Runtime configuration
##############################################################
echo RUNTIME_JOB_DIAG='`pwd`/'`basename $joboption_directory_orig`.diag >>$LRMS_JOB_SCRIPT
RTE_stage1 
echo "echo \"runtimeenvironments=\$runtimeenvironments\" >> \"\$RUNTIME_JOB_DIAG\"" >> $LRMS_JOB_SCRIPT

#####################################################
#  Go to working dir and start job
#####################################################
cd_and_run
echo "fi" >> $LRMS_JOB_SCRIPT

## print nodename
cat >> $LRMS_JOB_SCRIPT <<"FMARK"
sed -i -e '/nodename=/d' $RUNTIME_JOB_DIAG
hostname=` grep domain_name init_data.xml |awk -F '>' '{print $2}'|awk -F "<" '{print $1}'|sed -e "s# #_#g"`
username=` grep user_name init_data.xml |awk -F '>' '{print $2}'|awk -F "<" '{print $1}'|sed -e "s# #_#g"`
nodename=$username@$hostname
echo "nodename=$nodename" >> "$RUNTIME_JOB_DIAG"

FMARK

#####################################################
#  Upload output files
#####################################################
upload_output_files
echo "" >> $LRMS_JOB_SCRIPT

##############################################################
#  Runtime (post)configuration at computing node
##############################################################
configure_runtime


##############################################################
#  Move files back to session directory (job is done on node only)
#  RUNTIME_JOB_DIR -> RUNTIME_LOCAL_SCRATCH_DIR/job_id
##############################################################
#move_files_to_frontend

echo 'echo exitcode=$RESULT >> $RUNTIME_JOB_DIAG'  >> $LRMS_JOB_SCRIPT
#############################################################
# zip the result files into 1 file zip.tar.gz
#############################################################
notnull ()
{
   if [ -z $1 ];then
	echo 0
   else
	echo 1
   fi
}
result_list=
i=0
eval opt=\${joboption_outputfile_$i}
ret=`notnull $opt`
while [ $ret = "1" ]
do
   output_file=$(echo $opt|sed -e "s#^/#./#")
   output_file=$(echo $output_file|sed -e "s#@##")
   result_list=$result_list" "$output_file
   i=$((i+1))
   eval opt=\${joboption_outputfile_$i}
   ret=`notnull $opt`
   echo $ret
done

files=$(echo $result_list|tr " " "\n")

cat >> $LRMS_JOB_SCRIPT <<'EOF'
echo "zip all output files"
flist="*.diag "
EOF
echo for f in $files >>$LRMS_JOB_SCRIPT

cat >> $LRMS_JOB_SCRIPT <<'EOF'
do
 if [  -e $f ];then
 flist=$flist" "$f
fi
done
EOF
#echo $flist
cat <<'EOF' >>$LRMS_JOB_SCRIPT
if [ -f output.list ];then
ol=$(awk '{print $1}' output.list)
for i in $ol
do
 if [ -f $i ];then
 flist=$flist" "$i
 fi
done
fi
EOF

echo 'tar czvf result.tar.gz $flist' >>$LRMS_JOB_SCRIPT
echo 

chmod g+r $LRMS_JOB_SCRIPT


#######################################
#  Submit the job
#######################################
## generate RTE file on the fly
joboption_num=0
rflist=$RUNTIME_CONFIG_DIR/APPS/HEP/ATLAS-SITE
eval "var_is_set=\${joboption_runtime_$joboption_num+yes}"
while [ ! -z "${var_is_set}" ] ; do
   eval "var_value=\${joboption_runtime_$joboption_num}"
   if [ -r "$RUNTIME_CONFIG_DIR/${var_value}" ] ; then
      rflist=$rflist" $RUNTIME_CONFIG_DIR/${var_value}"
   fi
   joboption_num=$(( $joboption_num + 1 ))
   eval "var_is_set=\${joboption_runtime_$joboption_num+yes}"
 done
 
RN=0
x=$RUNTIME_CONFIG_DIR
while [ "$x" != "/" ]
do
 x=`dirname $x`
 RN=$((RN+1))
done
sed -i -e "s/#unzip RTE file/tar --strip-components=$RN -zxvf RTE.tar.gz/g" $LRMS_JOB_SCRIPT

echo "job script ${LRMS_JOB_SCRIPT} built" 1>&2
JobId=`basename $joboption_directory_orig`
JobInput=$joboption_directory_orig/$JobId"_input.tar.gz"
wu=$JobId
RTE_FILE="rte_"$wu".tar.gz"
RTE_LOCATION="$joboption_directory_orig/RTE.tar.gz"

echo "#!/bin/bash" >> $LRMS_JOB_BOINC
tflist=""
Root_basename=""
RootFileOrig=""
for file in `ls $joboption_directory_orig`
  do
    [[ $file == *.root.* ]] && echo skip root file $file && RootFileOrig=$file && Root_basename=$JobId"_"$file && continue
    tflist=$tflist" "$joboption_directory_orig/$file
  done

RootFile=$joboption_directory_orig/$RootFileOrig
sed -i -e "s/#rename root file/mv ATLAS.root $RootFileOrig/g" $LRMS_JOB_SCRIPT
echo tar zhcvf $JobInput $tflist
echo "tar zhcvf $JobInput $tflist" >> $LRMS_JOB_BOINC
echo tar zhcvf $RTE_LOCATION $rflist
echo "tar zhcvf $RTE_LOCATION $rflist" >> $LRMS_JOB_BOINC

echo "cd $PROJECT_ROOT " >>$LRMS_JOB_BOINC

JobInput_basename=`basename $JobInput`
Script_basename=`basename $LRMS_JOB_SCRIPT` 


echo "ln $JobInput "'`bin/dir_hier_path '$(basename $JobInput)'`' >> $LRMS_JOB_BOINC
echo "chmod g+r "'`bin/dir_hier_path '$(basename $JobInput)'`' >> $LRMS_JOB_BOINC
echo "cp $LRMS_JOB_SCRIPT " '`bin/dir_hier_path' $(basename $LRMS_JOB_SCRIPT)'`' >>$LRMS_JOB_BOINC
echo "chmod g+r " '`bin/dir_hier_path' $(basename $LRMS_JOB_SCRIPT)'`' >>$LRMS_JOB_BOINC
echo "ln $RTE_LOCATION " '`bin/dir_hier_path' $RTE_FILE '`' >> $LRMS_JOB_BOINC
echo "chmod g+r " '`bin/dir_hier_path' $RTE_FILE '`' >> $LRMS_JOB_BOINC

[ -L $RootFile ] && RootFile=`ls -l $RootFile|awk '{print $11}'`
echo "ln  $RootFile "'`bin/dir_hier_path' $Root_basename '`' >> $LRMS_JOB_BOINC
echo "chmod g+r "'`bin/dir_hier_path ' $Root_basename '`' >> $LRMS_JOB_BOINC

if [ -z $joboption_memory ];then
memreq=2000000000
else
memreq=$((joboption_memory*1000000))
fi
if [ -z $joboption_cputime ];then
maxcputime=$((2*3600*3000000000))
else
maxcputime=$((joboption_cputime*3000000000))
fi

priority=
if [ -z $joboption_priority ]; then
  $priority="--priority $joboption_priority"
fi

echo "bin/create_work -appname $BOINC_APP -wu_name $wu  -wu_template $WU_TEMPLATE -result_template $RESULT_TEMPLATE  --rsc_memory_bound $memreq  --rsc_fpops_est $maxcputime $priority $(basename $JobInput) $Root_basename $RTE_FILE $(basename $LRMS_JOB_SCRIPT)" >> $LRMS_JOB_BOINC

echo 'ret=$?' >>$LRMS_JOB_BOINC
if [ $ret -eq 0 ];then
echo "successfully submitted workunit $wu"
fi
echo 'exit $ret' >>$LRMS_JOB_BOINC
sh $LRMS_JOB_BOINC
#cat $LRMS_JOB_BOINC
rc=$?

if [ $rc -eq 0 ];then
echo "job $wu submitted successfully!" 1>&2
echo "joboption_jobid=$wu" >> $arg_file
fi
echo "----- removing intermediate files ----"
rm -fr $LRMS_JOB_BOINC $LRMS_JOB_ERR $LRMS_JOB_OUT $LRMS_JOB_SCRIPT
#rm -fr $JobInput
echo "----- exiting submit_boinc_job -----" 1>&2
echo "" 1>&2
exit $rc