=== modified file 'lava_dispatcher/client/base.py'
@@ -475,6 +475,9 @@
def retrieve_results(self, result_disk):
raise NotImplementedError(self.retrieve_results)
+ def finish(self):
+ pass
+
# Android stuff
def get_android_adb_interface(self):
=== modified file 'lava_dispatcher/client/targetdevice.py'
@@ -67,7 +67,7 @@
def _boot_linaro_image(self):
if self.proc:
logging.warning('device already powered on, powering off first')
- self.target_device.power_off(self.proc)
+ self._power_off_device()
self.proc = self.target_device.power_on()
def _boot_linaro_android_image(self):
@@ -85,9 +85,9 @@
return self.tester_session()
def retrieve_results(self, result_disk):
+ self._power_off_device()
+
td = self.target_device
- td.power_off(self.proc)
-
tar = os.path.join(td.scratch_dir, 'lava_results.tgz')
result_dir = self.context.config.lava_result_dir
with td.file_system(td.config.root_part, result_dir) as mnt:
@@ -99,3 +99,18 @@
a = super(TargetBasedClient, self).get_test_data_attachments()
a.extend(self.target_device.get_test_data_attachments())
return a
+
+ def finish(self):
+ self._power_off_device()
+
+ def _power_off_device(self):
+ """
+ Powers the associated device off by calling its power_off() method.
+
+ Can be called multiple times, but only the first will be effective, all
+ the others will be no-ops (unless the device is powered on again by
+ calling one of the _boot* methods).
+ """
+ if self.proc:
+ self.target_device.power_off(self.proc)
+ self.proc = None
=== modified file 'lava_dispatcher/context.py'
@@ -148,3 +148,6 @@
logging.debug("Executing on host : '%r'" % command)
return subprocess.check_output(command)
+ def finish(self):
+ self.client.finish()
+
=== modified file 'lava_dispatcher/job.py'
@@ -268,6 +268,7 @@
except Exception as err:
logging.error("Failed to submit the test result. Error = %s", err)
raise
+ self.context.finish()
def _set_logging_level(self):
# set logging level is optional
=== modified file 'lava_dispatcher/utils.py'
@@ -272,7 +272,7 @@
time=datetime.datetime.utcnow().timetuple())
def finalize_process(proc):
- print("*** finalize_process ***")
if proc:
+ logging.debug("Finalizing child proccess with PID %d" % proc.pid)
proc.kill(9)
proc.close()