def checkWorkerHeartbeat(events): for worker in API.getWorkers(): if (datetime.now() - worker.heartbeat) > WORKER_HEARTBEAT_TIMEOUT: for schedule in API.getSchedules(worker): schedule.worker = API.getNextWorker() API.destroyWorker(worker) events.enter(WORKER_HEARTBEAT_TIMEOUT.total_seconds(), 1, checkWorkerHeartbeat, (events,))
def signal_handler(signal, frame): global worker API.destroyWorker(worker) sys.exit(0)