equal
deleted
inserted
replaced
16 /** auxiliary **/ |
16 /** auxiliary **/ |
17 |
17 |
18 /* persistent build info */ |
18 /* persistent build info */ |
19 |
19 |
20 sealed case class Session_Info( |
20 sealed case class Session_Info( |
21 sources: String, |
21 sources: SHA1.Shasum, |
22 input_heaps: String, |
22 input_heaps: SHA1.Shasum, |
23 output_heap: String, |
23 output_heap: SHA1.Shasum, |
24 return_code: Int, |
24 return_code: Int, |
25 uuid: String |
25 uuid: String |
26 ) { |
26 ) { |
27 def ok: Boolean = return_code == 0 |
27 def ok: Boolean = return_code == 0 |
28 } |
28 } |
269 } |
269 } |
270 |
270 |
271 // scheduler loop |
271 // scheduler loop |
272 case class Result( |
272 case class Result( |
273 current: Boolean, |
273 current: Boolean, |
274 output_heap: String, |
274 output_heap: SHA1.Shasum, |
275 process: Option[Process_Result], |
275 process: Option[Process_Result], |
276 info: Sessions.Info |
276 info: Sessions.Info |
277 ) { |
277 ) { |
278 def ok: Boolean = |
278 def ok: Boolean = |
279 process match { |
279 process match { |
296 |
296 |
297 val numa_nodes = new NUMA.Nodes(numa_shuffling) |
297 val numa_nodes = new NUMA.Nodes(numa_shuffling) |
298 |
298 |
299 @tailrec def loop( |
299 @tailrec def loop( |
300 pending: Queue, |
300 pending: Queue, |
301 running: Map[String, (String, Build_Job)], |
301 running: Map[String, (SHA1.Shasum, Build_Job)], |
302 results: Map[String, Result] |
302 results: Map[String, Result] |
303 ): Map[String, Result] = { |
303 ): Map[String, Result] = { |
304 def used_node(i: Int): Boolean = |
304 def used_node(i: Int): Boolean = |
305 running.iterator.exists( |
305 running.iterator.exists( |
306 { case (_, (_, job)) => job.numa_node.isDefined && job.numa_node.get == i }) |
306 { case (_, (_, job)) => job.numa_node.isDefined && job.numa_node.get == i }) |
372 val ancestor_results = |
372 val ancestor_results = |
373 build_deps.sessions_structure.build_requirements(List(session_name)). |
373 build_deps.sessions_structure.build_requirements(List(session_name)). |
374 filterNot(_ == session_name).map(results(_)) |
374 filterNot(_ == session_name).map(results(_)) |
375 val input_heaps = |
375 val input_heaps = |
376 if (ancestor_results.isEmpty) { |
376 if (ancestor_results.isEmpty) { |
377 SHA1.shasum_meta_info(SHA1.digest(Path.explode("$POLYML_EXE"))) + "\n" |
377 SHA1.shasum_meta_info(SHA1.digest(Path.explode("$POLYML_EXE"))) |
378 } |
378 } |
379 else ancestor_results.map(_.output_heap).mkString |
379 else SHA1.flat_shasum(ancestor_results.map(_.output_heap)) |
380 |
380 |
381 val do_store = |
381 val do_store = |
382 build_heap || Sessions.is_pure(session_name) || queue.is_inner(session_name) |
382 build_heap || Sessions.is_pure(session_name) || queue.is_inner(session_name) |
383 |
383 |
384 val (current, output_heap) = { |
384 val (current, output_heap) = { |
391 !fresh_build && |
391 !fresh_build && |
392 build.ok && |
392 build.ok && |
393 build.sources == build_deps.sources_shasum(session_name) && |
393 build.sources == build_deps.sources_shasum(session_name) && |
394 build.input_heaps == input_heaps && |
394 build.input_heaps == input_heaps && |
395 build.output_heap == output_heap && |
395 build.output_heap == output_heap && |
396 !(do_store && output_heap.isEmpty) |
396 !(do_store && output_heap.is_empty) |
397 (current, output_heap) |
397 (current, output_heap) |
398 case None => (false, "") |
398 case None => (false, SHA1.no_shasum) |
399 } |
399 } |
400 case None => (false, "") |
400 case None => (false, SHA1.no_shasum) |
401 } |
401 } |
402 } |
402 } |
403 val all_current = current && ancestor_results.forall(_.current) |
403 val all_current = current && ancestor_results.forall(_.current) |
404 |
404 |
405 if (all_current) { |
405 if (all_current) { |