Esempio n. 1
0
    def _handle_cr_DONE(self, router, identity, message):
        """
            A collector has indicated it is done performing a job, or
            actually a command for a job.
        """
        if conf.debuglevel > 7:
            log.debug("Handling DONE for identity %s (message: %r)" % (identity, message), level=8)
        elif conf.debuglevel > 6:
            log.debug("Handling DONE for identity %s (message: %r)" % (identity, message[:-1]), level=7)

        job_uuid = message[0]
        log.info("Job %s DONE by %s" % (job_uuid, identity))

        notification = message[1]

        job.update(
                job_uuid,
                state = b'PENDING',
                job_type = 'worker',
                notification = notification,
                cmd = None
            )

        collector.update(
                identity,
                state = b'READY',
                job = None
            )

        self._send_collector_job(identity)
Esempio n. 2
0
    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
            )
Esempio n. 3
0
def update_job(job_id,
               name,
               users,
               keywords,
               geoboxes,
               username,
               yakmarkers=[],
               public=None,
               crisisflag=None,
               sources=[]):
    """ This sets all of the properties of the specified job with the arguments.

    :param job_id: The job to update
    :param name: The new name of the job
    :param users: The new users for the job to track
    :param keywords: The new keywords for the job to track
    :param geoboxes: The new geoboxes for the job to track
    :param username: The username of the user seeking to update the job
	:param sources: The sources from which the job should be crawled
    :return:
    """
    mongo_response = job.update(username_to_id(username), job_id, name,
                                keywords, users, geoboxes, yakmarkers, public,
                                crisisflag, sources)
    if mongo_response is None:
        abort(400)
    else:
        log = logging.getLogger()
        log.error(username + ' ' + 'Job_Updation ' + str(name) + ' ' +
                  str(job_id))
        return jsonify({"status": "ok"})
Esempio n. 4
0
    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)
Esempio n. 5
0
    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)