Merge lp:~stylesen/lava-scheduler/multinode into lp:lava-scheduler/multinode

Proposed by Senthil Kumaran S
Status: Merged
Approved by: Neil Williams
Approved revision: no longer in the source branch.
Merged at revision: 265
Proposed branch: lp:~stylesen/lava-scheduler/multinode
Merge into: lp:lava-scheduler/multinode
Diff against target: 43 lines (+6/-6)
1 file modified
lava_scheduler_daemon/dbjobsource.py (+6/-6)
To merge this branch: bzr merge lp:~stylesen/lava-scheduler/multinode
Reviewer Review Type Date Requested Status
Neil Williams Approve
Review via email: mp+176183@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Neil Williams (codehelp) wrote :

Looks good, approved.

review: Approve
Revision history for this message
Senthil Kumaran S (stylesen) wrote :

On Monday 22 July 2013 06:35 PM, Neil Williams wrote:
> Review: Approve
>
> Looks good, approved.

Even a simpler patch :)

=== modified file 'lava_scheduler_daemon/service.py'
--- lava_scheduler_daemon/service.py 2013-07-22 12:43:45 +0000
+++ lava_scheduler_daemon/service.py 2013-07-22 13:06:17 +0000
@@ -76,7 +76,7 @@
              self._cbCheckJobs).addErrback(catchall_errback(self.logger))

      def _cbCheckJobs(self, job_list):
- for job in job_list:
+ for job in set(job_list):
              new_job = NewJob(self.source, job, self.dispatcher,
self.reactor,
                               self.daemon_options)
              self.logger.info("Starting Job: %d " % job.id)

--
Senthil Kumaran
http://www.stylesen.org/
http://www.sasenthilkumaran.com/

265. By Neil Williams

Senthil Kumaran 2013-07-22 Return a unique set of job_list whenever asked for.
Senthil Kumaran 2013-07-22 Get unique job ids in the job list which
 restricts the same health check job being called more than once.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_scheduler_daemon/dbjobsource.py'
2--- lava_scheduler_daemon/dbjobsource.py 2013-07-03 06:45:30 +0000
3+++ lava_scheduler_daemon/dbjobsource.py 2013-07-22 12:46:28 +0000
4@@ -107,10 +107,10 @@
5 """Gets the list of configured boards and checks which are the boards
6 that require health check.
7
8- Returns JOB_LIST which is a list of health check jobs. If no health
9- check jobs are available returns an empty list.
10+ Returns JOB_LIST which is a set of health check jobs. If no health
11+ check jobs are available returns an empty set.
12 """
13- job_list = []
14+ job_list = set()
15 configured_boards = [
16 x.hostname for x in dispatcher_config.get_devices()]
17 boards = []
18@@ -133,7 +133,7 @@
19 run_health_check = device.last_health_report_job.end_time < \
20 datetime.datetime.now() - datetime.timedelta(days=1)
21 if run_health_check:
22- job_list.append(self._getHealthCheckJobForBoard(device))
23+ job_list.add(self._getHealthCheckJobForBoard(device))
24 return job_list
25
26 def _fix_device(self, device, job):
27@@ -181,7 +181,7 @@
28
29 for job in jobs:
30 if job.actual_device:
31- job_list.append(job)
32+ job_list.add(job)
33 elif job.requested_device:
34 self.logger.debug("Checking Requested Device")
35 devices = Device.objects.all().filter(
36@@ -198,7 +198,7 @@
37 device = devices[0]
38 job = self._fix_device(device, job)
39 if job:
40- job_list.append(job)
41+ job_list.add(job)
42
43 return job_list
44

Subscribers

People subscribed via source and target branches

to status/vote changes: