-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the submission to a separate script
- Loading branch information
1 parent
85f2fac
commit 2289e23
Showing
2 changed files
with
41 additions
and
11 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
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,36 @@ | ||
#!/bin/bash | ||
# Helper script for RunHPC that attempts to submit a HPC | ||
# job until success. This is needed in the event that the | ||
# qsub/slurm script that we wrote from the TestHarness | ||
# is not immediately readable due to a networked file | ||
# system on the (possibly) other host we're submitting from. | ||
|
||
SUBMIT_COMMAND="$1" | ||
FILE="$2" | ||
if [ -z "$SUBMIT_COMMAND" ]; then | ||
echo "First argument (submit command) not provided" | ||
exit 1 | ||
fi | ||
if [ -z "$FILE" ]; then | ||
echo "Second argument (file) not provided" | ||
exit 1 | ||
fi | ||
COMMAND=("${SUBMIT_COMMAND}" "${FILE}") | ||
# Try for 10 seconds to find the file | ||
for i in {1..40}; do | ||
if [ -e "$FILE" ]; then | ||
failed= | ||
"${COMMAND[@]}" || failed=1 | ||
if [ -n "$failed" ]; then | ||
sleep 1 | ||
"${COMMAND[@]}" "${FILE}" | ||
exit $? | ||
else | ||
exit 0 | ||
fi | ||
else | ||
sleep 0.25 | ||
fi | ||
done | ||
echo "Failed to find ${FILE}" | ||
exit 1 |