diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 103: fix bug #898000: dispatcher exit status != 0 should lead to job status of INCOMPLETE

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

Commit Message

Michael-Doyle Hudson Dec. 1, 2011, 4 a.m. UTC
------------------------------------------------------------
revno: 103
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: lava-scheduler
timestamp: Thu 2011-12-01 16:58:08 +1300
message:
  fix bug #898000: dispatcher exit status != 0 should lead to job status of INCOMPLETE 
modified:
  lava_scheduler_daemon/board.py
  lava_scheduler_daemon/dbjobsource.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/board.py'
--- lava_scheduler_daemon/board.py	2011-12-01 03:32:52 +0000
+++ lava_scheduler_daemon/board.py	2011-12-01 03:58:08 +0000
@@ -57,7 +57,7 @@ 
 
     def processEnded(self, reason):
         self.log_file.close()
-        self.deferred.callback(None)
+        self.deferred.callback(reason.value.exitCode)
 
 
 class Job(object):
@@ -104,15 +104,15 @@ 
         d.addBoth(self._exited)
         return d
 
-    def _exited(self, result):
+    def _exited(self, exit_code):
         self.logger.info("job finished on %s", self.job_data['target'])
         if self._json_file is not None:
             os.unlink(self._json_file)
         self.logger.info("reporting job completed")
         self._source_lock.run(self._checkCancel_call.stop)
         return self._source_lock.run(
-            self.source.jobCompleted, self.board_name).addCallback(
-            lambda r:result)
+            self.source.jobCompleted, self.board_name, exit_code).addCallback(
+            lambda r:exit_code)
 
 
 class SimplePP(ProcessProtocol):

=== modified file 'lava_scheduler_daemon/dbjobsource.py'
--- lava_scheduler_daemon/dbjobsource.py	2011-10-28 05:36:02 +0000
+++ lava_scheduler_daemon/dbjobsource.py	2011-12-01 03:58:08 +0000
@@ -135,7 +135,7 @@ 
     def getLogFileForJobOnBoard(self, board_name):
         return self.deferForDB(self.getLogFileForJobOnBoard_impl, board_name)
 
-    def jobCompleted_impl(self, board_name):
+    def jobCompleted_impl(self, board_name, exit_code):
         self.logger.debug('marking job as complete on %s', board_name)
         device = Device.objects.get(hostname=board_name)
         if device.status == Device.RUNNING:
@@ -149,7 +149,10 @@ 
         job = device.current_job
         device.current_job = None
         if job.status == TestJob.RUNNING:
-            job.status = TestJob.COMPLETE
+            if exit_code == 0:
+                job.status = TestJob.COMPLETE
+            else:
+                job.status = TestJob.INCOMPLETE
         elif job.status == TestJob.CANCELING:
             job.status = TestJob.CANCELED
         else:
@@ -160,8 +163,8 @@ 
         device.save()
         job.save()
 
-    def jobCompleted(self, board_name):
-        return self.deferForDB(self.jobCompleted_impl, board_name)
+    def jobCompleted(self, board_name, exit_code):
+        return self.deferForDB(self.jobCompleted_impl, board_name, exit_code)
 
     def jobOobData_impl(self, board_name, key, value):
         self.logger.info(