pub fn create_engine_for_non_interruptible_tasks(&self) -> Engine<Built> {
        let mut new_graph = self.task_graph.filter_map(
            |node_idx, node| match &self.task_graph[node_idx] {
                TaskNode::Task(task) => {
                    let def = self
                        .task_definitions
                        .get(task)
                        .expect("task should have definition");

                    if def.persistent && !def.interruptible {
                        Some(node.clone())
                    } else {
                        None
                    }
                }
                TaskNode::Root => Some(node.clone()),
            },
            |_, _| Some(()),
        );

        let root_index = new_graph
            .node_indices()
            .find(|index| new_graph[*index] == TaskNode::Root)
            .expect("root node should be present");

        // Connect persistent tasks to root
        for index in new_graph.node_indices() {
            if new_graph[index] == TaskNode::Root {
                continue;
            }

            new_graph.add_edge(index, root_index, ());
        }

        let task_lookup: HashMap<_, _> = new_graph
            .node_indices()
            .filter_map(|index| {
                let task = new_graph
                    .node_weight(index)
                    .expect("node index should be present");
                match task {
                    TaskNode::Root => None,
                    TaskNode::Task(task) => Some((task.clone(), index)),
                }
            })
            .collect();

        Engine {
            marker: std::marker::PhantomData,
            root_index,
            task_graph: new_graph,
            task_lookup,
            task_definitions: self.task_definitions.clone(),
            task_locations: self.task_locations.clone(),
            package_tasks: self.package_tasks.clone(),
            has_non_interruptible_tasks: true,
        }
    }
Creates an `Engine` that is only the tasks that are not interruptible,
i.e. persistent and not allowed to be restarted
crates/turborepo-lib/src/engine/mod.rs