stage_data () { local local_file=$1 local stage_path=$2 echo "Uploading ${local_file}: " arccp -i "${local_file}" "${stage_path}/${local_file}" [ $? -ne 0 ] && exit_error "Cannot stage-in job data to ${stage_path}. Job submission aborted." } stage_in_files () { local name_base=INPUT_FILES_NAME_ local location_base=INPUT_FILES_LOCATION_ f_idx=0 f_var="${name_base}${f_idx}" # Rely on MDS_UUID received from portal # Generate own UUID if not defined if [ -n "${MDS_UUID}" ]; then STAGEIN_PATH="${MDS_JOBS_STAGING_PATH%/}/${MDS_UUID}" else local mds_local_uuid=$( ( date +'%s'; id -u; hostname ) | md5sum | cut -d' ' -f 1 ) STAGEIN_PATH="${MDS_JOBS_STAGING_PATH%/}/${mds_local_uuid}" fi # stage-out results to the same job dir unless path defined before export STAGEOUT_URL=${STAGEOUT_URL:-$STAGEIN_PATH} echo_g "Transfering job input data to $STAGEIN_PATH" executable_in_ifl=0 while [ -n "${!f_var}" ]; do [ "${!f_var}" = "${EXECUTABLE}" ] && executable_in_ifl=1 f_location_var="${location_base}${f_idx}" if [ -z "${!f_location_var}" ]; then stage_data "${!f_var}" "${STAGEIN_PATH}" eval ${f_location_var}="${STAGEIN_PATH}/${!f_var}" fi f_idx=$((f_idx+1)) f_var="${name_base}${f_idx}" done # Handle EXECUTABLE transfer to storage (in case not already in input file list) if [ $executable_in_ifl -eq 0 -a -z "$NOT_STAGE_EXEC" ]; then stage_data "${EXECUTABLE}" "${STAGEIN_PATH}" eval ${name_base}${f_idx}="${EXECUTABLE}" eval ${location_base}${f_idx}="${STAGEIN_PATH}/${EXECUTABLE}" fi }