src/Pure/Admin/ci_profile.scala
author wenzelm
Tue, 28 Jun 2022 15:29:17 +0200
changeset 75631 809c37bfd823
parent 75630 e3aa7214eb1a
child 75633 f5015fa7cb19
permissions -rw-r--r--
clarified IO, following Java 11 and Isabelle/Scala;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
64160
1eea419fab65 clarified files;
wenzelm
parents: 64115
diff changeset
     1
/*  Title:      Pure/Admin/ci_profile.scala
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
     2
    Author:     Lars Hupel and Fabian Huch, TU Munich
63288
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
     3
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
     4
Build profile for continuous integration services.
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
     5
*/
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
     6
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
     7
package isabelle
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
     8
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
     9
64055
acd3e25975a2 proper imports;
wenzelm
parents: 63894
diff changeset
    10
import java.time.{Instant, ZoneId}
63472
Lars Hupel <lars.hupel@mytum.de>
parents: 63418
diff changeset
    11
import java.time.format.DateTimeFormatter
68013
7a30a3cc2763 workaround for jdk-10.0.1;
wenzelm
parents: 65422
diff changeset
    12
import java.util.{Properties => JProperties, Map => JMap}
75631
809c37bfd823 clarified IO, following Java 11 and Isabelle/Scala;
wenzelm
parents: 75630
diff changeset
    13
import java.nio.file.Files
63328
7a8515c58271 read Java system properties from ISABELLE_CI_PROPERTIES
Lars Hupel <lars.hupel@mytum.de>
parents: 63294
diff changeset
    14
