예제 #1
0
    def stop(self):
        """
        Try graceful process shutdown, then kill it
        """
        if not self._proc:
            return

        try:
            self._proc.send_signal(signal.SIGINT)
        except Exception:
            log.debug("Error terminating process", exc_info=True)
            self._proc = None
            return

        # Wait for shutdown for 1 second, with 20 checks
        for ignore in range(20):
            time.sleep(.05)
            if self._proc.poll() is not None:
                self._proc = None
                return

        log.warning("App didn't exit gracefully from SIGINT. Killing...")
        try:
            self._proc.kill()
        finally:
            time.sleep(1)
        self._proc = None
예제 #2
0
 def _find_secret_item_path(self, uuid, hvuri):
     attributes = {
         "uuid": uuid,
         "hvuri": hvuri,
     }
     unlocked, locked = self._service.SearchItems("(a{ss})", attributes)
     if not unlocked:
         if locked:
             log.warning(  # pragma: no cover
                 "Item found, but it's locked")
         return None
     return unlocked[0]
예제 #3
0
    def stop(self):
        """
        Try graceful process shutdown, then kill it
        """
        if not self._proc:
            return

        try:
            self._proc.send_signal(signal.SIGINT)
        except Exception:
            log.debug("Error terminating process", exc_info=True)
            self._proc = None
            return

        if self.wait_for_exit():
            return

        log.warning("App didn't exit gracefully from SIGINT. Killing...")
        self._proc.kill()
        self.wait_for_exit()