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