aboutsummaryrefslogtreecommitdiffstats
path: root/jjb
diff options
context:
space:
mode:
authorLoys Ollivier <lollivier@baylibre.com>2017-11-10 11:31:20 +0100
committerLoys Ollivier <lollivier@baylibre.com>2017-11-10 14:20:18 +0100
commitb6817f349d13a96cbc564cd39aae1abb44bcfdab (patch)
tree67dd7da7d66dbf98bd6d5116dc2ac3f3d2ef6a4e /jjb
parent7ffc16fa46827b3d0289139fc23f2e9122efddf1 (diff)
jjb/common: lava-jobs-submit: fixup wait for job
REQUIRES: lava-tool version >= 0.19 The previous version using submit-job with "--block" would never timeout and remain blocked even if there was an issue during the LAVA job execution. This patch fixes the issue by using wait-job-events with a tiemout. Parsing has been updated to follow these commands as well. Change-Id: If090d278cb58c1c1b902793bf0ca40daceb2fd97 Signed-off-by: Loys Ollivier <lollivier@baylibre.com>
Diffstat (limited to 'jjb')
-rw-r--r--jjb/common/include-agl-lava-jobs-submit.sh51
1 files changed, 16 insertions, 35 deletions
diff --git a/jjb/common/include-agl-lava-jobs-submit.sh b/jjb/common/include-agl-lava-jobs-submit.sh
index 3cd0d9ff..c9f79e00 100644
--- a/jjb/common/include-agl-lava-jobs-submit.sh
+++ b/jjb/common/include-agl-lava-jobs-submit.sh
@@ -27,47 +27,31 @@ device_types+=" "
device_types+=${dt_aliases[$__device_type]}
for device_type in $device_types; do
- echo -n "Checking for $device_type at $full_url... "
- line=$(lava-tool devices-list $full_url |grep $device_type | tr -d '[:space:]')
- if [ -z "$line" ]; then
- echo "not found."
- continue
- fi
- IFS='|'
- arr=($line)
- device_status=${arr[2]}
- IFS=${OFS}
-
- # device is only available if "idle" or "running"
- device_available=0
- if [ x"$device_status" = x"idle" ]; then
- device_available=1
- elif [ x"$device_status" = x"running" ]; then
- device_available=1;
- fi
-
- if [ $device_available = 0 ]; then
- echo " Not Available. Status: $device_status"
- continue
- else
- echo " Found and available. Status: $device_status"
- fi
-
# Need to hack the real device-type name in the job file
JOB_FILE_NEW="${JOB_BASE}_${LAVA_LAB}.yaml"
cat $JOB_FILE | sed "s/device_type: $__device_type/device_type: $device_type/" > $JOB_FILE_NEW
#
- # LAVA job submit, get job ID and status from lava-tool output
+ # LAVA job submit, get job ID from lava-tool output
#
JOB_STATUS="${JOB_BASE}_${LAVA_LAB}.status"
- lava-tool submit-job --block $full_url $JOB_FILE_NEW |tee $JOB_STATUS
+ lava-tool submit-job $full_url $JOB_FILE_NEW |tee $JOB_STATUS
+ # Printing the job URL in the log
+ grep "submitted as job:" $JOB_STATUS
+ job_id=$(grep "submitted as job:" $JOB_STATUS | sed 's/.*\/\([0-9]*$\)/\1/')
+
+ #
+ # LAVA wait job events, wait for job to finish or timeout (300 seconds)
+ #
+ lava-tool wait-job-events --job-id $job_id --timeout 300 $full_url
+
+ #
+ # LAVA job details, get job status from lava-tool output
+ #
+ lava-tool job-details $full_url $job_id | tee $JOB_STATUS
IFS=':'
- line=$(grep "job id" $JOB_STATUS | tr -d '[:space:]')
- arr=($line)
- job_id=${arr[1]}
- line=$(grep "Job Status:" $JOB_STATUS | tr -d '[:space:]')
+ line=$(grep "^status:" $JOB_STATUS | tr -d '[:space:]')
arr=($line)
status=${arr[1]}
IFS=${OFS}
@@ -95,7 +79,4 @@ for device_type in $device_types; do
fi
done
-# If we get here there was an issue in submitting the job to the lab
-# Most probably the device got retired, offlined, reserved in the lab
exit 1
-