Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle multiple jobs in test script #441

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions bin/supplemental_tools/dax-testrun.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ dax build \
--sessions "${session}" \
"${setfile}"

# FIXME Check for successful build or fail with useful info

# Launch
echo "Launching"
Expand All @@ -95,27 +94,34 @@ dax launch \
--sessions "${session}" \
"${setfile}"

# Identify and track the job (check every $delay seconds)
jobid=$(grep "INFO - cluster - Submitted batch job" "${launchlog}" | cut -d ' ' -f 11)
# Identify and track the jobs (check every $delay seconds). Handle multiple
# jobs launched
jobidstr=$(grep "INFO - cluster - Submitted batch job" "${launchlog}" | cut -d ' ' -f 11)
jobids=(${jobidstr//\n/ })
jobcount=${#jobids[@]}

if [ -z "${jobid}" ]; then
if [ -z "${jobidstr}" ]; then
echo "Job not launched"
exit 1
else
echo "Job ${jobid} launched"
echo "Jobs launched (${jobcount}): ${jobids[@]}"
fi

jobstate=
while [ "${jobstate}" != "completed" ]; do
jobscompleted=0
while [ "${jobscompleted}" -lt "${jobcount}" ]; do
sleep "${delay}"
jobstate=$(rtracejob ${jobid} |grep "State")
jobstate=$(echo ${jobstate##*|})
echo "Job ${jobid} state: ${jobstate}"
jobscompleted=0
for job in ${jobids[@]}; do
jobstate=$(rtracejob ${job} |grep "State")
jobstate=$(echo ${jobstate##*|})
echo "Job ${job} state: ${jobstate}"
if [ "${jobstate}" = "completed" ]; then
((jobscompleted++))
fi
done
echo "Jobs completed: ${jobscompleted} of ${jobcount}"
done

# FIXME show the assessor status (JOB_FAILED.txt, READY_TO_COMPLETE.txt, ...)

# FIXME If failed, report error lines in outlog

# Update/upload to get results to xnat
echo Updating
Expand Down