57 def make_pending(maximals: List[Document.Node.Name]): List[Document.Node.Name] = |
57 def make_pending(maximals: List[Document.Node.Name]): List[Document.Node.Name] = |
58 { |
58 { |
59 val pending = maximals.filterNot(finished) |
59 val pending = maximals.filterNot(finished) |
60 if (pending.isEmpty || pending.tail.isEmpty) pending |
60 if (pending.isEmpty || pending.tail.isEmpty) pending |
61 else { |
61 else { |
62 val depth = dep_graph.node_depth |
62 val depth = dep_graph.node_depth(_ => 1) |
63 pending.sortBy(node => - depth(node)) |
63 pending.sortBy(node => - depth(node)) |
64 } |
64 } |
65 } |
65 } |
66 |
66 |
67 def load_checkpoints(checkpoints: List[Document.Node.Name]): (Load, Load_State) = |
67 def load_checkpoints(checkpoints: List[Document.Node.Name]): (Load, Load_State) = |
76 else if (limit == 0) { |
76 else if (limit == 0) { |
77 val requirements = dep_graph.all_preds(pending).reverse |
77 val requirements = dep_graph.all_preds(pending).reverse |
78 ((requirements, share_common_data), Load_Bulk(pending, Nil, checkpoints)) |
78 ((requirements, share_common_data), Load_Bulk(pending, Nil, checkpoints)) |
79 } |
79 } |
80 else { |
80 else { |
81 def count(node: Document.Node.Name): Boolean = !finished(node) |
81 def count(node: Document.Node.Name): Int = if (finished(node)) 0 else 1 |
82 val reachable = dep_graph.reachable_limit(limit, count _, dep_graph.imm_preds, pending) |
82 val reachable = dep_graph.reachable_limit(limit, count _, dep_graph.imm_preds, pending) |
83 val (pending1, pending2) = pending.partition(reachable) |
83 val (pending1, pending2) = pending.partition(reachable) |
84 val requirements = dep_graph.all_preds(pending1).reverse |
84 val requirements = dep_graph.all_preds(pending1).reverse |
85 ((requirements, share_common_data), Load_Bulk(pending1, pending2, checkpoints)) |
85 ((requirements, share_common_data), Load_Bulk(pending1, pending2, checkpoints)) |
86 } |
86 } |