# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from __future__ import absolute_import
import pkg_resources
import logging
import multiprocessing
class MonitorMgr(object):
"""docstring for MonitorMgr"""
+
def __init__(self):
self._monitor_list = []
def init_monitors(self, monitor_cfgs, context):
- LOG.debug("monitorMgr config: %s" % monitor_cfgs)
+ LOG.debug("monitorMgr config: %s", monitor_cfgs)
for monitor_cfg in monitor_cfgs:
monitor_type = monitor_cfg["monitor_type"]
@staticmethod
def get_monitor_cls(monitor_type):
- '''return monitor class of specified type'''
+ """return monitor class of specified type"""
for monitor in utils.itersubclasses(BaseMonitor):
if monitor_type == monitor.__monitor_type__:
return os.path.join(base_path, path)
def run(self):
- LOG.debug("config:%s context:%s" % (self._config, self._context))
+ LOG.debug("config:%s context:%s", self._config, self._context)
self.setup()
monitor_time = self._config.get("monitor_time", 0)
total_time = end_time - begin_time
self._queue.put({"total_time": total_time,
- "outage_time": last_outage-first_outage,
+ "outage_time": last_outage - first_outage,
"total_count": total_count,
"outage_count": outage_count})
def wait_monitor(self):
self.join()
self._result = self._queue.get()
- LOG.debug("the monitor result:%s" % self._result)
+ LOG.debug("the monitor result:%s", self._result)
def setup(self): # pragma: no cover
pass