def exec_tasks(method_name, tasks, abort, term): threads = [] for task in tasks: if abort.is_set() or term.is_set(): break thread = getattr(task, method_name)(abort) threads.append(thread) for thread in threads: thread_wait(thread, abort) if thread.exc_info is not None: raise Exception('Caught exception while executing task %s: %s' % (thread.target, thread.exc_info))
def exec_tasks(method_name, task_order, tasks, abort, term): task_ids = {task.id: task for task in tasks} for task_id in task_order: if abort.is_set() or term.is_set(): break task = task_ids.pop(task_id) thread = getattr(task, method_name)(abort) thread_wait(thread, abort) if thread.exc_info is not None: raise Exception('Caught exception while executing task %s: %s' % (task, thread.exc_info)) else: assert not task_ids, ("SequentialExecTask has children that are not " "in its task_order: %s" % (task_ids,))