explicit identification of builds and correlated build groups;
authorwenzelm
Tue Oct 18 11:24:14 2016 +0200 (2016-10-18)
changeset 64296544481988e65
parent 64295 6aefa7e66888
child 64297 12a47f263122
explicit identification of builds and correlated build groups;
src/Pure/Admin/build_history.scala
src/Pure/Admin/build_log.scala
     1.1 --- a/src/Pure/Admin/build_history.scala	Tue Oct 18 10:11:22 2016 +0200
     1.2 +++ b/src/Pure/Admin/build_history.scala	Tue Oct 18 11:24:14 2016 +0200
     1.3 @@ -146,8 +146,9 @@
     1.4  
     1.5      /* main */
     1.6  
     1.7 +    val build_host = Isabelle_System.hostname()
     1.8      val build_history_date = Date.now()
     1.9 -    val build_host = Isabelle_System.hostname()
    1.10 +    val build_group_id = build_host + ":" + build_history_date.time.ms
    1.11  
    1.12      var first_build = true
    1.13      for (threads <- threads_list) yield
    1.14 @@ -183,23 +184,27 @@
    1.15          Isabelle_System.copy_dir(isabelle_base_log, isabelle_output_log)
    1.16  
    1.17        val build_start = Date.now()
    1.18 -      val res =
    1.19 +      val build_result =
    1.20          other_isabelle("build -v " + File.bash_args(build_args), redirect = true, echo = verbose)
    1.21        val build_end = Date.now()
    1.22  
    1.23 -
    1.24 -      /* output log */
    1.25 -
    1.26        val log_path =
    1.27          other_isabelle.isabelle_home_user +
    1.28            Build_Log.log_subdir(build_history_date) +
    1.29            Build_Log.log_filename(
    1.30              BUILD_HISTORY, build_history_date, build_host, ml_platform, "M" + threads)
    1.31  
    1.32 -      val build_info = Build_Log.Log_File(log_path.base.implode, res.out_lines).parse_build_info()
    1.33 +      val build_info =
    1.34 +        Build_Log.Log_File(log_path.base.implode, build_result.out_lines).parse_build_info()
    1.35 +
    1.36 +
    1.37 +      /* output log */
    1.38  
    1.39        val meta_info =
    1.40 -        List(Build_Log.Field.build_engine -> BUILD_HISTORY,
    1.41 +        List(
    1.42 +          Build_Log.Field.build_group_id -> build_group_id,
    1.43 +          Build_Log.Field.build_id -> (build_host + ":" + build_start.time.ms),
    1.44 +          Build_Log.Field.build_engine -> BUILD_HISTORY,
    1.45            Build_Log.Field.build_host -> build_host,
    1.46            Build_Log.Field.build_start -> Build_Log.print_date(build_start),
    1.47            Build_Log.Field.build_end -> Build_Log.print_date(build_end),
    1.48 @@ -228,7 +233,7 @@
    1.49        Isabelle_System.mkdirs(log_path.dir)
    1.50        File.write_xz(log_path.ext("xz"),
    1.51          terminate_lines(
    1.52 -          Build_Log.Log_File.print_props(META_INFO_MARKER, meta_info) :: res.out_lines :::
    1.53 +          Build_Log.Log_File.print_props(META_INFO_MARKER, meta_info) :: build_result.out_lines :::
    1.54            ml_statistics.map(Build_Log.Log_File.print_props(Build_Log.ML_STATISTICS_MARKER, _)) :::
    1.55            heap_sizes), XZ.options(6))
    1.56  
    1.57 @@ -242,7 +247,7 @@
    1.58  
    1.59        first_build = false
    1.60  
    1.61 -      (res, log_path.ext("xz"))
    1.62 +      (build_result, log_path.ext("xz"))
    1.63      }
    1.64    }
    1.65  
     2.1 --- a/src/Pure/Admin/build_log.scala	Tue Oct 18 10:11:22 2016 +0200
     2.2 +++ b/src/Pure/Admin/build_log.scala	Tue Oct 18 11:24:14 2016 +0200
     2.3 @@ -247,6 +247,8 @@
     2.4  
     2.5    object Field
     2.6    {
     2.7 +    val build_group_id = "build_group_id"
     2.8 +    val build_id = "build_id"
     2.9      val build_engine = "build_engine"
    2.10      val build_host = "build_host"
    2.11      val build_start = "build_start"
    2.12 @@ -303,6 +305,11 @@
    2.13      def parse(engine: String, host: String, start: Date,
    2.14        End: Regex, Isabelle_Version: Regex, AFP_Version: Regex): Meta_Info =
    2.15      {
    2.16 +      val build_id =
    2.17 +      {
    2.18 +        val prefix = if (host != "") host else if (engine != "") engine else ""
    2.19 +        (if (prefix == "") "build" else prefix) + ":" + start.time.ms
    2.20 +      }
    2.21        val build_engine = if (engine == "") Nil else List(Field.build_engine -> engine)
    2.22        val build_host = if (host == "") Nil else List(Field.build_host -> host)
    2.23  
    2.24 @@ -319,7 +326,7 @@
    2.25        val afp_version =
    2.26          log_file.find_match(AFP_Version).map(Field.afp_version -> _)
    2.27  
    2.28 -      Meta_Info(build_engine ::: build_host :::
    2.29 +      Meta_Info((Field.build_id -> build_id) :: build_engine ::: build_host :::
    2.30            start_date ::: end_date ::: isabelle_version.toList ::: afp_version.toList,
    2.31          log_file.get_settings(Settings.all_settings))
    2.32      }