Esempio n. 1
0
    def runpair(self, runner, subject, status='approved', priority='normal'):
        """ Run a specific (runner, subject) pair """
        priority = network.transform_priority(priority)
        self.logger.info(
            "Director got update message for (%r, %r) (%r | %r)" %
            (runner, subject, status, priority)
        )

        self.synchronize()

        runner = kimobjects.kim_obj(runner)
        subject = kimobjects.kim_obj(subject)

        self.check_dependencies_and_push((runner, subject), priority, status)
Esempio n. 2
0
    def new(self, itemid, status='approved', priority='normal', force=False):
        """ New KIM object submitted to web-app """
        priority = network.transform_priority(priority)
        leader = database.get_leader(itemid).lower()
        approved = (status == 'approved')

        self.rsync_kimid(itemid, approved=approved)

        # insert this object into the database
        if database.isuuid(itemid):
            mongodb.insert_one_result(leader, itemid)
        else:
            mongodb.insert_one_object(itemid)

        # pass the message along to the director
        msg = network.director_update_message(
            itemid=itemid, status=status, priority=priority, force=force
        )
        self.send_job('pipeline.tasks.director_run', kwargs=msg)
Esempio n. 3
0
    def result(self, jobid, uuid, status='approved', priority='normal', force=False):
        # got an update request internally, a result or error has come in
        priority = network.transform_priority(priority)
        self.logger.debug("processing jobid %r" % jobid)
        leader = database.uuid_type(uuid)

        # insert the test result into the mongo database
        mongodb.insert_one_result(leader, uuid)

        # sync this test result / error to the webapp
        if not cf.GATEWAY_DISABLE_WRITE_RESULT:
            rsync_tools.gateway_write_result(leader, uuid)
            rsync_tools.ssh_touch_done(leader, uuid)

        # automatically recycle the result back into updates queue to
        # trigger dependency runs by the director (this it not the
        # same as the webapp queue!)
        if leader == 'tr':
            msg = network.director_update_message(
                itemid=uuid, status='approved', priority=priority, force=force
            )
            self.send_job('pipeline.tasks.director_run', kwargs=msg)
Esempio n. 4
0
    def run(self, itemid, status='approved', priority='normal', force=False):
        """
        Complete a matching or dependency task given by `job`. This message
        should be formed by calling `pipeline.network.director_update_message`
        """
        priority = network.transform_priority(priority)
        self.logger.info(
            "Director got update message for %r (%r | %r | %r)" %
            (itemid, status, priority, force)
        )

        # decide what to do with the update request based on what
        # type of object it is
        if database.isuuid(itemid):
            self.process_test_result(uuid=itemid, priority=priority)

        elif database.iskimcode(itemid):
            if status == 'approved':
                self.process_kimcode_approved(itemid, priority)
            if status == 'pending':
                self.process_kimcode_pending(itemid, priority)

        self.logger.info("Director Waiting for message...")