diff options
Diffstat (limited to 'qtip/base')
-rw-r--r-- | qtip/base/__init__.py | 19 | ||||
-rw-r--r-- | qtip/base/constant.py | 26 | ||||
-rw-r--r-- | qtip/base/error.py | 11 |
3 files changed, 27 insertions, 29 deletions
diff --git a/qtip/base/__init__.py b/qtip/base/__init__.py index e69de29b..909703ed 100644 --- a/qtip/base/__init__.py +++ b/qtip/base/__init__.py @@ -0,0 +1,19 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corp and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +class BaseActor(object): + """abstract actor class""" + + def __init__(self, config, parent=None): + self._config = config + self._parent = parent + + def get_config(self, key, default=None): + return self._config.get(key, default) diff --git a/qtip/base/constant.py b/qtip/base/constant.py index ddd07e9d..09c635ac 100644 --- a/qtip/base/constant.py +++ b/qtip/base/constant.py @@ -34,6 +34,8 @@ class BaseProp(object): # content DESCRIPTION = 'description' + WORKLOADS = 'workloads' + TYPE = 'type' class SpecProp(BaseProp): @@ -45,29 +47,5 @@ class SpecProp(BaseProp): WORKLOADS = 'workloads' -class PlanProp(BaseProp): - # plan - INFO = 'info' - - FACILITY = 'facility' - ENGINEER = 'engineer' - - CONFIG = 'config' - - DRIVER = 'driver' - COLLECTOR = 'collector' - REPORTER = 'reporter' - - QPIS = 'QPIs' - - -class CollectorProp(BaseProp): - LOGS = 'logs' - FILENAME = 'filename' - GREP = 'grep' - REGEX = 'regex' - CAPTURE = 'capture' - - class ReporterBaseProp(BaseProp): TRANSFORMER = 'transformer' diff --git a/qtip/base/error.py b/qtip/base/error.py index 01a7f7a6..a055aa8d 100644 --- a/qtip/base/error.py +++ b/qtip/base/error.py @@ -8,22 +8,23 @@ ############################################################################## -class QtipError(Exception): +class BaseError(Exception): pass -class InvalidFormat(QtipError): - def __init__(self, filename): +class InvalidContent(BaseError): + def __init__(self, filename, excinfo=None): self.filename = filename + self.excinfo = excinfo -class NotFound(QtipError): +class NotFound(BaseError): def __init__(self, module, package='qtip'): self.package = package self.module = module -class ToBeDoneError(QtipError): +class ToBeDoneError(BaseError): """something still to be done""" def __init__(self, method, module): self.method = method |