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

framework/job: Include job iteration in log messages

This commit is contained in:
Brendan Jackman 2017-10-19 16:08:36 +01:00
parent 73f863f281
commit 138ed1495e

View File

@ -55,23 +55,23 @@ class Job(object):
self.workload = self._workload_cache[self.id] self.workload = self._workload_cache[self.id]
def initialize(self, context): def initialize(self, context):
self.logger.info('Initializing job {}'.format(self.id)) self.logger.info('Initializing job {} [{}]'.format(self.id, self.iteration))
with signal.wrap('WORKLOAD_INITIALIZED', self, context): with signal.wrap('WORKLOAD_INITIALIZED', self, context):
self.workload.initialize(context) self.workload.initialize(context)
self.set_status(Status.PENDING) self.set_status(Status.PENDING)
context.update_job_state(self) context.update_job_state(self)
def configure_target(self, context): def configure_target(self, context):
self.logger.info('Configuring target for job {}'.format(self.id)) self.logger.info('Configuring target for job {} [{}]'.format(self.id, self.iteration))
context.tm.commit_runtime_parameters(self.spec.runtime_parameters) context.tm.commit_runtime_parameters(self.spec.runtime_parameters)
def setup(self, context): def setup(self, context):
self.logger.info('Setting up job {}'.format(self.id)) self.logger.info('Setting up job {} [{}]'.format(self.id, self.iteration))
with signal.wrap('WORKLOAD_SETUP', self, context): with signal.wrap('WORKLOAD_SETUP', self, context):
self.workload.setup(context) self.workload.setup(context)
def run(self, context): def run(self, context):
self.logger.info('Running job {}'.format(self.id)) self.logger.info('Running job {} [{}]'.format(self.id, self.iteration))
with signal.wrap('WORKLOAD_EXECUTION', self, context): with signal.wrap('WORKLOAD_EXECUTION', self, context):
start_time = datetime.utcnow() start_time = datetime.utcnow()
try: try:
@ -80,7 +80,7 @@ class Job(object):
self.run_time = datetime.utcnow() - start_time self.run_time = datetime.utcnow() - start_time
def process_output(self, context): def process_output(self, context):
self.logger.info('Processing output for job {}'.format(self.id)) self.logger.info('Processing output for job {} [{}]'.format(self.id, self.iteration))
with signal.wrap('WORKLOAD_RESULT_EXTRACTION', self, context): with signal.wrap('WORKLOAD_RESULT_EXTRACTION', self, context):
self.workload.extract_results(context) self.workload.extract_results(context)
context.extract_results() context.extract_results()
@ -88,12 +88,12 @@ class Job(object):
self.workload.update_output(context) self.workload.update_output(context)
def teardown(self, context): def teardown(self, context):
self.logger.info('Tearing down job {}'.format(self.id)) self.logger.info('Tearing down job {} [{}]'.format(self.id, self.iteration))
with signal.wrap('WORKLOAD_TEARDOWN', self, context): with signal.wrap('WORKLOAD_TEARDOWN', self, context):
self.workload.teardown(context) self.workload.teardown(context)
def finalize(self, context): def finalize(self, context):
self.logger.info('Finalizing job {}'.format(self.id)) self.logger.info('Finalizing job {} [{}]'.format(self.id, self.iteration))
with signal.wrap('WORKLOAD_FINALIZED', self, context): with signal.wrap('WORKLOAD_FINALIZED', self, context):
self.workload.finalize(context) self.workload.finalize(context)