1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 02:41:11 +01:00

framework: remove wa.framework.plugin.Artifact

Remove wa.framework.plugin.Artifact and associated references. The name
of the class clashes with the class from output and can potentially
cause confusion.

The original intention for this was to be an "expected artifact
descriptor" of sorts that plugins can specify for validation purposes,
but that functionality was never implemented. Given that the framework
has undergone significant changes since this was implemented, it's not
clear that this is the best way to go about the original goal.

Therefore remove this for now.
This commit is contained in:
Sergei Trofimov 2017-12-06 16:20:35 +00:00 committed by marcbonnici
parent 698c61b0a5
commit 7796dabe90
3 changed files with 0 additions and 108 deletions

View File

@ -34,7 +34,6 @@ from wa.framework.exception import (WAError, ConfigError, TimeoutError,
TargetNotRespondingError, WorkloadError) TargetNotRespondingError, WorkloadError)
from wa.framework.job import Job from wa.framework.job import Job
from wa.framework.output import init_job_output from wa.framework.output import init_job_output
from wa.framework.plugin import Artifact
from wa.framework.processor import ProcessorManager from wa.framework.processor import ProcessorManager
from wa.framework.resource import ResourceResolver from wa.framework.resource import ResourceResolver
from wa.framework.run import RunState from wa.framework.run import RunState

View File

@ -127,98 +127,6 @@ class ListCollection(list):
super(ListCollection, self).__init__() super(ListCollection, self).__init__()
class Artifact(object):
"""
This is an artifact generated during execution/post-processing of a workload.
Unlike metrics, this represents an actual artifact, such as a file, generated.
This may be "result", such as trace, or it could be "meta data" such as logs.
These are distinguished using the ``kind`` attribute, which also helps WA decide
how it should be handled. Currently supported kinds are:
:log: A log file. Not part of "results" as such but contains information
about the run/workload execution that be useful for diagnostics/meta
analysis.
:meta: A file containing metadata. This is not part of "results", but contains
information that may be necessary to reproduce the results
(contrast with ``log`` artifacts which are *not* necessary).
:data: This file contains new data, not available otherwise and should be
considered part of the "results" generated by WA. Most traces
would fall into this category.
:export: Exported version of results or some other artifact. This signifies
that this artifact does not contain any new data that is not
available elsewhere and that it may be safely discarded
without losing information.
:raw: Signifies that this is a raw dump/log that is normally processed to
extract useful information and is then discarded. In a sense, it
is the opposite of ``export``, but in general may also be
discarded.
.. note:: whether a file is marked as ``log``/``data`` or ``raw``
depends on how important it is to preserve this file,
e.g. when archiving, vs how much space it takes up.
Unlike ``export`` artifacts which are (almost) always
ignored by other exporters as that would never result
in data loss, ``raw`` files *may* be processed by
exporters if they decided that the risk of losing
potentially (though unlikely) useful data is greater
than the time/space cost of handling the artifact (e.g.
a database uploader may choose to ignore ``raw``
artifacts, where as a network filer archiver may choose
to archive them).
.. note: The kind parameter is intended to represent the logical function of
a particular artifact, not its intended means of processing --
this is left entirely up to the result processors.
"""
RUN = 'run'
ITERATION = 'iteration'
valid_kinds = ['log', 'meta', 'data', 'export', 'raw']
def __init__(self, name, path, kind, level=RUN, mandatory=False, description=None):
""""
:param name: Name that uniquely identifies this artifact.
:param path: The *relative* path of the artifact. Depending on the ``level``
must be either relative to the run or iteration output directory.
.. note:: this path *must* be delimited using ``/``
irrespective of the operating system.
:param kind: The type of the artifact this is (e.g. log file, result, etc.)
this will be used a hit to result processors. This must be
one of ``'log'``, ``'meta'``, ``'data'``, ``'export'``,
``'raw'``.
:param level: The level at which the artifact will be generated. Must be
either ``'iteration'`` or ``'run'``.
:param mandatory: Boolean value indicating whether this artifact must be
present at the end of result processing for its level.
:param description: A free-form description of what this artifact is.
"""
if kind not in self.valid_kinds:
msg = 'Invalid Artifact kind: {}; must be in {}'
raise ValueError(msg.format(kind, self.valid_kinds))
self.name = name
self.path = path.replace('/', os.sep) if path is not None else path
self.kind = kind
self.level = level
self.mandatory = mandatory
self.description = description
def exists(self, context):
"""
Returns ``True`` if artifact exists within the specified context, and
``False`` otherwise.
"""
fullpath = os.path.join(context.output_directory, self.path)
return os.path.exists(fullpath)
def to_dict(self):
return copy(self.__dict__)
class Alias(object): class Alias(object):
""" """
This represents a configuration alias for an plugin, mapping an alternative This represents a configuration alias for an plugin, mapping an alternative
@ -256,7 +164,6 @@ class PluginMeta(type):
to_propagate = [ to_propagate = [
('parameters', Parameter, AttributeCollection), ('parameters', Parameter, AttributeCollection),
('artifacts', Artifact, AttributeCollection),
] ]
def __new__(mcs, clsname, bases, attrs): def __new__(mcs, clsname, bases, attrs):
@ -381,19 +288,6 @@ class Plugin(object):
for param in self.parameters: for param in self.parameters:
param.validate(self) param.validate(self)
def check_artifacts(self, context, level):
"""
Make sure that all mandatory artifacts have been generated.
"""
for artifact in self.artifacts:
if artifact.level != level or not artifact.mandatory:
continue
fullpath = os.path.join(context.output_directory, artifact.path)
if not os.path.exists(fullpath):
message = 'Mandatory "{}" has not been generated for {}.'
raise ValidationError(message.format(artifact.path, self.name))
def __getattr__(self, name): def __getattr__(self, name):
if name == '_modules': if name == '_modules':
raise ValueError('_modules accessed too early!') raise ValueError('_modules accessed too early!')

View File

@ -21,7 +21,6 @@ import json
from wa import ApkUiautoWorkload, Parameter from wa import ApkUiautoWorkload, Parameter
from wa.framework.exception import ConfigError, WorkloadError from wa.framework.exception import ConfigError, WorkloadError
from wa.framework.plugin import Artifact
from wa.utils.misc import capitalize from wa.utils.misc import capitalize
class Geekbench(ApkUiautoWorkload): class Geekbench(ApkUiautoWorkload):