pub fn tree<'a>(
root: &str,
tasks: impl IntoIterator<Item = &'a Task>,
) -> Vec<LineageNode>Expand description
The tree of the job root, from whichever of tasks belong to it.
A task belongs to the job when its recorded lineage
(Lineage::of_task) names root, or, with none recorded, when its
contextId is root: the job’s first task, which was sent without a
lineage. A task with a malformed lineage is left out, and a task id seen
twice is taken once, the first time.
tasks may come from many agents: ListTasks of each, or their task
tables. A task is attached under its parentTaskId only when that task is
in the set and exactly one level up; otherwise it is a top of its own, as
a child whose parent’s agent was not asked is. So the result is a forest
whose first top is the job’s first task when it was given, and no set of
tasks, forged or inconsistent, makes a cycle: every edge goes one level
deeper. Tops are in (depth, task id) order.