diff options
Diffstat (limited to 'jjb/common')
-rw-r--r-- | jjb/common/include-agl-lava-labs-prepare.sh | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/jjb/common/include-agl-lava-labs-prepare.sh b/jjb/common/include-agl-lava-labs-prepare.sh index 947e0862..8a40704a 100644 --- a/jjb/common/include-agl-lava-labs-prepare.sh +++ b/jjb/common/include-agl-lava-labs-prepare.sh @@ -84,14 +84,41 @@ for lab in "${!labs[@]}"; do 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; + if [ x"$device_status" = x"reserved" ]; then + retries=10 + else + retries=1 fi + # If the device is reserved poll it's status every minutes. + # The max polling time is set to $retries * 60 seconds = 10 minutes. + for i in `seq 1 $retries` + do + # device is only available if "idle" or "running" + device_available=0 + if [ x"$device_status" = x"idle" ]; then + device_available=1 + break + elif [ x"$device_status" = x"running" ]; then + 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 echo " Not Available. Status: $device_status" continue |