diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 256: Senthil Kumaran 2013-08-31 Restore an if condition to avoid NoneType

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

Commit Message

Neil Williams Sept. 3, 2013, 11:05 a.m. UTC
Merge authors:
  Senthil Kumaran S (stylesen)
Related merge proposals:
  https://code.launchpad.net/~stylesen/lava-scheduler/fix-worker-multinode-error/+merge/183301
  proposed by: Senthil Kumaran S (stylesen)
  review: Approve - Neil Williams (codehelp)
------------------------------------------------------------
revno: 256 [merge]
committer: Neil Williams <neil.williams@linaro.org>
branch nick: lava-scheduler
timestamp: Tue 2013-09-03 12:01:40 +0100
message:
  Senthil Kumaran 2013-08-31 Restore an if condition to avoid NoneType
   objects for jobs.
  Senthil Kumaran 2013-08-30 Fix scheduling jobs across multiple workers
   setup.
modified:
  lava_scheduler_daemon/service.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
diff mbox

Patch

=== modified file 'lava_scheduler_daemon/service.py'
--- lava_scheduler_daemon/service.py	2013-08-28 13:13:46 +0000
+++ lava_scheduler_daemon/service.py	2013-08-30 18:07:18 +0000
@@ -17,6 +17,7 @@ 
 # along with LAVA Scheduler.  If not, see <http://www.gnu.org/licenses/>.
 
 import logging
+import lava_dispatcher.config as dispatcher_config
 
 from twisted.application.service import Service
 from twisted.internet import defer
@@ -42,11 +43,16 @@ 
             self._cbCheckJobs).addErrback(catchall_errback(self.logger))
 
     def _cbCheckJobs(self, job_list):
+        configured_boards = [
+            x.hostname for x in dispatcher_config.get_devices()]
+
         for job in job_list:
-            new_job = JobRunner(self.source, job, self.dispatcher,
-                                self.reactor, self.daemon_options)
-            self.logger.info("Starting Job: %d " % job.id)
-            new_job.start()
+            if job.actual_device.hostname in configured_boards:
+                new_job = JobRunner(self.source, job, self.dispatcher,
+                                    self.reactor, self.daemon_options)
+                self.logger.info("Starting Job: %d " % job.id)
+
+                new_job.start()
 
     def startService(self):
         self._check_job_call.start(20)