7a8515c58271 read Java system properties from ISABELLE_CI_PROPERTIES
Lars Hupel <lars.hupel@mytum.de>
parents: 63294
diff changeset
    15
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    16
object CI_Profile {
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    17
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    18
  /* Result */
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    19
73934
39e0c7fac69e jenkins: pre/post-hook results
Fabian Huch <huch@in.tum.de>
parents: 73359
diff changeset
    20
  case class Result(rc: Int)
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 74306
diff changeset
    21
  case object Result {
74306
a117c076aa22 clarified signature;
wenzelm
parents: 73934
diff changeset
    22
    def ok: Result = Result(Process_Result.RC.ok)
a117c076aa22 clarified signature;
wenzelm
parents: 73934
diff changeset
    23
    def error: Result = Result(Process_Result.RC.error)
73934
39e0c7fac69e jenkins: pre/post-hook results
Fabian Huch <huch@in.tum.de>
parents: 73359
diff changeset
    24
  }
39e0c7fac69e jenkins: pre/post-hook results
Fabian Huch <huch@in.tum.de>
parents: 73359
diff changeset
    25
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    26
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    27
  /* Profile */
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    28
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    29
  case class Profile(threads: Int, jobs: Int, numa: Boolean)
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    30
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    31
  object Profile {
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    32
    def from_host: Profile = {
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    33
      Isabelle_System.hostname() match {
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    34
        case "hpcisabelle" => Profile(8, 8, numa = true)
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    35
        case "lxcisa1" => Profile(4, 10, numa = false)
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    36
        case _ => Profile(2, 2, numa = false)
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    37
      }
63288
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
    38
    }
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
    39
  }
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
    40
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    41
75629
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
    42
  /* Build_Config */
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    43
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    44
  case class Build_Config(
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    45
    documents: Boolean = true,
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    46
    clean: Boolean = true,
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    47
    include: List[Path] = Nil,
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    48
    select: List[Path] = Nil,
75629
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
    49
    pre_hook: () => Result = () => Result.ok,
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
    50
    post_hook: Build.Results => Result = _ => Result.ok,
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    51
    selection: Sessions.Selection = Sessions.Selection.empty
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    52
  )
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    53
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    54
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    55
  /* Status */
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    56
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    57
  sealed abstract class Status(val str: String) {
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    58
    def merge(that: Status): Status = (this, that) match {
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    59
      case (Ok, s) => s
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    60
      case (Failed, _) => Failed
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    61
      case (Skipped, Failed) => Failed
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    62
      case (Skipped, _) => Skipped
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    63
    }
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    64
  }
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    65
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    66
  object Status {
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    67
    def merge(statuses: List[Status]): Status =
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    68
      statuses.foldLeft(Ok: Status)(_ merge _)
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    69
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    70
    def from_results(results: Build.Results, session: String): Status =
75629
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
    71
      if (results.cancelled(session)) Skipped
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
    72
      else if (results(session).ok) Ok
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
    73
      else Failed
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    74
  }
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    75
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    76
  case object Ok extends Status("ok")
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    77
  case object Skipped extends Status("skipped")
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    78
  case object Failed extends Status("failed")
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    79
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
    80
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 74306
diff changeset
    81
  private def load_properties(): JProperties = {
75631
809c37bfd823 clarified IO, following Java 11 and Isabelle/Scala;
wenzelm
parents: 75630
diff changeset
    82
    val props = new JProperties
63418
Lars Hupel <lars.hupel@mytum.de>
parents: 63401
diff changeset
    83
    val file_name = Isabelle_System.getenv("ISABELLE_CI_PROPERTIES")
75631
809c37bfd823 clarified IO, following Java 11 and Isabelle/Scala;
wenzelm
parents: 75630
diff changeset
    84
    if (file_name.nonEmpty) {
809c37bfd823 clarified IO, following Java 11 and Isabelle/Scala;
wenzelm
parents: 75630
diff changeset
    85
      val path = Path.explode(file_name)
809c37bfd823 clarified IO, following Java 11 and Isabelle/Scala;
wenzelm
parents: 75630
diff changeset
    86
      if (path.is_file) props.load(Files.newBufferedReader(path.java_path))
63418
Lars Hupel <lars.hupel@mytum.de>
parents: 63401
diff changeset
    87
    }
75631
809c37bfd823 clarified IO, following Java 11 and Isabelle/Scala;
wenzelm
parents: 75630
diff changeset
    88
    props
63328
7a8515c58271 read Java system properties from ISABELLE_CI_PROPERTIES
Lars Hupel <lars.hupel@mytum.de>
parents: 63294
diff changeset
    89
  }
7a8515c58271 read Java system properties from ISABELLE_CI_PROPERTIES
Lars Hupel <lars.hupel@mytum.de>
parents: 63294
diff changeset
    90
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 74306
diff changeset
    91
  private def compute_timing(results: Build.Results, group: Option[String]): Timing = {
75629
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
    92
    val timings =
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
    93
      results.sessions.collect {
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
    94
        case session if group.forall(results.info(session).groups.contains(_)) =>
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
    95
          results(session).timing
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
    96
      }
73359
d8a0e996614b tuned --- fewer warnings;
wenzelm
parents: 71981
diff changeset
    97
    timings.foldLeft(Timing.zero)(_ + _)
63385
Lars Hupel <lars.hupel@mytum.de>
parents: 63349
diff changeset
    98
  }
Lars Hupel <lars.hupel@mytum.de>
parents: 63349
diff changeset
    99
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   100
  private def with_documents(options: Options, config: Build_Config): Options = {
75629
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
   101
    if (config.documents) {
63894
7534eec7cfad benchmark doesn't need to build documents
Lars Hupel <lars.hupel@mytum.de>
parents: 63685
diff changeset
   102
      options
7534eec7cfad benchmark doesn't need to build documents
Lars Hupel <lars.hupel@mytum.de>
parents: 63685
diff changeset
   103
        .bool.update("browser_info", true)
7534eec7cfad benchmark doesn't need to build documents
Lars Hupel <lars.hupel@mytum.de>
parents: 63685
diff changeset
   104
        .string.update("document", "pdf")
7534eec7cfad benchmark doesn't need to build documents
Lars Hupel <lars.hupel@mytum.de>
parents: 63685
diff changeset
   105
        .string.update("document_variants", "document:outline=/proof,/ML")
75629
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
   106
    }
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
   107
    else options
63894
7534eec7cfad benchmark doesn't need to build documents
Lars Hupel <lars.hupel@mytum.de>
parents: 63685
diff changeset
   108
  }
7534eec7cfad benchmark doesn't need to build documents
Lars Hupel <lars.hupel@mytum.de>
parents: 63685
diff changeset
   109
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   110
  def hg_id(path: Path): String =
64232
367d83d6030e clarified hg.id operation, with explicit tip as default;
wenzelm
parents: 64217
diff changeset
   111
    Mercurial.repository(path).id()
63385
Lars Hupel <lars.hupel@mytum.de>
parents: 63349
diff changeset
   112
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   113
  def print_section(title: String): Unit =
63349
6c889fe495a2 print statistics; tuned
Lars Hupel <lars.hupel@mytum.de>
parents: 63328
diff changeset
   114
    println(s"\n=== $title ===\n")
6c889fe495a2 print statistics; tuned
Lars Hupel <lars.hupel@mytum.de>
parents: 63328
diff changeset
   115
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   116
  def build(profile: Profile, config: Build_Config): Unit = {
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   117
    val isabelle_home = Path.explode(Isabelle_System.getenv_strict("ISABELLE_HOME"))
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   118
    val isabelle_id = hg_id(isabelle_home)
63288
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   119
75629
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
   120
    val start_time =
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
   121
      Instant.now().atZone(ZoneId.systemDefault).format(DateTimeFormatter.RFC_1123_DATE_TIME)
63385
Lars Hupel <lars.hupel@mytum.de>
parents: 63349
diff changeset
   122
63349
6c889fe495a2 print statistics; tuned
Lars Hupel <lars.hupel@mytum.de>
parents: 63328
diff changeset
   123
    print_section("CONFIGURATION")
64081
38bb09ed965b more uniform treatment of settings;
wenzelm
parents: 64080
diff changeset
   124
    println(Build_Log.Settings.show())
63328
7a8515c58271 read Java system properties from ISABELLE_CI_PROPERTIES
Lars Hupel <lars.hupel@mytum.de>
parents: 63294
diff changeset
   125
    val props = load_properties()
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   126
    System.getProperties.asInstanceOf[JMap[AnyRef, AnyRef]].putAll(props)
63328
7a8515c58271 read Java system properties from ISABELLE_CI_PROPERTIES
Lars Hupel <lars.hupel@mytum.de>
parents: 63294
diff changeset
   127
63288
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   128
    val options =
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   129
      with_documents(Options.init(), config)
65056
002b4c8c366e clarified defaults;
wenzelm
parents: 64286
diff changeset
   130
        .int.update("parallel_proofs", 1)
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   131
        .int.update("threads", profile.threads)
63288
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   132
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   133
    println(s"jobs = ${profile.jobs}, threads = ${profile.threads}, numa = ${profile.numa}")
69120
9d3b41732fe0 Jenkins: detect machine; adjust job parameters accordingly
Lars Hupel <lars.hupel@mytum.de>
parents: 68498
diff changeset
   134
63349
6c889fe495a2 print statistics; tuned
Lars Hupel <lars.hupel@mytum.de>
parents: 63328
diff changeset
   135
    print_section("BUILD")
63472
Lars Hupel <lars.hupel@mytum.de>
parents: 63418
diff changeset
   136
    println(s"Build started at $start_time")
Lars Hupel <lars.hupel@mytum.de>
parents: 63418
diff changeset
   137
    println(s"Isabelle id $isabelle_id")
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   138
    val pre_result = config.pre_hook()
63288
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   139
63472
Lars Hupel <lars.hupel@mytum.de>
parents: 63418
diff changeset
   140
    print_section("LOG")
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   141
    val (results, elapsed_time) = {
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   142
      val progress = new Console_Progress(verbose = true)
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   143
      val start_time = Time.now()
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   144
      val results = progress.interrupt_handler {
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   145
        Build.build(
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   146
          options + "system_heaps",
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   147
          selection = config.selection,
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   148
          progress = progress,
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   149
          clean_build = config.clean,
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   150
          verbose = true,
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   151
          numa_shuffling = profile.numa,
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   152
          max_jobs = profile.jobs,
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   153
          dirs = config.include,
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   154
          select_dirs = config.select)
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   155
      }
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   156
      val end_time = Time.now()
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   157
      (results, end_time - start_time)
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   158
    }
63349
6c889fe495a2 print statistics; tuned
Lars Hupel <lars.hupel@mytum.de>
parents: 63328
diff changeset
   159
6c889fe495a2 print statistics; tuned
Lars Hupel <lars.hupel@mytum.de>
parents: 63328
diff changeset
   160
    print_section("TIMING")
63385
Lars Hupel <lars.hupel@mytum.de>
parents: 63349
diff changeset
   161
Lars Hupel <lars.hupel@mytum.de>
parents: 63349
diff changeset
   162
    val groups = results.sessions.map(results.info).flatMap(_.groups)
Lars Hupel <lars.hupel@mytum.de>
parents: 63349
diff changeset
   163
    for (group <- groups)
Lars Hupel <lars.hupel@mytum.de>
parents: 63349
diff changeset
   164
      println(s"Group $group: " + compute_timing(results, Some(group)).message_resources)
63387
3395fe5e3893 more accurate total timing
Lars Hupel <lars.hupel@mytum.de>
parents: 63385
diff changeset
   165
3395fe5e3893 more accurate total timing
Lars Hupel <lars.hupel@mytum.de>
parents: 63385
diff changeset
   166
    val total_timing = compute_timing(results, None).copy(elapsed = elapsed_time)
3395fe5e3893 more accurate total timing
Lars Hupel <lars.hupel@mytum.de>
parents: 63385
diff changeset
   167
    println("Overall: " + total_timing.message_resources)
63288
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   168
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   169
    if (!results.ok) {
63349
6c889fe495a2 print statistics; tuned
Lars Hupel <lars.hupel@mytum.de>
parents: 63328
diff changeset
   170
      print_section("FAILED SESSIONS")
63288
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   171
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   172
      for (name <- results.sessions) {
75629
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
   173
        if (results.cancelled(name)) println(s"Session $name: CANCELLED")
63288
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   174
        else {
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   175
          val result = results(name)
75629
11e233ba53c8 minor tuning;
wenzelm
parents: 75628
diff changeset
   176
          if (!result.ok) println(s"Session $name: FAILED ${ result.rc }")
63288
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   177
        }
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   178
      }
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   179
    }
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   180
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   181
    val post_result = config.post_hook(results)
63288
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   182
75630
e3aa7214eb1a prefer Scala operations;
wenzelm
parents: 75629
diff changeset
   183
    sys.exit(List(pre_result.rc, results.rc, post_result.rc).max)
63288
e0513d6e4916 start moving actual Jenkins build scripts into the repository
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   184
  }
75628
6a5e4f17f285 switched to statically compiled ci profile;
Fabian Huch <huch@in.tum.de>
parents: 75393
diff changeset
   185
}