#! /bin/sh # # Copyright 1999-2006 University of Chicago # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # globus-job-run and globus-job-submit (same code base) # prefix="${GLOBUS_LOCATION-/cvmfs/dirac.egi.eu/dirac/v8.0.38/Linux-x86_64}" exec_prefix="${prefix}" sbindir="${exec_prefix}/sbin" bindir="${exec_prefix}/bin" includedir="/cvmfs/dirac.egi.eu/dirac/v8.0.38/Linux-x86_64/include/globus" datarootdir="${prefix}/share" datadir="${datarootdir}" libexecdir="/cvmfs/dirac.egi.eu/dirac/v8.0.38/Linux-x86_64/share/globus" sysconfdir="${prefix}/etc" sharedstatedir="${prefix}/com" localstatedir="${prefix}/var" PATH="${bindir}:${sbindir}:${libexecdir}:${PATH}" PROGRAM_NAME="${0##*/}" PROGRAM_VERSION='12.1' PACKAGE='globus_gram_client_tools' VERSION='12.1' DIRT_TIMESTAMP='1629915172' DIRT_BRANCH_ID='0' case "$PROGRAM_NAME" in *-run) short_usage="$PROGRAM_NAME [-np N] [...]" std_file_statement="default to stdout/stdout of $PROGRAM_NAME." ;; *-submit) short_usage="$PROGRAM_NAME [-help] [-np N] [...]" std_file_statement="is retrieved later using globus-job-get-output." ;; esac long_usage () { cat >&2 < 0 > /dev/null 2>&1 ; then result="$2" else globus_args_option_error "$1" "\"$2\" is not an integer" fi } get_real_pwd () { file="$1" # # Try to figure out PWD (the real PWD, not an automounted PWD or an # incorrect env.var...) # This code is at large based on code from the MPICH mpirun command, # where they try to solve the same problem. # PWDtest="`pwd | sed 's@/tmp_mnt/@/@g'`" if [ ! -d "$PWDtest" ] ; then PWDtest="`pwd`" fi if [ -n "$PWD" ] ; then PWDtest2=`echo $PWD | sed 's@/tmp_mnt/@/@g'` if [ ! -r "${PWDtest2}/file" ]; then PWD=$PWDtest2 else PWD=$PWDtest fi else PWD=$PWDtest fi echo "$PWD/$file" } normalize_filename() { case "$1" in /* ) file="$1" ;; * ) file=`get_real_pwd "$1"` ;; esac # collapse all sequences of '/'s to a single '/' # file=`echo $file | sed -e 's://*:/:g'` # collapse all instances of "/./" to a single '/' # note we must loop for all series forms "/././" because # the patterns overlap and only half match in each iteration # while echo $file | grep '/\./' > /dev/null 2>&1 do # this goes faster when we inline a couple iterations # into one sed command file=`echo $file | sed -e 's:/\./:/:g' \ -e 's:/\./:/:g'` done # reduce all '/../' expressions # root is its own parent # foo/bar/../ is foo iff bar!=.. while echo $file | fgrep '/\.\./' > /dev/null 2>&1 do file=`echo $file | sed -e 's:^/\.\./:/:g' \ -e 's:/[^./][^/]*/\.\./:/:g' \ -e 's:/\.[^./][^/]*/\.\./:/:g' \ -e 's:/\.\.[^/][^/]*/\.\./:/:g'` done # remove trailing '/.' or '/' # file=`echo $file | sed -e 's:/$::g' \ -e 's:\(/\.\)*$::g'` echo $file } read_argument_file() { cat $1 | ( arglist= while read inp ; do arglist="${arglist} ${inp}" done echo "${arglist}" ) } emit_subjob_rsl () { # # extra RSL should take precedence: therefore, it needs to come first # if [ ${job_is_multi} = "true" ]; then echo "( &${subjob_extra_rsl}(resourceManagerContact=\"${job_contact}\")" echo " (subjobStartType=strict-barrier)" echo " (label=\"subjob ${job_hostclause_count}\")" echo " (executable=$executable)" else if [ -n "${subjob_extra_rsl}" ] ; then echo " &${subjob_extra_rsl}" echo " (executable=$executable)" else echo " &(executable=$executable)" fi fi if [ ! "X$project" = "X" ] ; then echo " (project=$project)" fi if [ ! "X$queue" = "X" ] ; then echo " (queue=$queue)" fi if [ ! "X$maxtime" = "X" ] ; then echo " (maxtime=$maxtime)" fi if [ ! "X$directory" = "X" ] ; then echo " (directory=$directory)" fi if [ ! "X$job_environment" = "X" ] || \ [ ! "X$subjob_environment" = "X" ] ; then echo " (environment=${job_environment}${subjob_environment})" fi if [ ! "X$count" = "X" ] ; then echo " (count=$count)" fi if [ ! "X$host_count" = "X" ] ; then echo " (host_count=$host_count)" fi if [ ! "X$subjob_args" = "X" ] ; then echo " (arguments=$subjob_args)" elif [ ! "X$arguments" = "X" ] ; then echo " (arguments=$arguments)" fi if [ ! "X$subjob_stdin" = "X" ] ; then echo " (stdin=$subjob_stdin)" elif [ ! "X$job_stdin" = "X" ] ; then echo " (stdin=$job_stdin)" fi if [ ! "X$subjob_stdout" = "X" ] ; then echo " (stdout=$subjob_stdout)" elif [ ! "X$job_stdout" = "X" ] ; then echo " (stdout=$job_stdout)" fi if [ ! "X$subjob_stderr" = "X" ] ; then echo " (stderr=$subjob_stderr)" elif [ ! "X$job_stderr" = "X" ] ; then echo " (stderr=$job_stderr)" fi if [ ${job_is_multi} = "true" ]; then echo ")" fi } parse_fileopt () { # # given input: