~stylesen/lava-scheduler/optional-params-caution

« back to all changes in this revision

Viewing changes to lava_scheduler_daemon/dbjobsource.py

  • Committer: Neil Williams
  • Date: 2013-08-09 09:31:36 UTC
  • mfrom: (268.1.1 lava-scheduler)
  • Revision ID: neil.williams@linaro.org-20130809093136-60pdkhgeh4ou7s8v
Neil Williams 2013-08-09 The job list was not looking at the 
dispatcher_config devices list for the boards actually available 
on the machine running this scheduler. This patch adds a check on 
this list and prevents jobs being added if there is no configured board.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
        return self.deferToThread(wrapper, *args, **kw)
94
94
 
95
95
    def getBoardList_impl(self):
 
96
        self.logger.info("Checking configured devices")
96
97
        configured_boards = [
97
98
            x.hostname for x in dispatcher_config.get_devices()]
98
99
        boards = []
 
100
        for d in configured_boards:
 
101
            self.logger.info("%s is configured" % d.hostname)
99
102
        for d in Device.objects.all():
100
103
            if d.hostname in configured_boards:
101
104
                boards.append({'hostname': d.hostname})
179
182
            status=TestJob.SUBMITTED).order_by('-priority', 'submit_time')
180
183
        job_list = self._get_health_check_jobs()
181
184
        devices = None
182
 
 
 
185
        configured_boards = [
 
186
            x.hostname for x in dispatcher_config.get_devices()]
 
187
        self.logger.debug("Number of configured_devices: %d" % len(configured_boards))
183
188
        for job in jobs:
184
189
            if job.actual_device:
185
190
                job_list.add(job)
196
201
            else:
197
202
                continue
198
203
            if devices:
199
 
                device = devices[0]
200
 
                job = self._fix_device(device, job)
201
 
                if job:
202
 
                    job_list.add(job)
 
204
                for d in devices:
 
205
                    self.logger.info("Checking %s" % d.hostname)
 
206
                    if d.hostname in configured_boards:
 
207
                       job = self._fix_device(d, job)
 
208
                       if job:
 
209
                           job_list.add(job)
203
210
 
204
211
        return job_list
205
212