+++ /dev/null
-from __future__ import absolute_import\r
-\r
-from ..common import timeout, TimeoutError\r
-\r
-\r
-class BaseAgent(object):\r
-\r
- measurement = ''\r
-\r
- def __init__(self, mgr_module, obj_sender, timeout=30):\r
- self.data = []\r
- self._client = None\r
- self._client = obj_sender\r
- self._logger = mgr_module.log\r
- self._module_inst = mgr_module\r
- self._timeout = timeout\r
-\r
- def run(self):\r
- try:\r
- self._collect_data()\r
- self._run()\r
- except TimeoutError:\r
- self._logger.error('{} failed to execute {} task'.format(\r
- __name__, self.measurement))\r
-\r
- def __nonzero__(self):\r
- if not self._module_inst:\r
- return False\r
- else:\r
- return True\r
-\r
- @timeout\r
- def _run(self):\r
- pass\r
-\r
- @timeout\r
- def _collect_data(self):\r
- pass\r