How to use the asu.utils.worker.Worker function in asu

To help you get started, we’ve selected a few asu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aparcar / attendedsysupgrade-server / asu / utils / boss.py View on Github external
def run(self):
        workers = []
        for worker_location in self.config.get("worker", []):
            worker = Worker(worker_location, "image", self.build_queue)
            worker.start()
            workers.append(worker)

        self.log.info("Active workers are %s", workers)

        while True:
            build_job = self.database.get_build_job()
            if build_job:
                self.log.info("Found build job %s", build_job)
                self.build_queue.put(build_job)
            else:
                time.sleep(10)
github aparcar / attendedsysupgrade-server / asu / utils / updater.py View on Github external
def run(self):
        location = self.config.get("updater_dir", "updater")
        Worker(location, None, None).setup_meta()
        workers = []

        # start all workers
        for i in range(0, self.config.get("updater_threads", 4)):
            log.info("starting updater thread {}".format(i))
            worker = Worker(location, "update", self.update_queue)
            worker.start()
            workers.append(worker)

        while True:
            outdated_target = self.database.get_outdated_target()
            if outdated_target:
                log.info("found outdated target %s", outdated_target)
                self.update_queue.put(outdated_target)
            else:
                time.sleep(5)
github aparcar / attendedsysupgrade-server / asu / utils / updater.py View on Github external
def run(self):
        location = self.config.get("updater_dir", "updater")
        Worker(location, None, None).setup_meta()
        workers = []

        # start all workers
        for i in range(0, self.config.get("updater_threads", 4)):
            log.info("starting updater thread {}".format(i))
            worker = Worker(location, "update", self.update_queue)
            worker.start()
            workers.append(worker)

        while True:
            outdated_target = self.database.get_outdated_target()
            if outdated_target:
                log.info("found outdated target %s", outdated_target)
                self.update_queue.put(outdated_target)
            else:
                time.sleep(5)