Commit 0bf01cd0 authored by Pape, David (FWCC) - 139658's avatar Pape, David (FWCC) - 139658
Browse files

Should now send live output to GitLab CI page. More testing needed!

parent a404edab
......@@ -37,8 +37,6 @@ runStage=${*: -1:1}
# This is needed since the runner's working directory is /tmp which is not shared between nodes.
workDir="/home/pape58/runner-wd"
module load git
#1>&2 echo "Run stage: $runStage"
if [[ "$runStage" == "build_script" ]]; then
......@@ -79,15 +77,27 @@ if [[ "$runStage" == "build_script" ]]; then
chmod +x "$script"
jobID=$(sbatch "$script" | awk '{ print $4 }')
outFile="$workDir/slurm-$jobID.out"
errFile="$workDir/slurm-$jobID.err"
# spawn subshells for live output of std and err
(until [[ -f "$outFile" ]]; do sleep 0.1; done && tail -f "$outFile") &
pidTailOutParent="$!"
(until [[ -f "$errFile" ]]; do sleep 0.1; done && tail -f "$errFile") &
pidTailErrParent="$!"
# wait for job to finish
until [[ $(squeue -j "$jobID" | wc -l) -le "1" ]]; do sleep 2; done
outFile="$workDir/slurm-$jobID.out"
errFile="$workDir/slurm-$jobID.err"
pidTailOut=$(ps --ppid "$pidTailOutParent" | tail -n 1 | awk '{ print $1 }')
pidTailErr=$(ps --ppid "$pidTailErrParent" | tail -n 1 | awk '{ print $1 }')
# send SIGPIPE to suppress output when killing
kill -13 "$pidTailOut" "$pidTailErr"
# print output and error
cat "$outFile"
1>&2 cat "$errFile"
#cat "$outFile"
#1>&2 cat "$errFile"
# cleanup
rm "$outFile" "$errFile"
......@@ -98,6 +108,7 @@ if [[ "$runStage" == "build_script" ]]; then
exit "$exitCode"
else
# run script without intervention
"$script"
fi
......
......@@ -16,6 +16,5 @@ check_interval = 0
[runners.custom]
config_exec = "config.sh"
run_exec = "run.sh"
run_args = [ "$TEST" ]
graceful_kill_timeout = 200
force_kill_timeout = 200
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment