runjob.sh 758 Bytes
Newer Older
1 2
#!/bin/bash

3 4 5 6 7
# convert DXT env setting
if [ -n $DXT_ENABLE_IO_TRACE ]; then
	DXT_ENV="--env DXT_ENABLE_IO_TRACE="
fi

8
# submit job and get job id
9
jobid=`qsub --env DARSHAN_LOGFILE=$DARSHAN_LOGFILE $DXT_ENV --mode c16 --proccount $DARSHAN_DEFAULT_NPROCS -A radix-io -t 10 -n 1 --output $DARSHAN_TMP/$$-tmp.out --error $DARSHAN_TMP/$$-tmp.err --debuglog $DARSHAN_TMP/$$-tmp.debuglog "$@"`
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
if [ $? -ne 0 ]; then
	echo "Error: failed to qsub $@"
	exit 1
fi

output="foo"
rc=0

# loop as long as qstat succeeds and shows information about job
while [ -n "$output" -a "$rc" -eq 0 ]; do
	sleep 5
	output=`qstat $jobid`
	rc=$?
done

# look for return code
Philip Carns's avatar
Philip Carns committed
26
grep "exit code of 0" $DARSHAN_TMP/$$-tmp.debuglog >& /dev/null
27 28 29 30 31
if [ $? -ne 0 ]; then
	exit 1
else
	exit 0
fi