finalize scheduled build only on master node;
authorFabian Huch <huch@in.tum.de>
Fri, 10 Nov 2023 14:52:13 +0100
changeset 78970 5d38b72a1a66
parent 78969 1b05c2b10c9f
child 78971 f930d24f1548
finalize scheduled build only on master node;
src/Pure/Tools/build_schedule.scala
--- a/src/Pure/Tools/build_schedule.scala	Fri Nov 10 14:42:07 2023 +0100
+++ b/src/Pure/Tools/build_schedule.scala	Fri Nov 10 14:52:13 2023 +0100
@@ -577,12 +577,14 @@
         case _ => false
     }
 
-    override def next_jobs(state: Build_Process.State): List[String] =
-      if (progress.stopped) state.ready.map(_.name)
+    override def next_jobs(state: Build_Process.State): List[String] = {
+      val finalize_limit = if (build_context.master) Int.MaxValue else 0
+
+      if (progress.stopped) state.ready.map(_.name).take(finalize_limit)
       else if (cache.is_current(state)) cache.configs.map(_.job_name)
       else {
         val current = state.ready.filter(task => is_current(state, task.name))
-        if (current.nonEmpty) current.map(_.name)
+        if (current.nonEmpty) current.map(_.name).take(finalize_limit)
         else {
           val start = Time.now()
           val next = scheduler.next(state)
@@ -598,6 +600,7 @@
           configs.map(_.job_name)
         }
       }
+    }
 
     override def run(): Build.Results = {
       val results = super.run()