def start(self):
        """Start the master loop and get messages from the requests queue.
        The command messages are lists where the first element is the
        actual command, followed by the command parameters.
        """

        handlers = {
            "EXIT": self._handle_exit,
            "JOBS": self._handle_jobs,
            "SUBMIT": self._handle_submit,
            "WAIT": self._handle_wait,
            "DONE": self._handle_done,
            "FAILED": self._handle_failed,
            "CANCEL": self._handle_cancel,
        }

        while True:
            if self.wait_mode and self._num_jobs() == 0:
                break
            try:
                msg = self.requests.get()
            except __HOLE__ as err:
                self.log.warn("Server process canceled")
                continue
            self.log.debug("Master | received command: %s", msg)
            try:
                command = msg[0]
                handler = handlers[command]
                if not handler(*msg):
                    break
            except Exception as err:
                self.log.error("Master | error while handling message %s : %s",
                               msg, str(err), exc_info=True)
                break
        self.log.info("Master | Master loop terminated")
dataset/ETHPy150Open thasso/pyjip/jip/grids.py/_GridMaster.start