def mark_children_as_incomplete(graph, task): children = tgraph.get_all_children(graph, task) if not children: return graph log(graph).info('pid {}: marking children {} of failed task {}'.format( os.getpid(), children, task)) msg = 'Ancestor task {} failed; task not run'.format(task) for child in children: graph.results[child] = msg tgraph.mark_as_done(graph, child) return graph
def task_error(graph, task, error): tb = traceback.format_exc() msg = 'pid {}: failed task {}: stack {}'.format(os.getpid(), task, tb) log(graph).exception(msg, {'exc_info': error}) graph.results[task] = error graph = tgraph.mark_as_done(graph, task) return mark_children_as_incomplete(graph, task)
def task_success(graph, task, result): log(graph).info('pid {}: finished task {}'.format(os.getpid(), task)) graph.results[task] = result return tgraph.mark_as_done(graph, task)
def task_error(graph, task, error): msg = 'pid {}: failed task {}'.format(os.getpid(), task) logger.exception(msg, {'exc_info': error}) graph.results[task] = error graph = tgraph.mark_as_done(graph, task) return mark_children_as_incomplete(graph, task)