def terminate(self): if self.p: logger.info('terminate runner') try: self.p.terminate() except OSError: pass
def run(self): logger.info('start executor thread') while not self._terminate: self._runner.start() self._runner.wait() logger.info('terminate executor thread')
def run(self): logger.info('start master') self._executor.start() while True: time.sleep(3600) cur_time = time.localtime(time.time()) if self.restart_time <= cur_time.tm_hour < self.restart_time+1: self._executor.restart_runner()
def wait(self): self.p.wait() logger.info('runner killed')
def start(self): logger.info('start runner') self.p = subprocess.Popen(self.cmd, cwd=self.workdir) logger.info('Runner pid is %d' % self.p.pid)