From 78d5b181828eb0f0eab4d92036474a6a4c80df72 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Tue, 22 May 2018 14:55:21 +0100 Subject: [PATCH] framework/execution: Implement reboot policies Although the configuration of reboot policies was present the actual implementation was missing. --- wa/framework/configuration/core.py | 4 ++-- wa/framework/execution.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/wa/framework/configuration/core.py b/wa/framework/configuration/core.py index 4af20bb6..93db1b53 100644 --- a/wa/framework/configuration/core.py +++ b/wa/framework/configuration/core.py @@ -78,8 +78,8 @@ class RebootPolicy(object): return self.policy != 'never' @property - def perform_initial_boot(self): - return self.policy not in ['never', 'as_needed'] + def perform_initial_reboot(self): + return self.policy == 'initial' @property def reboot_on_each_job(self): diff --git a/wa/framework/execution.py b/wa/framework/execution.py index 67839c92..da2c304c 100644 --- a/wa/framework/execution.py +++ b/wa/framework/execution.py @@ -327,6 +327,9 @@ class Executor(object): self.target_manager = TargetManager(config.run_config.device, config.run_config.device_config, output.basepath) + + if config_manager.run_config.reboot_policy.perform_initial_reboot: + self.target_manager.target.reboot() output.set_target_info(self.target_manager.get_target_info()) self.logger.info('Initializing execution context') @@ -461,6 +464,10 @@ class Runner(object): signal.disconnect(self._warning_signalled_callback, signal.WARNING_LOGGED) def run_next_job(self, context): + if self.config.run_config.reboot_policy.reboot_on_each_job: + self.logger.debug('Rebooting on new job.') + self.context.tm.target.reboot() + job = context.start_job() self.logger.info('Running job {}'.format(job.id))