diff options
author | Loys Ollivier <lollivier@baylibre.com> | 2018-01-03 18:04:59 +0100 |
---|---|---|
committer | Loys Ollivier <lollivier@baylibre.com> | 2018-01-03 18:04:59 +0100 |
commit | 06b4550b3fb1c13827cdbbc2b58d42e5ec6d259a (patch) | |
tree | 6f2c06d1f62c68b09e3d4024992e2f31087064ac | |
parent | de66b7019f452a8a0948f7991fc07e9c9f27bb87 (diff) |
jjb/common: lava-labs-prepare.sh fix polling on reserved boards
The script would still wait for 60 seconds and retry on boards that are
not in the reserved state.
Fix this and poll for a change of status only if the board is reserved.
Fixes: 1ae347940236 ("jjb/common: lava-labs-prepare.sh")
Change-Id: I4ce71979f7cb2856768de748c1afb6a1cfb47ca2
Signed-off-by: Loys Ollivier <lollivier@baylibre.com>
-rw-r--r-- | jjb/common/include-agl-lava-labs-prepare.sh | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/jjb/common/include-agl-lava-labs-prepare.sh b/jjb/common/include-agl-lava-labs-prepare.sh index 8a40704a..35d3541c 100644 --- a/jjb/common/include-agl-lava-labs-prepare.sh +++ b/jjb/common/include-agl-lava-labs-prepare.sh @@ -96,6 +96,22 @@ for lab in "${!labs[@]}"; do do # device is only available if "idle" or "running" device_available=0 + if [ x"$device_status" = x"reserved" ]; then + sleep 60s + # Look if the status of the board has changed from reserved in the lab + echo -n "Checking for $lava_device at $full_url... " + line=$(lava-tool devices-list $full_url | grep $lava_device) + line=$(echo "$line" | tr -d '[:space:]') + + if [ -z "$line" ]; then + echo "not found." + continue + fi + IFS='|' + arr=($line) + device_status=${arr[2]} + IFS=${OFS} + fi if [ x"$device_status" = x"idle" ]; then device_available=1 break @@ -103,20 +119,6 @@ for lab in "${!labs[@]}"; do device_available=1; break fi - sleep 60s - # Find the LAVA Lab that has the device available to run the job - echo -n "Checking for $lava_device at $full_url... " - line=$(lava-tool devices-list $full_url | grep $lava_device) - line=$(echo "$line" | tr -d '[:space:]') - - if [ -z "$line" ]; then - echo "not found." - continue - fi - IFS='|' - arr=($line) - device_status=${arr[2]} - IFS=${OFS} done if [ $device_available = 0 ]; then |