1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 11:22:41 +01:00

Adding intialize and finalize methods to workloads that will only be invoked once per run

- added initialze and finalize methods to workloads, which were the only
  major extension types that did not have them
- Semanatics for initialize/finalize for *all* Extensions are changed so
  that now they will always run at most once per run. They will not be
  executed twice even if invoke via istances of different subclasses (if
  those subclasses defined their own verions, then their versions will
  be invoked once each, but the base version will only get invoked
  once).
This commit is contained in:
Sergei Trofimov
2015-06-11 17:39:17 +01:00
parent 557b792c77
commit b3a0933221
7 changed files with 153 additions and 21 deletions

View File

@@ -53,18 +53,25 @@ class Workload(Extension):
def init_resources(self, context):
"""
May be optionally overridden by concrete instances in order to discover and initialise
necessary resources. This method will be invoked at most once during the execution:
before running any workloads, and before invocation of ``validate()``, but after it is
clear that this workload will run (i.e. this method will not be invoked for workloads
that have been discovered but have not been scheduled run in the agenda).
This method may be used to perform early resource discovery and initialization. This is invoked
during the initial loading stage and before the device is ready, so cannot be used for any
device-dependent initialization. This method is invoked before the workload instance is
validated.
"""
pass
def initialize(self, context): # pylint: disable=arguments-differ
"""
This method should be used to perform once-per-run initialization of a workload instance, i.e.,
unlike ``setup()`` it will not be invoked on each iteration.
"""
pass
def setup(self, context):
"""
Perform the setup necessary to run the workload, such as copying the necessry files
Perform the setup necessary to run the workload, such as copying the necessary files
to the device, configuring the environments, etc.
This is also the place to perform any on-device checks prior to attempting to execute
@@ -89,6 +96,9 @@ class Workload(Extension):
""" Perform any final clean up for the Workload. """
pass
def finalize(self, context): # pylint: disable=arguments-differ
pass
def __str__(self):
return '<Workload {}>'.format(self.name)