~fu-wei/lava-scheduler/lmp

« back to all changes in this revision

Viewing changes to lava_scheduler_app/api.py

  • Committer: Fu Wei
  • Date: 2013-09-17 14:59:18 UTC
  • mfrom: (260.2.6 lava-scheduler)
  • Revision ID: fu.wei@linaro.org-20130917145918-tp91033tm4lvldz2
update to latest version of trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
200
200
 
201
201
        pending_jobs_by_device = {}
202
202
 
203
 
        jobs = TestJob.objects.filter(status=TestJob.SUBMITTED)\
 
203
        jobs_res = TestJob.objects.filter(status=TestJob.SUBMITTED)\
204
204
            .values_list('requested_device_type_id')\
205
205
            .annotate(pending_jobs=(Count('id')))
206
 
        pending_jobs_by_device.update(dict(jobs))
 
206
        jobs = {}
 
207
        jobs_hash = dict(jobs_res)
 
208
        for job in jobs_hash:
 
209
            if job:
 
210
                jobs[job] = jobs_hash[job]
 
211
        pending_jobs_by_device.update(jobs)
207
212
 
208
213
        # Get rest of the devices and put number of pending jobs as 0.
209
214
        device_types = DeviceType.objects.values_list('name', flat=True)