def sig_handler(self, sig): for prc, cln in self._clients.items(): try: if not cln.is_finished() and cln.conn: cln.conn.send(ClientStop()) if sig == signal.SIGTERM: prc.cancel() except Exception as e: print("Sent stop to client {} error {}".format(cln.name, e), file=self._out_file)
def sig_handler(self, sig): self._logger.debug("sig_handler sig {}".format(sig)) for prc, cln in self._clients.items(): self._logger.debug("sig_handler prc {} cln {}".format(prc, cln)) try: if not cln.is_finished() and cln.conn: cln.conn.send(ClientStop()) if sig == signal.SIGTERM: prc.cancel() except Exception as e: self._logger.exception( "Sent stop to client {} error {}".format(cln.name, e))