Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    def _handle_wr_GET(self, router, identity, message):
        log.debug("Handing GET for worker %s (message: %r)" % (identity, message), level=7)
        job_uuid = message[0]
        _job = job.select(job_uuid)

        router.send_multipart(
                [
                        identity,
                        b'JOB',
                        (_job.uuid).encode('ascii'),
                        (_job.notification).encode('ascii')
                    ]
            )