def _tryToStart(self):
     self.robotName = self._getRobotName()
     if self.robotName is None:
         self.retryCount += 1
         qi.async(self._tryToStart, delay=5 * 1000 * 1000 * self.retryCount)
         return
     with self.lock:
         if self.running:
             self.stop()
         host = self._get_pref('host')
         if host is not None:
             tag = self._get_pref('tag', 'pepper')
             sender.setup(tag, host=host,
                          port=int(self._get_pref('port', '24224')))
             self.running = True
             interval = self._get_pref('metrics_interval',
                                       str(DEFAULT_METRICS_INTERVAL))
             self.metricsInterval = max(int(interval), MIN_METRICS_INTERVAL)
             metrics_conf = {'interval_sec': self.metricsInterval}
             self.sendEvent('service', {'status': 'started',
                                        'config': metrics_conf,
                                        'retried': self.retryCount})
             self.sendEvent('cpu_info', cpu_stat.cpu_info())
     self._startWatchingLogs()
     self._sendMetrics()
Exemplo n.º 2
0
 def test_cpu_info(self):
     values = cpu_stat.cpu_info()
     self.assertTrue(len(values) > 0, values)