diff options
author | Ilya Mashchenko <ilyamaschenko@gmail.com> | 2019-03-10 22:20:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-10 22:20:43 +0300 |
commit | 0c0534b92e9a57167b6b32f14d4929c5632bff06 (patch) | |
tree | c4bb0eef7177020fc81b68136f20cfe386366475 | |
parent | d2a183e9c0008937b93f918d41d188b8f46caa3a (diff) |
SimpleService cleanup: do not inherit from OldVersionCompatibility (#5594)
<!--
Describe the change in summary section, including rationale and degin decisions.
Include "Fixes #nnn" if you are fixing an existing issue.
In "Component Name" section write which component is changed in this PR. This
will help us review your PR quicker.
If you have more information you want to add, write them in "Additional
Information" section. This is usually used to help others understand your
motivation behind this change. A step-by-step reproduction of the problem is
helpful if there is no related issue.
-->
##### Summary
python SimpleService cleanup 1 - remove OldVersionCompatibility
##### Component Name
[`collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService`](collectors/python.d.plugin/python_modules/bases/FrameworkServices)
##### Additional Information
it is dead code, no longer supported
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py | 5 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/collection.py | 61 |
2 files changed, 2 insertions, 64 deletions
diff --git a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py index 7328c4dc17..4c1d6ba642 100644 --- a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py +++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py @@ -10,7 +10,7 @@ from time import sleep, time from third_party.monotonic import monotonic from bases.charts import Charts, ChartError, create_runtime_chart -from bases.collection import OldVersionCompatibility, safe_print +from bases.collection import safe_print from bases.loggers import PythonDLimitedLogger RUNTIME_CHART_UPDATE = 'BEGIN netdata.runtime_{job_name} {since_last}\n' \ @@ -55,7 +55,7 @@ class RuntimeCounters: self.penalty = round(min(self.retries * self.update_every / 2, MAX_PENALTY)) -class SimpleService(PythonDLimitedLogger, OldVersionCompatibility, object): +class SimpleService(PythonDLimitedLogger, object): """ Prototype of Service class. Implemented basic functionality to run jobs by `python.d.plugin` @@ -66,7 +66,6 @@ class SimpleService(PythonDLimitedLogger, OldVersionCompatibility, object): :param name: <str> """ PythonDLimitedLogger.__init__(self) - OldVersionCompatibility.__init__(self) self.configuration = configuration self.order = list() self.definitions = dict() diff --git a/collectors/python.d.plugin/python_modules/bases/collection.py b/collectors/python.d.plugin/python_modules/bases/collection.py index 479a3b6100..7a3390bc69 100644 --- a/collectors/python.d.plugin/python_modules/bases/collection.py +++ b/collectors/python.d.plugin/python_modules/bases/collection.py @@ -82,64 +82,3 @@ def read_last_line(f): break result = opened.readline() return result.decode() - - -class OldVersionCompatibility: - - def __init__(self): - self._data_stream = str() - - def begin(self, type_id, microseconds=0): - """ - :param type_id: <str> - :param microseconds: <str> or <int>: must be a digit - :return: - """ - self._data_stream += CHART_BEGIN.format(type_id, microseconds) - - def set(self, dim_id, value): - """ - :param dim_id: <str> - :param value: <int> or <str>: must be a digit - :return: - """ - self._data_stream += DIMENSION_SET.format(dim_id, value) - - def end(self): - self._data_stream += 'END\n' - - def chart(self, type_id, name='', title='', units='', family='', category='', chart_type='line', - priority='', update_every=''): - """ - :param type_id: <str> - :param name: <str> - :param title: <str> - :param units: <str> - :param family: <str> - :param category: <str> - :param chart_type: <str> - :param priority: <str> or <int> - :param update_every: <str> or <int> - :return: - """ - self._data_stream += CHART_CREATE.format(type_id, name, title, units, - family, category, chart_type, - priority, update_every) - - def dimension(self, dim_id, name=None, algorithm="absolute", multiplier=1, divisor=1, hidden=False): - """ - :param dim_id: <str> - :param name: <str> or None - :param algorithm: <str> - :param multiplier: <str> or <int>: must be a digit - :param divisor: <str> or <int>: must be a digit - :param hidden: <str>: literally "hidden" or "" - :return: - """ - self._data_stream += DIMENSION_CREATE.format(dim_id, name or dim_id, algorithm, - multiplier, divisor, hidden or str()) - - @on_try_except_finally(on_except=(exit, 1)) - def commit(self): - print(self._data_stream) - self._data_stream = str() |