~stylesen/lava-scheduler/fix-bug-1220414-take-1

« back to all changes in this revision

Viewing changes to lava_scheduler_app/models.py

  • Committer: Neil Williams
  • Date: 2013-09-05 12:37:47 UTC
  • mfrom: (258.1.2 submitting-offline)
  • Revision ID: neil.williams@linaro.org-20130905123747-2k5zmcda9j08rvy0
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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
    device_types = DeviceType.objects.values_list('name').filter(
63
63
        models.Q(device__status=Device.IDLE) |
64
64
        models.Q(device__status=Device.RUNNING) |
65
 
        models.Q(device__status=Device.RESERVED)
 
65
        models.Q(device__status=Device.RESERVED) |
 
66
        models.Q(device__status=Device.OFFLINE) |
 
67
        models.Q(device__status=Device.OFFLINING)
66
68
        ).annotate(
67
69
            num_count=models.Count('name')
68
70
        ).order_by('name')
79
81
                continue
80
82
            else:
81
83
                raise DevicesUnavailableException(
82
 
                    "Required number of device(s) unavailable.")
 
84
                    "Requested %d %s device(s) - only %d available." % (count, board, all_devices[board]))
83
85
    return True
84
86
 
85
87