def _worker(): # XXX: this whole thing is an hack - find a better way to # notify task execution failure to all worker threads while not self.stop: task = self.worker_queue.get() try: run_task(self.ctx, task) except yaku.errors.TaskRunFailure: e = get_exception() self.failure_lock.acquire() self.stop = True self.failure_lock.release() task.error_msg = e.explain task.error_cmd = e.cmd self.error_out.put(task) except Exception: e = get_exception() exc_type, exc_value, tb = sys.exc_info() lines = traceback.format_exception(exc_type, exc_value, tb) self.failure_lock.acquire() self.stop = True self.failure_lock.release() task.error_msg = "".join(lines) task.error_cmd = [] self.error_out.put(task) self.worker_queue.task_done()
def _worker(): while True: task = self.worker_queue.get() run_task(self.ctx, task) #task.run() self.worker_queue.task_done()
def run(self): ordered_tasks = order_tasks(self.task_manager.tasks) for t in ordered_tasks: run_task(self.ctx, t)
def run(self): grp = self.task_manager.next_set() while grp: for task in grp: run_task(self.ctx, task) grp = self.task_manager.next_set()