def _handle_wcr_STATE(self, router, identity, message): log.debug("Handing STATE for identity %s (message: %r)" % (identity, message), level=7) state = message[0] if state == b'BUSY': job_uuid = message[1] _job = job.select(job_uuid) if not _job == None: _job_id = _job.id else: _job_id = None state = b'READY' worker.update( identity, state = state, job = _job_id ) else: worker.update( identity, state = state, job = None ) if state == b'READY': self._send_worker_job(identity)
def _handle_wcr_UNKNOWN(self, router, identity, message): job_uuid = message[0] job.update( job_uuid, state = b'FAILED' ) worker.update( identity, state = b'READY', job = None )
def _handle_wcr_DONE(self, router, identity, message): log.debug("Handing DONE for identity %s (message: %r)" % (identity, message), level=7) job_uuid = message[0] log.info("Job %s DONE by %s" % (job_uuid, identity)) job.update( job_uuid, state = b'DONE' ) worker.update( identity, state = b'READY', job = None ) self._send_worker_job(identity)
def _handle_wcr_COLLECT(self, router, identity, message): log.debug("Handing COLLECT for identity %s (message: %r)" % (identity, message[:-1]), level=7) commands = message[0] job_uuid = message[1] notification = message[2] log.info("Job %s COLLECT by %s" % (job_uuid, identity)) job.update( job_uuid, cmd = commands, state = b'PENDING', job_type = 'collector', notification = notification ) worker.update( identity, state = b'READY', job = None ) self._send_worker_job(identity)