"get_update_every" method added to SimpleService
lgz committed
Oct 22, 2017 at 02:36 UTC
4a46163c2f68120ddb82d3b528c37e1a3e725688
2 files changed
+8
-5
python.d/python_modules/bases/FrameworkServices/SimpleService.py
+4
-1
@@ -65,7 +65,7 @@ class SimpleService(Thread, PythonDLimitedLogger, OldVersionCompatibility, objec
65
self._runtime_counters = RuntimeCounters(configuration=configuration)
66
self.charts = Charts(job_name=self.actual_name,
67
priority=configuration.pop('priority'),
68
- update_every=self.update_every)
68
+ get_update_every=self.get_update_every)
69
70
def __repr__(self):
71
return '<{cls_bases}: {name}>'.format(cls_bases=', '.join(c.__name__ for c in self.__class__.__bases__),
@@ -92,6 +92,9 @@ class SimpleService(Thread, PythonDLimitedLogger, OldVersionCompatibility, objec
92
"""
93
self._runtime_counters.FREQ = value
94
95
+ def get_update_every(self):
96
+ return self.update_every
97
+
98
def check(self):
99
"""
100
check() prototype
python.d/python_modules/bases/charts.py
+4
-4
@@ -71,15 +71,15 @@ class Charts:
71
All charts stored in a dict.
72
Chart is a instance of Chart class.
73
Charts adding must be done using Charts.add_chart() method only"""
74
- def __init__(self, job_name, priority, update_every):
74
+ def __init__(self, job_name, priority, get_update_every):
75
"""
76
:param job_name: <bound method>
77
:param priority: <int>
78
- :param update_every: <int>
78
+ :param get_update_every: <bound method>
79
"""
80
self.job_name = job_name
81
self.priority = priority
82
- self.update_every = update_every
82
+ self.get_update_every = get_update_every
83
self.charts = dict()
84
85
def __len__(self):
@@ -127,7 +127,7 @@ class Charts:
127
raise DuplicateItemError("'{chart}' already in charts".format(chart=chart_id))
128
else:
129
new_chart = Chart(params)
130
- new_chart.params['update_every'] = self.update_every
130
+ new_chart.params['update_every'] = self.get_update_every()
131
new_chart.params['priority'] = self.priority
132
self.priority += 1
133
self.charts[new_chart.params['id']] = new_chart