-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
123 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,8 @@ __init__.py | |
*.zip | ||
*.eps | ||
*.tar.gz | ||
|
||
# text files | ||
*.stdout | ||
*.stderr | ||
*.condor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ checkVomsTar.sh | |
step1.sh | ||
jobExecCondor.sh | ||
jobExecCondor.jdl | ||
|
||
jobExecCondorChain.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Signature: 8a477f597d28d172789f06886806bc55\n# This file is a cache directory tag.\n# For information about cache directory tags, see:\n# http://www.brynosaurus.com/cachedir/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,101 @@ | ||
#!/bin/bash | ||
|
||
echo "This is a test job. It will print the current directory, contents, and environment." | ||
echo "Starting job on "`date` # to display the start date | ||
echo "Running on "`uname -a` # to display the machine where the job is running | ||
echo "System release "`cat /etc/redhat-release` # and the system release | ||
echo "" | ||
echo "Current directory:" | ||
echo $PWD | ||
echo "" | ||
echo "Current directory listing:" | ||
ls -ltha | ||
echo "" | ||
echo "Current environment:" | ||
printenv | ||
|
||
export JOBNAME="" | ||
export PART="" | ||
export INDIR="" | ||
export OUTDIR="" | ||
export INDPRE="" | ||
export OUTPRE="" | ||
export FAIL=0 | ||
export OPTIND=1 | ||
while [[ $OPTIND -le $# ]]; do | ||
OPTOLD=$OPTIND | ||
# getopts in silent mode, don't exit on errors | ||
getopts ":j:p:i:o:n:u:f:" opt || status=$? | ||
case "$opt" in | ||
j) export JOBNAME=$OPTARG | ||
;; | ||
p) export PART=$OPTARG | ||
;; | ||
i) export INDIR=$OPTARG | ||
;; | ||
o) export OUTDIR=$OPTARG | ||
;; | ||
n) export INPRE=$OPTARG | ||
;; | ||
u) export OUTPRE=$OPTARG | ||
;; | ||
f) export FAIL=$OPTARG | ||
;; | ||
# keep going if getopts had an error, but make sure not to skip anything | ||
\? | :) OPTIND=$((OPTOLD+1)) | ||
;; | ||
esac | ||
done | ||
|
||
# default mode | ||
if [ -z "$PART" ]; then | ||
echo "This is a test job. It will print the current directory, contents, and environment." | ||
echo "" | ||
echo "Current directory:" | ||
echo $PWD | ||
echo "" | ||
echo "Current directory listing:" | ||
ls -ltha | ||
echo "" | ||
echo "Current environment:" | ||
printenv | ||
# IO mode | ||
else | ||
echo "parameter set:" | ||
echo "JOBNAME: $JOBNAME" | ||
echo "PART: $PART" | ||
echo "INDIR: $INDIR" | ||
echo "OUTDIR: $OUTDIR" | ||
echo "INPRE: $INPRE" | ||
echo "OUTPRE: $OUTPRE" | ||
|
||
OUTFNAME=${OUTPRE}_${PART}.log | ||
# get input if any | ||
if [ -n "$INDIR" ]; then | ||
INFNAME=${INPRE}_${PART}.log | ||
if [[ "$INDIR" == "root://"* ]]; then | ||
mkdir -p tmp | ||
xrdcp ${INDIR}/${INFNAME} tmp/ | ||
INDIR=tmp | ||
fi | ||
cat ${INDIR}/${INFNAME} >> ${OUTFNAME} | ||
fi | ||
|
||
if [[ $FAIL -ne 0 ]]; then | ||
echo "artificial failure $FAIL" | ||
exit $FAIL | ||
fi | ||
|
||
# create output | ||
echo "$JOBNAME $PART" >> ${OUTFNAME} | ||
|
||
# check for gfal case | ||
CMDSTR="xrdcp" | ||
GFLAG="" | ||
if [[ "$OUTDIR" == "gsiftp://"* ]]; then | ||
CMDSTR="gfal-copy" | ||
GFLAG="-g" | ||
fi | ||
# stageout | ||
echo "$CMDSTR output for condor" | ||
for FILE in *.log; do | ||
echo "${CMDSTR} -f ${FILE} ${OUTDIR}/${FILE}" | ||
stageOut ${GFLAG} -x "-f" -i ${FILE} -o ${OUTDIR}/${FILE} -r -c '*.log' 2>&1 | ||
XRDEXIT=$? | ||
if [[ $XRDEXIT -ne 0 ]]; then | ||
echo "exit code $XRDEXIT, failure in ${CMDSTR}" | ||
exit $XRDEXIT | ||
fi | ||
done | ||
fi |