1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-18 20:11:20 +00:00

framework/execution: Implement reboot policies

Although the configuration of reboot policies was present the actual
implementation was missing.
This commit is contained in:
Marc Bonnici 2018-05-22 14:55:21 +01:00 committed by setrofim
parent 1a67a3a4e5
commit 78d5b18182
2 changed files with 9 additions and 2 deletions

View File

@ -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):

View File

@ -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))