[Branch,~linaro-validation/lava-scheduler/trunk] Rev 259: Neil Williams 2013-09-04 Change to an explicit check for boards which

Message ID 20130905123923.30909.58657.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Neil Williams Sept. 5, 2013, 12:39 p.m.
Merge authors:
  Neil Williams (codehelp)
Related merge proposals:
  https://code.launchpad.net/~codehelp/lava-scheduler/submitting-offline/+merge/183854
  proposed by: Neil Williams (codehelp)
  review: Approve - Neil Williams (codehelp)
  review: Approve - Antonio Terceiro (terceiro)
------------------------------------------------------------
revno: 259 [merge]
committer: Neil Williams <neil.williams@linaro.org>
branch nick: lava-scheduler
timestamp: Thu 2013-09-05 13:37:47 +0100
message:
  Neil Williams 2013-09-04 Change to an explicit check for boards which
   are offlining, reserved or already offline to allow job submission 
   as long as the boards are not retired. Clarify exception message.
  Neil Williams 2013-09-03 Allow submission of jobs when devices are
    offline by only excluding devices which are retired from the 
   calculation of available devices.
modified:
  lava_scheduler_app/models.py


--
lp:lava-scheduler
https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk

You are subscribed to branch lp:lava-scheduler.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription

Patch

=== modified file 'lava_scheduler_app/models.py'
--- lava_scheduler_app/models.py	2013-09-02 15:42:27 +0000
+++ lava_scheduler_app/models.py	2013-09-04 14:46:59 +0000
@@ -62,7 +62,9 @@ 
     device_types = DeviceType.objects.values_list('name').filter(
         models.Q(device__status=Device.IDLE) |
         models.Q(device__status=Device.RUNNING) |
-        models.Q(device__status=Device.RESERVED)
+        models.Q(device__status=Device.RESERVED) |
+        models.Q(device__status=Device.OFFLINE) |
+        models.Q(device__status=Device.OFFLINING)
         ).annotate(
             num_count=models.Count('name')
         ).order_by('name')
@@ -79,7 +81,7 @@ 
                 continue
             else:
                 raise DevicesUnavailableException(
-                    "Required number of device(s) unavailable.")
+                    "Requested %d %s device(s) - only %d available." % (count, board, all_devices[board]))
     return True