properly fail when a task fails

This commit is contained in:
Mark Harrah 2010-09-27 18:59:14 -04:00
parent ce068d7fbc
commit d185e0aeb4
1 changed files with 3 additions and 3 deletions

View File

@ -211,7 +211,7 @@ object Commands
case _ => (false, Runtime.getRuntime.availableProcessors) case _ => (false, Runtime.getRuntime.availableProcessors)
} }
for( (task, taskToNode) <- p.act(in, s)) yield for( (task, taskToNode) <- p.act(in, s)) yield
processResult(runTask(task, checkCycles, maxThreads)(taskToNode), s) processResult(runTask(task, checkCycles, maxThreads)(taskToNode), s, s.fail)
} }
} }
} }
@ -301,14 +301,14 @@ object Commands
val x = new Execute[Task](checkCycles)(taskToNode) val x = new Execute[Task](checkCycles)(taskToNode)
try { x.run(root)(service) } finally { shutdown() } try { x.run(root)(service) } finally { shutdown() }
} }
def processResult[State](result: Result[State], original: State): State = def processResult[State](result: Result[State], original: State, onFailure: => State): State =
result match result match
{ {
case Value(v) => v case Value(v) => v
case Inc(inc) => case Inc(inc) =>
println(Incomplete.show(inc, true)) println(Incomplete.show(inc, true))
println("Task did not complete successfully") println("Task did not complete successfully")
original onFailure
} }
def completor(s: State): jline.Completor = new jline.Completor { def completor(s: State): jline.Completor = new jline.Completor {