feat(sched): cancel in-flight actions when a build fails
Only new spawns were held back after a failure, so every action already running was allowed to finish even though its output would be discarded. The scheduler now sends SIGTERM to the remaining children on the first failure, and reports them separately rather than counting a process it killed as a failure of its own. Partial outputs are removed and their cache entries dropped, so the next run starts clean. Under -k the existing behaviour is kept, since keeping going is the point. On a graph with three six-second generators alongside one translation unit that fails immediately, -j4 now returns in 0.12 s rather than 6.03 s.
This commit is contained in:
2 files changed
+36
-14
No files matched your search
+5
-3
@@ -205,7 +205,7 @@ let execute p ~names =
|
||||
end)
|
||||
order;
|
||||
Printf.printf "\n %s\n" (Style.dim (Printf.sprintf "%d actions, nothing run" !n));
|
||||
(b, { Sched.built = 0; cached = 0; failed = 0 })
|
||||
(b, { Sched.built = 0; cached = 0; failed = 0; aborted = 0 })
|
||||
end
|
||||
else begin
|
||||
let cache = Cache.load (Filename.concat p.tc.builddir ".meowc-cache") in
|
||||
@@ -223,12 +223,14 @@ let execute p ~names =
|
||||
let summarise (r : Sched.result) elapsed =
|
||||
if not fl.quiet && not fl.dry then begin
|
||||
let text =
|
||||
if r.failed > 0 then Style.red (Style.plural r.failed "action" ^ " failed")
|
||||
if r.failed > 0 then
|
||||
Style.red (Style.plural r.failed "action" ^ " failed")
|
||||
^ (if r.aborted > 0 then Style.dim (Printf.sprintf ", %d cancelled" r.aborted) else "")
|
||||
else if r.built = 0 then Style.dim "nothing to do"
|
||||
else Printf.sprintf "%d built%s" r.built (Style.dim (Printf.sprintf ", %d cached" r.cached))
|
||||
in
|
||||
Printf.printf "%s %s%s\n"
|
||||
(if r.built + r.failed = 0 then "" else "\n")
|
||||
(if r.built + r.failed + r.aborted = 0 then "" else "\n")
|
||||
(Style.pad 48 text) (Style.dim (duration elapsed))
|
||||
end;
|
||||
if r.failed > 0 then exit 1
|
||||
|
||||
Reference in new issue
Block a user