aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-08-28 11:37:23 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2019-08-28 11:37:23 +0000
commite9c02675f2474bdb1ad71f833a9a9ab95e8bea51 (patch)
tree07842790900a5c0695ce5213fec50d4ae6a49948
parent2b53c2a4d37f74d487a36fd48699553b326a7d2a (diff)
parent7a4248260d211abf66cf8d9c5dbd30c91e063c67 (diff)
Merge "Manage the polling with lavacli"
-rw-r--r--jjb/common/include-agl-lava-jobs-submit.sh46
1 files changed, 7 insertions, 39 deletions
diff --git a/jjb/common/include-agl-lava-jobs-submit.sh b/jjb/common/include-agl-lava-jobs-submit.sh
index 46172751..0f7844f3 100644
--- a/jjb/common/include-agl-lava-jobs-submit.sh
+++ b/jjb/common/include-agl-lava-jobs-submit.sh
@@ -41,46 +41,14 @@ echo "Submitted as job: $JOB_URL"
echo ""
echo "####################################################"
echo ""
-#
-# LAVA job details, get job status from lavacli output
-#
-# There is no version of blocking call (--block) for lavacli
-# If the job didn't finish after JOB_TIMEOUT, will exit and display
-# an error message
-# example: lava-slave crash
-if [ -z $JOB_TIMEOUT ]; then
- # if the JOB_TIMEOUT is not set, it's 1 hour by default
- JOB_TIMEOUT=360
-fi
-# FIXME: this section needs to run under set +e
-set +e
-for i in $(seq 1 $JOB_TIMEOUT); do
- lavacli -i $lab jobs show $job_id --yaml > $JOB_STATUS
- if [ $? -ne 0 ];then
- # be patient in case of a temporary error
- sleep 10
- continue
- fi
- state=$(grep ^state: $JOB_STATUS| cut -d' ' -f2)
- if [ $state == "Canceled" ]; then
- status=$(grep ^health: $JOB_STATUS| cut -d' ' -f2)
- echo "LAVA job $job_id completed with status: $status"
- break
- fi
- if [ $state == "Finished" ]; then
- status=$(grep ^health: $JOB_STATUS| cut -d' ' -f2)
- echo "LAVA job $job_id completed with status: $status"
- break
- fi
- sleep 10
-done
-set -e
-# enable set -e again
-
-if [ $i -ge $JOB_TIMEOUT ];then
- echo "ERROR: job did not finished before 1 hour"
- exit 1
+# use lavacli wait job instead of the polling.
+lavacli -i agl jobs wait $job_id --timeout 7200
+lavacli -i agl jobs show $job_id --yaml > $JOB_STATUS
+state=$(grep ^state: $JOB_STATUS| cut -d' ' -f2)
+if [ "$state" == "Finished" ]; then
+ status=$(grep ^health: $JOB_STATUS| cut -d' ' -f2)
+ echo "LAVA job $job_id completed with status: $status"
fi
echo "####"