Ejemplo n.º 1
0
 def is_alive(self):
     """Check if the rpc server is alive."""
     try:
         return self.ping() == "pong"
     except Exception as err:  # noqa
         logging.exception_warning("AutomationServer: not alive", err)
         return False
Ejemplo n.º 2
0
 def device(self):
     if self._device is not None:
         dev = self._device
         self._device = None
         try:
             dev.close()
         except Exception as ex:
             logging.exception_warning("device close", ex)
Ejemplo n.º 3
0
 def initializer(self):
     if self._initializer is not None:
         dev = self._initializer
         self._initializer = None
         try:
             dev.close()
         except Exception as ex:
             logging.exception_warning("initializer close", ex)
Ejemplo n.º 4
0
 def close(self):
     while self._used:
         serno, coproc = self._used.popitem()
         try:
             coproc.interrupt()
             coproc.wait()
         except Exception as ex:
             logging.exception_warning("MonsoonService: error in close:",
                                       ex)
     self._server = None
Ejemplo n.º 5
0
 def clear(self):
     """Close any attached controllers.
     """
     if self._device is not None:
         try:
             self._device.close()
         except Exception as err:
             logging.exception_warning(
                 "device close: {!r}".format(self._device), err)
         self._device = None
     if self._initializer is not None:
         try:
             self._initializer.close()
         except Exception as err:
             logging.exception_warning(
                 "initializer close: {!r}".format(self._initializer), err)
         self._initializer = None
     if self._console is not None:
         try:
             self._console.close()
         except Exception as err:
             logging.exception_warning(
                 "console close: {!r}".format(self._initializer), err)
         self._console = None