fix(#2772): is_settled distinguishes "not finished" from "no such node"
Returning `false` for an unknown id gave the same answer as a node that is merely still running, so a caller polling a stale id would wait forever for a state that can never arrive. `Option<bool>` makes the two cases separate, matching `node()`'s convention that `None` means the id isn't in the graph.
This commit is contained in:
parent
4de5a8dd7c
commit
8c5de704be
2 changed files with 25 additions and 13 deletions
|
|
@ -480,7 +480,7 @@ impl JobQueue {
|
|||
inner
|
||||
.containers()
|
||||
.into_iter()
|
||||
.filter(|&c| !inner.sched.graph().is_settled(c))
|
||||
.filter(|&c| inner.sched.graph().is_settled(c) == Some(false))
|
||||
.count()
|
||||
}
|
||||
}
|
||||
|
|
@ -652,7 +652,7 @@ impl QueueInner {
|
|||
if !any_unsettled {
|
||||
return None;
|
||||
}
|
||||
let is_terminal = self.sched.graph().is_settled(container);
|
||||
let is_terminal = self.sched.graph().is_settled(container) == Some(true);
|
||||
Some(DagView {
|
||||
id: container.get(),
|
||||
source: meta.source,
|
||||
|
|
@ -695,7 +695,7 @@ impl QueueInner {
|
|||
let mut live: Vec<NodeId> = Vec::new();
|
||||
let mut terminal: Vec<(NodeId, i64)> = Vec::new();
|
||||
for c in self.containers() {
|
||||
if self.sched.graph().is_settled(c) {
|
||||
if self.sched.graph().is_settled(c) == Some(true) {
|
||||
terminal.push((c, self.dag_finished_at(c)));
|
||||
} else {
|
||||
live.push(c);
|
||||
|
|
|
|||
Loading…
Reference in a new issue