mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-22 10:38:37 +00:00
commands/process: improve logging
- Add a logging to indicate what is being processed. - Log to file.
This commit is contained in:
parent
0a5ceabc73
commit
8a219d0e5a
@ -20,6 +20,7 @@ from wa import discover_wa_outputs
|
|||||||
from wa.framework.exception import CommandError
|
from wa.framework.exception import CommandError
|
||||||
from wa.framework.output import RunOutput
|
from wa.framework.output import RunOutput
|
||||||
from wa.framework.output_processor import ProcessorManager
|
from wa.framework.output_processor import ProcessorManager
|
||||||
|
from wa.utils import log
|
||||||
|
|
||||||
class ProcessContext(object):
|
class ProcessContext(object):
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ class ProcessCommand(Command):
|
|||||||
output_list = [RunOutput(process_directory)]
|
output_list = [RunOutput(process_directory)]
|
||||||
else:
|
else:
|
||||||
output_list = [output for output in discover_wa_outputs(process_directory)]
|
output_list = [output for output in discover_wa_outputs(process_directory)]
|
||||||
|
|
||||||
pc = ProcessContext()
|
pc = ProcessContext()
|
||||||
for run_output in output_list:
|
for run_output in output_list:
|
||||||
if not args.recursive:
|
if not args.recursive:
|
||||||
@ -78,6 +80,14 @@ class ProcessCommand(Command):
|
|||||||
else:
|
else:
|
||||||
self.logger.info('Install output processors for run in path `{}`'
|
self.logger.info('Install output processors for run in path `{}`'
|
||||||
.format(run_output.basepath))
|
.format(run_output.basepath))
|
||||||
|
|
||||||
|
logfile = os.path.join(run_output.basepath, 'process.log')
|
||||||
|
i = 0
|
||||||
|
while os.path.exists(logfile):
|
||||||
|
i += 1
|
||||||
|
logfile = os.path.join(run_output.basepath, 'process-{}.log'.format(i))
|
||||||
|
log.add_file(logfile)
|
||||||
|
|
||||||
pm = ProcessorManager(loader=config.plugin_cache)
|
pm = ProcessorManager(loader=config.plugin_cache)
|
||||||
for proc in config.get_processors():
|
for proc in config.get_processors():
|
||||||
pm.install(proc, None)
|
pm.install(proc, None)
|
||||||
@ -89,8 +99,10 @@ class ProcessCommand(Command):
|
|||||||
pm.get_output_processor(proc)
|
pm.get_output_processor(proc)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pm.install(proc, None)
|
pm.install(proc, None)
|
||||||
|
|
||||||
pm.validate()
|
pm.validate()
|
||||||
pm.initialize()
|
pm.initialize()
|
||||||
|
|
||||||
pc.run_output = run_output
|
pc.run_output = run_output
|
||||||
pc.target_info = run_output.target_info
|
pc.target_info = run_output.target_info
|
||||||
for job_output in run_output.jobs:
|
for job_output in run_output.jobs:
|
||||||
@ -102,8 +114,13 @@ class ProcessCommand(Command):
|
|||||||
pm.disable(augmentation)
|
pm.disable(augmentation)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
msg = 'Processing job {} {} iteration {}'
|
||||||
|
self.logger.info(msg.format(job_output.id, job_output.label,
|
||||||
|
job_output.iteration))
|
||||||
pm.process_job_output(pc)
|
pm.process_job_output(pc)
|
||||||
pm.export_job_output(pc)
|
pm.export_job_output(pc)
|
||||||
|
|
||||||
pm.enable_all()
|
pm.enable_all()
|
||||||
if not args.force:
|
if not args.force:
|
||||||
for augmentation in run_output.augmentations:
|
for augmentation in run_output.augmentations:
|
||||||
@ -111,6 +128,10 @@ class ProcessCommand(Command):
|
|||||||
pm.disable(augmentation)
|
pm.disable(augmentation)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
self.logger.info('Processing run')
|
||||||
pm.process_run_output(pc)
|
pm.process_run_output(pc)
|
||||||
pm.export_run_output(pc)
|
pm.export_run_output(pc)
|
||||||
pm.finalize()
|
pm.finalize()
|
||||||
|
|
||||||
|
self.logger.info('Done.')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user