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

fw/config: Add additional run_completed reboot policy

Add an additional `run_completed` reboot policy for when a run
has finished.
This complements the `initial` reboot policy and aims to leave
the device in a fresh state after WA has finished executing.
This commit is contained in:
Marc Bonnici 2020-12-08 12:19:18 +00:00 committed by setrofim
parent 91b791665a
commit ae1bc2c031
2 changed files with 12 additions and 1 deletions

View File

@ -58,10 +58,11 @@ class RebootPolicy(object):
executing the first workload spec. executing the first workload spec.
:each_spec: The device will be rebooted before running a new workload spec. :each_spec: The device will be rebooted before running a new workload spec.
:each_iteration: The device will be rebooted before each new iteration. :each_iteration: The device will be rebooted before each new iteration.
:run_completion: The device will be rebooted after the run has been completed.
""" """
valid_policies = ['never', 'as_needed', 'initial', 'each_spec', 'each_job'] valid_policies = ['never', 'as_needed', 'initial', 'each_spec', 'each_job', 'run_completion']
@staticmethod @staticmethod
def from_pod(pod): def from_pod(pod):
@ -92,6 +93,10 @@ class RebootPolicy(object):
def reboot_on_each_spec(self): def reboot_on_each_spec(self):
return self.policy == 'each_spec' return self.policy == 'each_spec'
@property
def reboot_on_run_completion(self):
return self.policy == 'run_completion'
def __str__(self): def __str__(self):
return self.policy return self.policy
@ -664,6 +669,9 @@ class RunConfiguration(Configuration):
.. note:: this acts the same as each_job when execution order .. note:: this acts the same as each_job when execution order
is set to by_iteration is set to by_iteration
''"run_completion"''
The device will be reboot after the run has been completed.
'''), '''),
ConfigurationPoint( ConfigurationPoint(
'device', 'device',

View File

@ -537,6 +537,9 @@ class Runner(object):
self.pm.process_run_output(self.context) self.pm.process_run_output(self.context)
self.pm.export_run_output(self.context) self.pm.export_run_output(self.context)
self.pm.finalize(self.context) self.pm.finalize(self.context)
if self.context.reboot_policy.reboot_on_run_completion:
self.logger.info('Rebooting target on run completion.')
self.context.tm.reboot(self.context)
signal.disconnect(self._error_signalled_callback, signal.ERROR_LOGGED) signal.disconnect(self._error_signalled_callback, signal.ERROR_LOGGED)
signal.disconnect(self._warning_signalled_callback, signal.WARNING_LOGGED) signal.disconnect(self._warning_signalled_callback, signal.WARNING_LOGGED)