src/Pure/Admin/build_status.scala
author wenzelm
Wed May 10 19:02:06 2017 +0200 (2017-05-10)
changeset 65799 ed705d6a6a63
parent 65798 d459db0f6135
child 65804 73ed0ebac3b0
permissions -rw-r--r--
stretch image according to history length;
wenzelm@65743
     1
/*  Title:      Pure/Admin/build_status.scala
wenzelm@63686
     2
    Author:     Makarius
wenzelm@63686
     3
wenzelm@65743
     4
Present recent build status information from database.
wenzelm@63686
     5
*/
wenzelm@63686
     6
wenzelm@63686
     7
package isabelle
wenzelm@63686
     8
wenzelm@63686
     9
wenzelm@65743
    10
object Build_Status
wenzelm@63686
    11
{
wenzelm@65799
    12
  /* defaults */
wenzelm@65799
    13
wenzelm@65799
    14
  val default_target_dir = Path.explode("build_status")
wenzelm@65799
    15
  val default_image_size = (800, 600)
wenzelm@65799
    16
  val default_history = 30
wenzelm@65799
    17
wenzelm@65799
    18
  def default_profiles: List[Profile] =
wenzelm@65799
    19
    Jenkins.build_status_profiles ::: Isabelle_Cronjob.build_status_profiles
wenzelm@65799
    20
wenzelm@65799
    21
wenzelm@65791
    22
  /* data profiles */
wenzelm@65791
    23
wenzelm@65798
    24
  sealed case class Profile(description: String, history: Int, sql: String)
wenzelm@65791
    25
  {
wenzelm@65799
    26
    def days(options: Options): Int = options.int("build_log_history") max history
wenzelm@65799
    27
wenzelm@65799
    28
    def stretch(options: Options): Double =
wenzelm@65799
    29
      (days(options) max default_history min (default_history * 5)).toDouble / default_history
wenzelm@65799
    30
wenzelm@65799
    31
    def select(options: Options, columns: List[SQL.Column], only_sessions: Set[String]): SQL.Source =
wenzelm@65791
    32
    {
wenzelm@65791
    33
      val sql_sessions =
wenzelm@65791
    34
        if (only_sessions.isEmpty) ""
wenzelm@65791
    35
        else
wenzelm@65791
    36
          only_sessions.iterator.map(a => Build_Log.Data.session_name + " = " + SQL.string(a))
wenzelm@65791
    37
            .mkString("(", " OR ", ") AND ")
wenzelm@65791
    38
wenzelm@65791
    39
      Build_Log.Data.universal_table.select(columns, distinct = true,
wenzelm@65791
    40
        sql = "WHERE " +
wenzelm@65799
    41
          Build_Log.Data.pull_date + " > " + Build_Log.Data.recent_time(days(options)) + " AND " +
wenzelm@65791
    42
          Build_Log.Data.status + " = " + SQL.string(Build_Log.Session_Status.finished.toString) +
wenzelm@65791
    43
          " AND " + sql_sessions + SQL.enclose(sql) +
wenzelm@65791
    44
          " ORDER BY " + Build_Log.Data.pull_date + " DESC")
wenzelm@65791
    45
    }
wenzelm@65791
    46
  }
wenzelm@65791
    47
wenzelm@65791
    48
wenzelm@65785
    49
  /* build status */
wenzelm@65785
    50
wenzelm@65785
    51
  def build_status(options: Options,
wenzelm@65785
    52
    progress: Progress = No_Progress,
wenzelm@65785
    53
    profiles: List[Profile] = default_profiles,
wenzelm@65785
    54
    only_sessions: Set[String] = Set.empty,
wenzelm@65785
    55
    verbose: Boolean = false,
wenzelm@65785
    56
    target_dir: Path = default_target_dir,
wenzelm@65785
    57
    image_size: (Int, Int) = default_image_size)
wenzelm@65785
    58
  {
wenzelm@65785
    59
    val data =
wenzelm@65785
    60
      read_data(options, progress = progress, profiles = profiles,
wenzelm@65785
    61
        only_sessions = only_sessions, verbose = verbose)
wenzelm@65785
    62
wenzelm@65785
    63
    present_data(data, progress = progress, target_dir = target_dir, image_size = image_size)
wenzelm@65785
    64
  }
wenzelm@65736
    65
wenzelm@65736
    66
wenzelm@65791
    67
  /* read data */
wenzelm@65736
    68
wenzelm@65792
    69
  sealed case class Data(date: Date, entries: List[Data_Entry])
wenzelm@65799
    70
  sealed case class Data_Entry(
wenzelm@65799
    71
    name: String, hosts: List[String], stretch: Double, sessions: List[Session])
wenzelm@65765
    72
  sealed case class Session(name: String, threads: Int, entries: List[Entry])
wenzelm@65754
    73
  {
wenzelm@65795
    74
    require(entries.nonEmpty)
wenzelm@65795
    75
wenzelm@65796
    76
    def pull_date: Date = entries.head.pull_date
wenzelm@65796
    77
    def isabelle_version: String = entries.head.isabelle_version
wenzelm@65796
    78
    def afp_version: String = entries.head.afp_version
wenzelm@65796
    79
wenzelm@65795
    80
    def timing: Timing = entries.head.timing
wenzelm@65795
    81
    def ml_timing: Timing = entries.head.ml_timing
wenzelm@65762
    82
    def order: Long = - timing.elapsed.ms
wenzelm@65769
    83
wenzelm@65769
    84
    def check_timing: Boolean = entries.length >= 3
wenzelm@65769
    85
    def check_heap: Boolean = entries.forall(_.heap_size > 0)
wenzelm@65754
    86
  }
wenzelm@65796
    87
  sealed case class Entry(pull_date: Date, isabelle_version: String, afp_version: String,
wenzelm@65796
    88
    timing: Timing, ml_timing: Timing, heap_size: Long)
wenzelm@65736
    89
wenzelm@65736
    90
  def read_data(options: Options,
wenzelm@65736
    91
    progress: Progress = No_Progress,
wenzelm@65785
    92
    profiles: List[Profile] = default_profiles,
wenzelm@65736
    93
    only_sessions: Set[String] = Set.empty,
wenzelm@65750
    94
    verbose: Boolean = false): Data =
wenzelm@65736
    95
  {
wenzelm@65754
    96
    val date = Date.now()
wenzelm@65792
    97
    var data_hosts = Map.empty[String, Set[String]]
wenzelm@65799
    98
    var data_stretch = Map.empty[String, Double]
wenzelm@65762
    99
    var data_entries = Map.empty[String, Map[String, Session]]
wenzelm@63688
   100
wenzelm@65792
   101
    def get_hosts(data_name: String): Set[String] =
wenzelm@65792
   102
      data_hosts.getOrElse(data_name, Set.empty)
wenzelm@65792
   103
wenzelm@65736
   104
    val store = Build_Log.store(options)
wenzelm@65736
   105
    using(store.open_database())(db =>
wenzelm@64089
   106
    {
wenzelm@65764
   107
      for (profile <- profiles.sortBy(_.description)) {
wenzelm@65764
   108
        progress.echo("input " + quote(profile.description))
wenzelm@65736
   109
        val columns =
wenzelm@65736
   110
          List(
wenzelm@65736
   111
            Build_Log.Data.pull_date,
wenzelm@65792
   112
            Build_Log.Prop.build_host,
wenzelm@65796
   113
            Build_Log.Prop.isabelle_version,
wenzelm@65796
   114
            Build_Log.Prop.afp_version,
wenzelm@65752
   115
            Build_Log.Settings.ISABELLE_BUILD_OPTIONS,
wenzelm@65736
   116
            Build_Log.Settings.ML_PLATFORM,
wenzelm@65736
   117
            Build_Log.Data.session_name,
wenzelm@65736
   118
            Build_Log.Data.threads,
wenzelm@65736
   119
            Build_Log.Data.timing_elapsed,
wenzelm@65736
   120
            Build_Log.Data.timing_cpu,
wenzelm@65736
   121
            Build_Log.Data.timing_gc,
wenzelm@65736
   122
            Build_Log.Data.ml_timing_elapsed,
wenzelm@65736
   123
            Build_Log.Data.ml_timing_cpu,
wenzelm@65769
   124
            Build_Log.Data.ml_timing_gc,
wenzelm@65769
   125
            Build_Log.Data.heap_size)
wenzelm@63700
   126
wenzelm@65752
   127
        val Threads_Option = """threads\s*=\s*(\d+)""".r
wenzelm@65752
   128
wenzelm@65799
   129
        val sql = profile.select(options, columns, only_sessions)
wenzelm@65750
   130
        if (verbose) progress.echo(sql)
wenzelm@65750
   131
wenzelm@65750
   132
        db.using_statement(sql)(stmt =>
wenzelm@65736
   133
        {
wenzelm@65740
   134
          val res = stmt.execute_query()
wenzelm@65740
   135
          while (res.next()) {
wenzelm@65766
   136
            val session_name = res.string(Build_Log.Data.session_name)
wenzelm@65764
   137
            val threads =
wenzelm@65764
   138
            {
wenzelm@65764
   139
              val threads1 =
wenzelm@65764
   140
                res.string(Build_Log.Settings.ISABELLE_BUILD_OPTIONS) match {
wenzelm@65766
   141
                  case Threads_Option(Value.Int(i)) if session_name == "Pure" => i
wenzelm@65764
   142
                  case _ => 1
wenzelm@65764
   143
                }
wenzelm@65764
   144
              val threads2 = res.get_int(Build_Log.Data.threads).getOrElse(1)
wenzelm@65764
   145
              threads1 max threads2
wenzelm@65764
   146
            }
wenzelm@65766
   147
            val ml_platform = res.string(Build_Log.Settings.ML_PLATFORM)
wenzelm@65762
   148
            val data_name =
wenzelm@65764
   149
              profile.description +
wenzelm@65764
   150
                (if (ml_platform.startsWith("x86_64")) ", 64bit" else "") +
wenzelm@65764
   151
                (if (threads == 1) "" else ", " + threads + " threads")
wenzelm@63703
   152
wenzelm@65799
   153
            res.get_string(Build_Log.Prop.build_host).foreach(host =>
wenzelm@65799
   154
              data_hosts += (data_name -> (get_hosts(data_name) + host)))
wenzelm@65799
   155
wenzelm@65799
   156
            data_stretch += (data_name -> profile.stretch(options))
wenzelm@65799
   157
wenzelm@65736
   158
            val entry =
wenzelm@65796
   159
              Entry(
wenzelm@65796
   160
                pull_date = res.date(Build_Log.Data.pull_date),
wenzelm@65796
   161
                isabelle_version = res.string(Build_Log.Prop.isabelle_version),
wenzelm@65796
   162
                afp_version = res.string(Build_Log.Prop.afp_version),
wenzelm@65796
   163
                timing =
wenzelm@65796
   164
                  res.timing(
wenzelm@65796
   165
                    Build_Log.Data.timing_elapsed,
wenzelm@65796
   166
                    Build_Log.Data.timing_cpu,
wenzelm@65796
   167
                    Build_Log.Data.timing_gc),
wenzelm@65796
   168
                ml_timing =
wenzelm@65796
   169
                  res.timing(
wenzelm@65796
   170
                    Build_Log.Data.ml_timing_elapsed,
wenzelm@65796
   171
                    Build_Log.Data.ml_timing_cpu,
wenzelm@65796
   172
                    Build_Log.Data.ml_timing_gc),
wenzelm@65769
   173
                heap_size = res.long(Build_Log.Data.heap_size))
wenzelm@65736
   174
wenzelm@65762
   175
            val sessions = data_entries.getOrElse(data_name, Map.empty)
wenzelm@65766
   176
            val entries = sessions.get(session_name).map(_.entries) getOrElse Nil
wenzelm@65766
   177
            val session = Session(session_name, threads, entry :: entries)
wenzelm@65766
   178
            data_entries += (data_name -> (sessions + (session_name -> session)))
wenzelm@65736
   179
          }
wenzelm@65736
   180
        })
wenzelm@65736
   181
      }
wenzelm@65736
   182
    })
wenzelm@65736
   183
wenzelm@65792
   184
    val sorted_entries =
wenzelm@65762
   185
      (for {
wenzelm@65792
   186
        (name, sessions) <- data_entries.toList
wenzelm@65769
   187
        sorted_sessions <-
wenzelm@65769
   188
          proper_list(sessions.toList.map(_._2).filter(_.check_timing).sortBy(_.order))
wenzelm@65799
   189
      }
wenzelm@65799
   190
      yield {
wenzelm@65799
   191
        val hosts = get_hosts(name).toList.sorted
wenzelm@65799
   192
        val stretch = data_stretch(name)
wenzelm@65799
   193
        Data_Entry(name, hosts, stretch, sorted_sessions)
wenzelm@65799
   194
      }).sortBy(_.name)
wenzelm@65792
   195
wenzelm@65792
   196
    Data(date, sorted_entries)
wenzelm@65736
   197
  }
wenzelm@65736
   198
wenzelm@65736
   199
wenzelm@65736
   200
  /* present data */
wenzelm@65736
   201
wenzelm@65736
   202
  def present_data(data: Data,
wenzelm@65736
   203
    progress: Progress = No_Progress,
wenzelm@65736
   204
    target_dir: Path = default_target_dir,
wenzelm@65759
   205
    image_size: (Int, Int) = default_image_size)
wenzelm@65736
   206
  {
wenzelm@65791
   207
    def clean_name(name: String): String =
wenzelm@65791
   208
      name.flatMap(c => if (c == ' ' || c == '/') "_" else if (c == ',') "" else c.toString)
wenzelm@65791
   209
wenzelm@65786
   210
    Isabelle_System.mkdirs(target_dir)
wenzelm@65786
   211
    File.write(target_dir + Path.basic("index.html"),
wenzelm@65786
   212
      HTML.output_document(
wenzelm@65786
   213
        List(HTML.title("Isabelle build status")),
wenzelm@65792
   214
        List(HTML.chapter("Isabelle build status"),
wenzelm@65794
   215
          HTML.par(
wenzelm@65794
   216
            List(HTML.itemize(
wenzelm@65794
   217
              List(HTML.bold(HTML.text("status date: ")) :: HTML.text(data.date.toString))))),
wenzelm@65794
   218
          HTML.par(
wenzelm@65794
   219
            List(HTML.itemize(data.entries.map({ case data_entry =>
wenzelm@65794
   220
              List(HTML.link(clean_name(data_entry.name) + "/index.html",
wenzelm@65794
   221
                HTML.text(data_entry.name))) })))))))
wenzelm@65786
   222
wenzelm@65792
   223
    for (data_entry <- data.entries) {
wenzelm@65792
   224
      val data_name = data_entry.name
wenzelm@65792
   225
wenzelm@65799
   226
      val image_width = (image_size._1 * data_entry.stretch).toInt
wenzelm@65799
   227
      val image_height = image_size._2
wenzelm@65799
   228
wenzelm@65786
   229
      progress.echo("output " + quote(data_name))
wenzelm@65786
   230
wenzelm@65764
   231
      val dir = target_dir + Path.basic(clean_name(data_name))
wenzelm@65736
   232
      Isabelle_System.mkdirs(dir)
wenzelm@65736
   233
wenzelm@65764
   234
      val session_plots =
wenzelm@65764
   235
        Par_List.map((session: Session) =>
wenzelm@65764
   236
          Isabelle_System.with_tmp_file(session.name, "data") { data_file =>
wenzelm@65764
   237
            Isabelle_System.with_tmp_file(session.name, "gnuplot") { gnuplot_file =>
wenzelm@63706
   238
wenzelm@65764
   239
              File.write(data_file,
wenzelm@65764
   240
                cat_lines(
wenzelm@65764
   241
                  session.entries.map(entry =>
wenzelm@65796
   242
                    List(entry.pull_date.unix_epoch.toString,
wenzelm@65764
   243
                      entry.timing.elapsed.minutes,
wenzelm@65764
   244
                      entry.timing.resources.minutes,
wenzelm@65764
   245
                      entry.ml_timing.elapsed.minutes,
wenzelm@65769
   246
                      entry.ml_timing.resources.minutes,
wenzelm@65769
   247
                      (entry.heap_size.toDouble / (1024 * 1024)).toString).mkString(" "))))
wenzelm@65736
   248
wenzelm@65764
   249
              val max_time =
wenzelm@65764
   250
                ((0.0 /: session.entries){ case (m, entry) =>
wenzelm@65764
   251
                  m.max(entry.timing.elapsed.minutes).
wenzelm@65764
   252
                    max(entry.timing.resources.minutes).
wenzelm@65764
   253
                    max(entry.ml_timing.elapsed.minutes).
wenzelm@65764
   254
                    max(entry.ml_timing.resources.minutes) } max 0.1) * 1.1
wenzelm@65769
   255
              val timing_range = "[0:" + max_time + "]"
wenzelm@65763
   256
wenzelm@65769
   257
              def gnuplot(plots: List[String], kind: String, range: String): String =
wenzelm@65764
   258
              {
wenzelm@65764
   259
                val plot_name = session.name + "_" + kind + ".png"
wenzelm@65764
   260
wenzelm@65764
   261
                File.write(gnuplot_file, """
wenzelm@65799
   262
set terminal png size """ + image_width + "," + image_height + """
wenzelm@65764
   263
set output """ + quote(File.standard_path(dir + Path.basic(plot_name))) + """
wenzelm@65759
   264
set xdata time
wenzelm@65759
   265
set timefmt "%s"
wenzelm@65759
   266
set format x "%d-%b"
wenzelm@65762
   267
set xlabel """ + quote(session.name) + """ noenhanced
wenzelm@65763
   268
set key left bottom
wenzelm@65769
   269
plot [] """ + range + " " +
wenzelm@65769
   270
                plots.map(s => quote(data_file.implode) + " " + s).mkString(", ") + "\n")
wenzelm@65759
   271
wenzelm@65764
   272
                val result =
wenzelm@65764
   273
                  Isabelle_System.bash("\"$ISABELLE_GNUPLOT\" " + File.bash_path(gnuplot_file))
wenzelm@65764
   274
                if (!result.ok)
wenzelm@65764
   275
                  result.error("Gnuplot failed for " + data_name + "/" + plot_name).check
wenzelm@65764
   276
wenzelm@65764
   277
                plot_name
wenzelm@65764
   278
              }
wenzelm@65759
   279
wenzelm@65765
   280
              val timing_plots =
wenzelm@65769
   281
              {
wenzelm@65769
   282
                val plots1 =
wenzelm@65769
   283
                  List(
wenzelm@65769
   284
                    """ using 1:2 smooth sbezier title "elapsed time (smooth)" """,
wenzelm@65769
   285
                    """ using 1:2 smooth csplines title "elapsed time" """)
wenzelm@65769
   286
                val plots2 =
wenzelm@65769
   287
                  List(
wenzelm@65769
   288
                    """ using 1:3 smooth sbezier title "cpu time (smooth)" """,
wenzelm@65769
   289
                    """ using 1:3 smooth csplines title "cpu time" """)
wenzelm@65769
   290
                if (session.threads == 1) plots1 else plots1 ::: plots2
wenzelm@65769
   291
              }
wenzelm@65765
   292
wenzelm@65764
   293
              val ml_timing_plots =
wenzelm@65764
   294
                List(
wenzelm@65765
   295
                  """ using 1:4 smooth sbezier title "ML elapsed time (smooth)" """,
wenzelm@65765
   296
                  """ using 1:4 smooth csplines title "ML elapsed time" """,
wenzelm@65764
   297
                  """ using 1:5 smooth sbezier title "ML cpu time (smooth)" """,
wenzelm@65765
   298
                  """ using 1:5 smooth csplines title "ML cpu time" """)
wenzelm@65736
   299
wenzelm@65769
   300
              val heap_plots =
wenzelm@65769
   301
                List(
wenzelm@65769
   302
                  """ using 1:6 smooth sbezier title "heap (smooth)" """,
wenzelm@65769
   303
                  """ using 1:6 smooth csplines title "heap" """)
wenzelm@65769
   304
wenzelm@65769
   305
              val plot_names =
wenzelm@65769
   306
                List(
wenzelm@65769
   307
                  gnuplot(timing_plots, "timing", timing_range),
wenzelm@65769
   308
                  gnuplot(ml_timing_plots, "ml_timing", timing_range)) :::
wenzelm@65769
   309
                (if (session.check_heap) List(gnuplot(heap_plots, "heap", "[0:]")) else Nil)
wenzelm@65769
   310
wenzelm@65769
   311
              session.name -> plot_names
wenzelm@65764
   312
            }
wenzelm@65792
   313
          }, data_entry.sessions).toMap
wenzelm@65754
   314
wenzelm@65736
   315
      File.write(dir + Path.basic("index.html"),
wenzelm@65754
   316
        HTML.output_document(
wenzelm@65760
   317
          List(HTML.title("Isabelle build status for " + data_name)),
wenzelm@65792
   318
          HTML.chapter("Isabelle build status for " + data_name) ::
wenzelm@65792
   319
          HTML.par(
wenzelm@65792
   320
            List(HTML.itemize(
wenzelm@65792
   321
              List(
wenzelm@65794
   322
                HTML.bold(HTML.text("status date: ")) :: HTML.text(data.date.toString),
wenzelm@65794
   323
                HTML.bold(HTML.text("build host: ")) :: HTML.text(commas(data_entry.hosts)))))) ::
wenzelm@65792
   324
          HTML.par(
wenzelm@65792
   325
            List(HTML.itemize(
wenzelm@65792
   326
              data_entry.sessions.map(session =>
wenzelm@65792
   327
                HTML.link("#session_" + session.name, HTML.text(session.name)) ::
wenzelm@65792
   328
                HTML.text(" (" + session.timing.message_resources + ")"))))) ::
wenzelm@65792
   329
          data_entry.sessions.flatMap(session =>
wenzelm@65754
   330
            List(
wenzelm@65762
   331
              HTML.section(session.name) + HTML.id("session_" + session.name),
wenzelm@65755
   332
              HTML.par(
wenzelm@65764
   333
                HTML.itemize(List(
wenzelm@65764
   334
                  HTML.bold(HTML.text("timing: ")) :: HTML.text(session.timing.message_resources),
wenzelm@65764
   335
                  HTML.bold(HTML.text("ML timing: ")) ::
wenzelm@65796
   336
                    HTML.text(session.ml_timing.message_resources)) :::
wenzelm@65796
   337
                  proper_string(session.isabelle_version).map(s =>
wenzelm@65796
   338
                    HTML.bold(HTML.text("Isabelle version: ")) :: HTML.text(s)).toList :::
wenzelm@65796
   339
                  proper_string(session.afp_version).map(s =>
wenzelm@65796
   340
                    HTML.bold(HTML.text("AFP version: ")) :: HTML.text(s)).toList) ::
wenzelm@65773
   341
                session_plots.getOrElse(session.name, Nil).map(plot_name =>
wenzelm@65773
   342
                  HTML.image(plot_name) +
wenzelm@65799
   343
                    HTML.width(image_width / 2) +
wenzelm@65799
   344
                    HTML.height(image_height / 2)))))))
wenzelm@63688
   345
    }
wenzelm@63688
   346
  }
wenzelm@63688
   347
wenzelm@63688
   348
wenzelm@63688
   349
  /* Isabelle tool wrapper */
wenzelm@63688
   350
wenzelm@63688
   351
  val isabelle_tool =
wenzelm@65743
   352
    Isabelle_Tool("build_status", "present recent build status information from database", args =>
wenzelm@63688
   353
    {
wenzelm@65736
   354
      var target_dir = default_target_dir
wenzelm@65736
   355
      var only_sessions = Set.empty[String]
wenzelm@65736
   356
      var options = Options.init()
wenzelm@65736
   357
      var image_size = default_image_size
wenzelm@65750
   358
      var verbose = false
wenzelm@63688
   359
wenzelm@63688
   360
      val getopts = Getopts("""
wenzelm@65743
   361
Usage: isabelle build_status [OPTIONS]
wenzelm@63688
   362
wenzelm@63688
   363
  Options are:
wenzelm@65737
   364
    -D DIR       target directory (default """ + default_target_dir + """)
wenzelm@63700
   365
    -S SESSIONS  only given SESSIONS (comma separated)
wenzelm@65736
   366
    -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
wenzelm@65737
   367
    -s WxH       size of PNG image (default """ + image_size._1 + "x" + image_size._2 + """)
wenzelm@65750
   368
    -v           verbose
wenzelm@63688
   369
wenzelm@65736
   370
  Present performance statistics from build log database, which is specified
wenzelm@65782
   371
  via system options build_log_database_host, build_log_database_user,
wenzelm@65782
   372
  build_log_history etc.
wenzelm@63688
   373
""",
wenzelm@63688
   374
        "D:" -> (arg => target_dir = Path.explode(arg)),
wenzelm@63700
   375
        "S:" -> (arg => only_sessions = space_explode(',', arg).toSet),
wenzelm@65736
   376
        "o:" -> (arg => options = options + arg),
wenzelm@63700
   377
        "s:" -> (arg =>
wenzelm@63805
   378
          space_explode('x', arg).map(Value.Int.parse(_)) match {
wenzelm@65736
   379
            case List(w, h) if w > 0 && h > 0 => image_size = (w, h)
wenzelm@63700
   380
            case _ => error("Error bad PNG image size: " + quote(arg))
wenzelm@65750
   381
          }),
wenzelm@65750
   382
        "v" -> (_ => verbose = true))
wenzelm@63688
   383
wenzelm@65736
   384
      val more_args = getopts(args)
wenzelm@65736
   385
      if (more_args.nonEmpty) getopts.usage()
wenzelm@63700
   386
wenzelm@65736
   387
      val progress = new Console_Progress
wenzelm@63688
   388
wenzelm@65785
   389
      build_status(options, progress = progress, only_sessions = only_sessions, verbose = verbose,
wenzelm@65785
   390
        target_dir = target_dir, image_size = image_size)
wenzelm@65736
   391
wenzelm@64161
   392
  }, admin = true)
wenzelm@63686
   393
}