mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-02 19:32:34 +01:00
fw/exec: Add add_classifier() method
Add add_classifier() method to context. Allow plugins to add classifiers to the current job, or the run as a whole. This will ensure that the new classifiers are propagated to all relevant current and future artifacts and metrics.
This commit is contained in:
committed by
Marc Bonnici
parent
796f62d924
commit
659e60414f
@@ -165,6 +165,9 @@ class Output(object):
|
||||
artifact = self.get_artifact(name)
|
||||
return self.get_path(artifact.path)
|
||||
|
||||
def add_classifier(self, name, value, overwrite=False):
|
||||
self.result.add_classifier(name, value, overwrite)
|
||||
|
||||
def add_metadata(self, key, *args, **kwargs):
|
||||
self.result.add_metadata(key, *args, **kwargs)
|
||||
|
||||
@@ -410,6 +413,21 @@ class Result(Podable):
|
||||
return artifact
|
||||
raise HostError('Artifact "{}" not found'.format(name))
|
||||
|
||||
def add_classifier(self, name, value, overwrite=False):
|
||||
if name in self.classifiers and not overwrite:
|
||||
raise ValueError('Cannot overwrite "{}" classifier.'.format(name))
|
||||
self.classifiers[name] = value
|
||||
|
||||
for metric in self.metrics:
|
||||
if name in metric.classifiers and not overwrite:
|
||||
raise ValueError('Cannot overwrite "{}" classifier; clashes with {}.'.format(name, metric))
|
||||
metric.classifiers[name] = value
|
||||
|
||||
for artifact in self.artifacts:
|
||||
if name in artifact.classifiers and not overwrite:
|
||||
raise ValueError('Cannot overwrite "{}" classifier; clashes with {}.'.format(name, artifact))
|
||||
artifact.classifiers[name] = value
|
||||
|
||||
def add_metadata(self, key, *args, **kwargs):
|
||||
force = kwargs.pop('force', False)
|
||||
if kwargs:
|
||||
|
Reference in New Issue
Block a user