irrad_control/main.py
def closeEvent(self, event):
        """Catches closing event and invokes customized closing routine"""

        # Indicate that we want to close
        self._try_close = True

        if any(val for val in self._cmd_reply.values()):

            if not self._log_close:
                for host in self._cmd_reply:
                    if self._cmd_reply[host]:
                        msg = "Waiting for reply from {} with command ID(s): {}".format(host, ', '.join([str(i) for i in self._cmd_reply[host]]))
                        logging.warning(msg)

                logging.warning("{} will be closed after all remaining replies have been received".format(PROJECT_NAME))
                self._log_close = True

            # Ignore closing
            event.ignore()

        # There are subprocesses to shut down
        elif self.proc_mngr.current_procs:

            # If we're here, there's no more processecs; we will launch closing workers, they should not give warning to user
            self._log_close = True

            # Loop over all started processes and send shutdown cmd
            for host in self.proc_mngr.current_procs:

                # Shutdown all the servers
                if host in self.setup['server']:
                    logging.info("Shutting down server at {}".format(host))
                    # FIXME: server does not always send a reply https://github.com/zeromq/libzmq/issues/1264
                    self.proc_mngr.current_procs.remove(host)
                    self.send_cmd(host, 'server', 'shutdown', check_reply=False)

                # Shutdown interpreter
                if host == 'localhost':
                    logging.info("Shutting down interpreter...")
                    self.send_cmd(host, 'interpreter', 'shutdown')

                # Ignore closing
                event.ignore()

        else:

            self._clean_up()

            # Close
            event.accept()
Catches closing event and invokes customized closing routine
Catches closing event and invokes customized closing routine
Catches closing event and invokes customized closing routine
def closeEvent(self, event):
        self._try_close = True
        if any(val for val in self._cmd_reply.values()):
            if not self._log_close:
                for host in self._cmd_reply:
                    if self._cmd_reply[host]:
                        msg = "Waiting for reply from {} with command ID(s): {}".format(host, ', '.join([str(i) for i in self._cmd_reply[host]]))
                        logging.warning(msg)
                logging.warning("{} will be closed after all remaining replies have been received".format(PROJECT_NAME))
                self._log_close = True
            event.ignore()
        elif self.proc_mngr.current_procs:
            self._log_close = True
            for host in self.proc_mngr.current_procs:
                if host in self.setup['server']:
                    logging.info("Shutting down server at {}".format(host))
                    self.proc_mngr.current_procs.remove(host)
                    self.send_cmd(host, 'server', 'shutdown', check_reply=False)
                if host == 'localhost':
                    logging.info("Shutting down interpreter...")
                    self.send_cmd(host, 'interpreter', 'shutdown')
                event.ignore()
        else:
            self._clean_up()
            event.accept()
def closeEvent ( self , event ) : self . _try_close = True if any ( val for val in self . _cmd_reply . values ( ) ) : if not self . _log_close : for host in self . _cmd_reply : if self . _cmd_reply [ host ] : msg = "Waiting for reply from {} with command ID(s): {}" . format ( host , ', ' . join ( [ str ( i ) for i in self . _cmd_reply [ host ] ] ) ) logging . warning ( msg ) logging . warning ( "{} will be closed after all remaining replies have been received" . format ( PROJECT_NAME ) ) self . _log_close = True event . ignore ( ) elif self . proc_mngr . current_procs : self . _log_close = True for host in self . proc_mngr . current_procs : if host in self . setup [ 'server' ] : logging . info ( "Shutting down server at {}" . format ( host ) ) self . proc_mngr . current_procs . remove ( host ) self . send_cmd ( host , 'server' , 'shutdown' , check_reply = False ) if host == 'localhost' : logging . info ( "Shutting down interpreter..." ) self . send_cmd ( host , 'interpreter' , 'shutdown' ) event . ignore ( ) else : self . _clean_up ( ) event . accept ( )
Catches closing event and invokes customized closing routine
Catches closing event and invokes customized closing routine
"""Catches closing event and invokes customized closing routine""" # Indicate that we want to close # Ignore closing # There are subprocesses to shut down # If we're here, there's no more processecs; we will launch closing workers, they should not give warning to user # Loop over all started processes and send shutdown cmd # Shutdown all the servers # FIXME: server does not always send a reply https://github.com/zeromq/libzmq/issues/1264 # Shutdown interpreter # Ignore closing # Close
self
event