Only avoid recomputation if key exists
Fixes
@@ -1355,6 +1355,7 @@ class Scheduler(ServerNode):
ts = self.tasks[key]
for dep in dependencies[key]:
if all(d in done for d in dependents[dep]):
+ if dep in self.tasks:
done.add(dep)
stack.append(dep)
