author | wenzelm |
Sun, 05 Nov 2023 19:40:39 +0100 | |
changeset 78906 | 004b39bf06a5 |
parent 78905 | 635b84f1914a |
child 78907 | 89274adb0ebe |
permissions | -rw-r--r-- |
64148 | 1 |
/* Title: Pure/Admin/isabelle_cronjob.scala |
2 |
Author: Makarius |
|
3 |
||
4 |
Main entry point for administrative cronjob at TUM. |
|
5 |
*/ |
|
6 |
||
7 |
package isabelle |
|
8 |
||
9 |
||
67854
8374c80165e1
publish current log file, e.g. for easy error detection;
wenzelm
parents:
67775
diff
changeset
|
10 |
import java.nio.file.Files |
8374c80165e1
publish current log file, e.g. for easy error detection;
wenzelm
parents:
67775
diff
changeset
|
11 |
|
64170 | 12 |
import scala.annotation.tailrec |
13 |
||
14 |
||
75393 | 15 |
object Isabelle_Cronjob { |
66897 | 16 |
/* global resources: owned by main cronjob */ |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
17 |
|
67766
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
18 |
val backup = "lxbroy10:cronjob" |
71601 | 19 |
val main_dir: Path = Path.explode("~/cronjob") |
20 |
val main_state_file: Path = main_dir + Path.explode("run/main.state") |
|
75551
4103b945c7b5
more informative release_snapshot, to see better where the cronjob fails;
wenzelm
parents:
75520
diff
changeset
|
21 |
val build_release_log: Path = main_dir + Path.explode("run/build_release.log") |
78877
45d570945fe4
more detailed progress for build_log_database, to see better what happens when;
wenzelm
parents:
78873
diff
changeset
|
22 |
val build_log_database_log: Path = main_dir + Path.explode("run/build_log_database.log") |
71601 | 23 |
val current_log: Path = main_dir + Path.explode("run/main.log") // owned by log service |
24 |
val cumulative_log: Path = main_dir + Path.explode("log/main.log") // owned by log service |
|
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
25 |
|
71601 | 26 |
val isabelle_repos: Path = main_dir + Path.explode("isabelle") |
27 |
val afp_repos: Path = main_dir + Path.explode("AFP") |
|
64236
358f9ff08681
discontinued somewhat pointless cronjob.options -- compile-time constants are sufficient;
wenzelm
parents:
64235
diff
changeset
|
28 |
|
72559 | 29 |
val mailman_archives_dir = Path.explode("~/cronjob/Mailman") |
30 |
||
66896 | 31 |
val build_log_dirs = |
32 |
List(Path.explode("~/log"), Path.explode("~/afp/log"), Path.explode("~/cronjob/log")) |
|
33 |
||
78872 | 34 |
val isabelle_devel: Path = Path.explode("~/html-data/devel") |
35 |
||
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
36 |
|
64192 | 37 |
|
67752
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
38 |
/** logger tasks **/ |
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
39 |
|
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
40 |
sealed case class Logger_Task(name: String = "", body: Logger => Unit) |
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
41 |
|
64192 | 42 |
|
67766
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
43 |
/* init and exit */ |
64192 | 44 |
|
67753
f28aee3ad1e6
uniform setup_repository (pull/clone without update);
wenzelm
parents:
67752
diff
changeset
|
45 |
def get_rev(): String = Mercurial.repository(isabelle_repos).id() |
f28aee3ad1e6
uniform setup_repository (pull/clone without update);
wenzelm
parents:
67752
diff
changeset
|
46 |
def get_afp_rev(): String = Mercurial.repository(afp_repos).id() |
f28aee3ad1e6
uniform setup_repository (pull/clone without update);
wenzelm
parents:
67752
diff
changeset
|
47 |
|
71601 | 48 |
val init: Logger_Task = |
75394 | 49 |
Logger_Task("init", |
50 |
{ logger => |
|
78872 | 51 |
val redirect = "https://isabelle-dev.sketis.net/home/menu/view/20" |
52 |
||
53 |
HTML.write_document(isabelle_devel, "index.html", |
|
54 |
List( |
|
55 |
XML.Elem(Markup("meta", |
|
56 |
List("http-equiv" -> "Refresh", "content" -> ("0; url=" + redirect))), Nil)), |
|
57 |
List(HTML.link(redirect, HTML.text("Isabelle Development Resources")))) |
|
65771 | 58 |
|
73611 | 59 |
Mercurial.setup_repository(Isabelle_System.afp_repository.root, afp_repos) |
64192 | 60 |
|
66859 | 61 |
File.write(logger.log_dir + Build_Log.log_filename("isabelle_identify", logger.start_date), |
67753
f28aee3ad1e6
uniform setup_repository (pull/clone without update);
wenzelm
parents:
67752
diff
changeset
|
62 |
Build_Log.Identify.content(logger.start_date, Some(get_rev()), Some(get_afp_rev()))) |
67766
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
63 |
|
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
64 |
Isabelle_System.bash( |
77788
c2ce9ac85859
use remote copy of locally installed rsync component: for uniform version and options;
wenzelm
parents:
77751
diff
changeset
|
65 |
File.bash_path(Component_Rsync.local_program) + |
c2ce9ac85859
use remote copy of locally installed rsync component: for uniform version and options;
wenzelm
parents:
77751
diff
changeset
|
66 |
""" -a --include="*/" --include="plain_identify*" --exclude="*" """ + |
69199 | 67 |
Bash.string(backup + "/log/.") + " " + File.bash_path(main_dir) + "/log/.").check |
67854
8374c80165e1
publish current log file, e.g. for easy error detection;
wenzelm
parents:
67775
diff
changeset
|
68 |
|
78872 | 69 |
val cronjob_log = isabelle_devel + Path.basic("cronjob-main.log") |
78871 | 70 |
if (!cronjob_log.is_file) { |
71 |
Files.createSymbolicLink(cronjob_log.java_path, current_log.java_path) |
|
78094 | 72 |
} |
67766
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
73 |
}) |
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
74 |
|
71601 | 75 |
val exit: Logger_Task = |
75394 | 76 |
Logger_Task("exit", |
77 |
{ logger => |
|
67766
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
78 |
Isabelle_System.bash( |
77788
c2ce9ac85859
use remote copy of locally installed rsync component: for uniform version and options;
wenzelm
parents:
77751
diff
changeset
|
79 |
File.bash_path(Component_Rsync.local_program) + |
c2ce9ac85859
use remote copy of locally installed rsync component: for uniform version and options;
wenzelm
parents:
77751
diff
changeset
|
80 |
" -a " + File.bash_path(main_dir) + "/log/." + " " + Bash.string(backup) + "/log/.") |
67769 | 81 |
.check |
67751 | 82 |
}) |
83 |
||
84 |
||
72559 | 85 |
/* Mailman archives */ |
86 |
||
87 |
val mailman_archives: Logger_Task = |
|
75394 | 88 |
Logger_Task("mailman_archives", |
89 |
{ logger => |
|
74921 | 90 |
Mailman.Isabelle_Users.download(mailman_archives_dir) |
91 |
Mailman.Isabelle_Dev.download(mailman_archives_dir) |
|
72559 | 92 |
}) |
93 |
||
94 |
||
67751 | 95 |
/* build release */ |
96 |
||
71601 | 97 |
val build_release: Logger_Task = |
75551
4103b945c7b5
more informative release_snapshot, to see better where the cronjob fails;
wenzelm
parents:
75520
diff
changeset
|
98 |
Logger_Task("build_release", { logger => |
4103b945c7b5
more informative release_snapshot, to see better where the cronjob fails;
wenzelm
parents:
75520
diff
changeset
|
99 |
build_release_log.file.delete |
78872 | 100 |
val rev = get_rev() |
101 |
val afp_rev = get_afp_rev() |
|
102 |
val progress = new File_Progress(build_release_log) |
|
103 |
||
104 |
Isabelle_System.with_tmp_dir("isadist") { target_dir => |
|
105 |
Isabelle_System.update_directory(isabelle_devel + Path.explode("release_snapshot"), |
|
106 |
{ website_dir => |
|
107 |
val context = Build_Release.Release_Context(target_dir, progress = progress) |
|
108 |
Build_Release.build_release_archive(context, rev) |
|
109 |
Build_Release.build_release(logger.options, context, afp_rev = afp_rev, |
|
110 |
build_sessions = List(Isabelle_System.getenv("ISABELLE_LOGIC")), |
|
111 |
website = Some(website_dir)) |
|
112 |
} |
|
113 |
) |
|
114 |
} |
|
75551
4103b945c7b5
more informative release_snapshot, to see better where the cronjob fails;
wenzelm
parents:
75520
diff
changeset
|
115 |
}) |
64192 | 116 |
|
117 |
||
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
118 |
/* remote build_history */ |
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
119 |
|
66864 | 120 |
sealed case class Item( |
121 |
known: Boolean, |
|
122 |
isabelle_version: String, |
|
123 |
afp_version: Option[String], |
|
75393 | 124 |
pull_date: Date |
125 |
) { |
|
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
126 |
def unknown: Boolean = !known |
66864 | 127 |
def versions: (String, Option[String]) = (isabelle_version, afp_version) |
128 |
||
129 |
def known_versions(rev: String, afp_rev: Option[String]): Boolean = |
|
130 |
known && rev != "" && isabelle_version == rev && |
|
71380
5965e6e3c3ec
proper comparison of Option values, following hint by IntelliJ;
wenzelm
parents:
70757
diff
changeset
|
131 |
(afp_rev.isEmpty || afp_rev.get != "" && afp_version == afp_rev) |
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
132 |
} |
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
133 |
|
75393 | 134 |
def recent_items( |
135 |
db: SQL.Database, |
|
136 |
days: Int, |
|
137 |
rev: String, |
|
138 |
afp_rev: Option[String], |
|
75968
5a782ca6872b
tuned signature: build_log db is specific to PostgreSQL;
wenzelm
parents:
75954
diff
changeset
|
139 |
sql: PostgreSQL.Source |
75393 | 140 |
): List[Item] = { |
66880
486f4af28db9
more thorough treatment of afp_version and afp_pull_date;
wenzelm
parents:
66879
diff
changeset
|
141 |
val afp = afp_rev.isDefined |
77552 | 142 |
|
143 |
db.execute_query_statement( |
|
78849 | 144 |
Build_Log.private_data.select_recent_versions( |
77581 | 145 |
days = days, rev = rev, afp_rev = afp_rev, sql = SQL.where(sql)), |
77552 | 146 |
List.from[Item], |
147 |
{ res => |
|
78849 | 148 |
val known = res.bool(Build_Log.private_data.known) |
65807 | 149 |
val isabelle_version = res.string(Build_Log.Prop.isabelle_version) |
66880
486f4af28db9
more thorough treatment of afp_version and afp_pull_date;
wenzelm
parents:
66879
diff
changeset
|
150 |
val afp_version = if (afp) proper_string(res.string(Build_Log.Prop.afp_version)) else None |
78849 | 151 |
val pull_date = res.date(Build_Log.private_data.pull_date(afp)) |
66864 | 152 |
Item(known, isabelle_version, afp_version, pull_date) |
77552 | 153 |
}) |
65807 | 154 |
} |
155 |
||
75393 | 156 |
def unknown_runs(items: List[Item]): List[List[Item]] = { |
65807 | 157 |
val (run, rest) = Library.take_prefix[Item](_.unknown, items.dropWhile(_.known)) |
158 |
if (run.nonEmpty) run :: unknown_runs(rest) else Nil |
|
159 |
} |
|
160 |
||
64409
70c87ca55f2c
tuned signature -- more friendly for experimentation;
wenzelm
parents:
64405
diff
changeset
|
161 |
sealed case class Remote_Build( |
65764 | 162 |
description: String, |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
163 |
host: String, |
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
164 |
user: String = "", |
65594 | 165 |
port: Int = 0, |
65789 | 166 |
history: Int = 0, |
65820 | 167 |
history_base: String = "build_history_base", |
77132
53ce5a39c987
more uniform components context for the managing "self_isabelle" and the managed "other_isabelle";
wenzelm
parents:
77131
diff
changeset
|
168 |
components_base: String = Components.dynamic_components_base, |
77135
515b6aaede32
enable clean_components by default: it saves a lot of local disk space, notably on virtual nodes;
wenzelm
parents:
77133
diff
changeset
|
169 |
clean_components: Boolean = true, |
71993 | 170 |
java_heap: String = "", |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
171 |
options: String = "", |
65732 | 172 |
args: String = "", |
66864 | 173 |
afp: Boolean = false, |
69693 | 174 |
bulky: Boolean = false, |
67075
eada9bd5fff2
avoid lxbroy7, which is presently inaccessible, but retain its build history in db queries;
wenzelm
parents:
67070
diff
changeset
|
175 |
more_hosts: List[String] = Nil, |
75968
5a782ca6872b
tuned signature: build_log db is specific to PostgreSQL;
wenzelm
parents:
75954
diff
changeset
|
176 |
detect: PostgreSQL.Source = "", |
77163
7ceed24c88dc
alternate AFP tests on lrzcloud2, to fit better into one day;
wenzelm
parents:
77135
diff
changeset
|
177 |
active: () => Boolean = () => true |
75393 | 178 |
) { |
76115
f17393e21388
clarified signature: discontinue somewhat pointless SSH.Context;
wenzelm
parents:
76027
diff
changeset
|
179 |
def open_session(options: Options): SSH.Session = |
76123
4a0b7151fedc
removed remains of proxy_host management: delegated to .ssh/config;
wenzelm
parents:
76122
diff
changeset
|
180 |
SSH.open_session(options, host = host, user = user, port = port) |
67750 | 181 |
|
75968
5a782ca6872b
tuned signature: build_log db is specific to PostgreSQL;
wenzelm
parents:
75954
diff
changeset
|
182 |
def sql: PostgreSQL.Source = |
77370 | 183 |
SQL.and( |
77375 | 184 |
Build_Log.Prop.build_engine.equal(Build_History.engine), |
185 |
Build_Log.Prop.build_host.member(host :: more_hosts), |
|
77370 | 186 |
if_proper(detect, SQL.enclose(detect))) |
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
187 |
|
65747 | 188 |
def profile: Build_Status.Profile = |
69693 | 189 |
Build_Status.Profile(description, history = history, afp = afp, bulky = bulky, sql = sql) |
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
190 |
|
78897 | 191 |
def pick(options: Options, filter: Item => Boolean): Option[(String, Option[String])] = { |
192 |
val rev = get_rev() |
|
67753
f28aee3ad1e6
uniform setup_repository (pull/clone without update);
wenzelm
parents:
67752
diff
changeset
|
193 |
val afp_rev = if (afp) Some(get_afp_rev()) else None |
66864 | 194 |
|
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
195 |
val store = Build_Log.store(options) |
75394 | 196 |
using(store.open_database()) { db => |
78901 | 197 |
def pick_recent(days: Int, gap: Int): Option[(String, Option[String])] = { |
66865 | 198 |
val items = recent_items(db, days, rev, afp_rev, sql).filter(filter) |
78906
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
199 |
val runs = unknown_runs(items).filter(run => run.length >= gap) |
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
200 |
val (longest_run, longest_length) = |
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
201 |
runs.foldLeft((List.empty[Item], 0)) { |
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
202 |
case (res@(item1, len1), item2) => |
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
203 |
val len2 = item2.length |
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
204 |
if (len1 >= len2) res else (item2, len2) |
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
205 |
} |
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
206 |
if (longest_run.isEmpty) None |
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
207 |
else Some(longest_run(longest_length / 2).versions) |
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
208 |
} |
65810 | 209 |
|
78901 | 210 |
pick_recent(options.int("build_log_history") max history, 2) orElse |
78906
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
211 |
pick_recent(300, 8) orElse |
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
212 |
pick_recent(3000, 32) orElse |
78902 | 213 |
pick_recent(0, 1) |
75394 | 214 |
} |
65747 | 215 |
} |
73239 | 216 |
|
217 |
def build_history_options: String = |
|
218 |
" -h " + Bash.string(host) + " " + |
|
77479 | 219 |
if_proper(java_heap, |
220 |
"-e 'ISABELLE_TOOL_JAVA_OPTIONS=\"$ISABELLE_TOOL_JAVA_OPTIONS -Xmx" + java_heap + "\"' ") + |
|
221 |
options |
|
65732 | 222 |
} |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
223 |
|
65806 | 224 |
val remote_builds_old: List[Remote_Build] = |
225 |
List( |
|
75954
7c72091abd55
disable laramac01 for now: system update pending;
wenzelm
parents:
75551
diff
changeset
|
226 |
Remote_Build("macOS 10.15 Catalina", "laramac01", user = "makarius", |
7c72091abd55
disable laramac01 for now: system update pending;
wenzelm
parents:
75551
diff
changeset
|
227 |
options = "-m32 -M4 -e ISABELLE_GHC_SETUP=true -p pide_session=false", |
7c72091abd55
disable laramac01 for now: system update pending;
wenzelm
parents:
75551
diff
changeset
|
228 |
args = "-a -d '~~/src/Benchmarks'"), |
73879 | 229 |
Remote_Build("Linux A", "i21of4", user = "i21isatest", |
230 |
options = "-m32 -M1x4,2,4" + |
|
231 |
" -e ISABELLE_OCAML=ocaml -e ISABELLE_OCAMLC=ocamlc -e ISABELLE_OCAML_SETUP=true" + |
|
232 |
" -e ISABELLE_GHC_SETUP=true" + |
|
233 |
" -e ISABELLE_MLTON=mlton" + |
|
234 |
" -e ISABELLE_SMLNJ=sml" + |
|
235 |
" -e ISABELLE_SWIPL=swipl", |
|
236 |
args = "-a -d '~~/src/Benchmarks'"), |
|
72391 | 237 |
Remote_Build("Linux A", "lxbroy9", |
238 |
java_heap = "2g", options = "-m32 -B -M1x2,2", args = "-N -g timing"), |
|
78906
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
239 |
Remote_Build("Linux Benchmarks", "lxbroy5", history = 90, |
72391 | 240 |
java_heap = "2g", |
241 |
options = "-m32 -B -M1x2,2 -t Benchmarks" + |
|
242 |
" -e ISABELLE_GHC=ghc -e ISABELLE_MLTON=mlton -e ISABELLE_OCAML=ocaml" + |
|
243 |
" -e ISABELLE_OCAMLC=ocamlc -e ISABELLE_OCAMLFIND=ocamlfind -e ISABELLE_SMLNJ=sml" + |
|
244 |
" -e ISABELLE_SWIPL=swipl", |
|
245 |
args = "-N -a -d '~~/src/Benchmarks'", |
|
73342 | 246 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("Benchmarks")), |
72894
bd2269b6cd99
updated "macOS" terminology: current Big Sur is already version 11;
wenzelm
parents:
72893
diff
changeset
|
247 |
Remote_Build("macOS 10.14 Mojave (Old)", "lapnipkow3", |
72390 | 248 |
options = "-m32 -M1,2 -e ISABELLE_GHC_SETUP=true -p pide_session=false", |
75520
65ecf4c5b868
removed obsolete self_update: always enabled, notably on lxbroy10 which is the only shared-home system (and still requires current isabelle_self);
wenzelm
parents:
75518
diff
changeset
|
249 |
args = "-a -d '~~/src/Benchmarks'"), |
65ecf4c5b868
removed obsolete self_update: always enabled, notably on lxbroy10 which is the only shared-home system (and still requires current isabelle_self);
wenzelm
parents:
75518
diff
changeset
|
250 |
Remote_Build("AFP old bulky", "lrzcloud1", |
70757 | 251 |
options = "-m64 -M6 -U30000 -s10 -t AFP", |
252 |
args = "-g large -g slow", |
|
253 |
afp = true, |
|
254 |
bulky = true, |
|
73342 | 255 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("AFP")), |
72073 | 256 |
Remote_Build("AFP old", "lxbroy7", |
69693 | 257 |
args = "-N -X large -X slow", |
67608 | 258 |
afp = true, |
73342 | 259 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("AFP")), |
66762 | 260 |
Remote_Build("Poly/ML 5.7 Linux", "lxbroy8", |
261 |
history_base = "37074e22e8be", |
|
262 |
options = "-m32 -B -M1x2,2 -t polyml-5.7 -i 'init_component /home/isabelle/contrib/polyml-5.7'", |
|
263 |
args = "-N -g timing", |
|
73342 | 264 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("polyml-5.7") + " AND " + |
66762 | 265 |
Build_Log.Settings.ML_OPTIONS + " <> " + SQL.string("-H 500")), |
66931 | 266 |
Remote_Build("Poly/ML 5.7.1 Linux", "lxbroy8", |
267 |
history_base = "a9d5b59c3e12", |
|
268 |
options = "-m32 -B -M1x2,2 -t polyml-5.7.1-pre2 -i 'init_component /home/isabelle/contrib/polyml-test-905dae2ebfda'", |
|
269 |
args = "-N -g timing", |
|
270 |
detect = |
|
73342 | 271 |
Build_Log.Prop.build_tags.toString + " = " + SQL.string("polyml-5.7.1-pre1") + " OR " + |
66931 | 272 |
Build_Log.Prop.build_tags + " = " + SQL.string("polyml-5.7.1-pre2")), |
72894
bd2269b6cd99
updated "macOS" terminology: current Big Sur is already version 11;
wenzelm
parents:
72893
diff
changeset
|
273 |
Remote_Build("Poly/ML 5.7 macOS", "macbroy2", |
66762 | 274 |
history_base = "37074e22e8be", |
275 |
options = "-m32 -B -M1x4,4 -t polyml-5.7 -i 'init_component /home/isabelle/contrib/polyml-5.7'", |
|
276 |
args = "-a", |
|
73342 | 277 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("polyml-5.7")), |
72894
bd2269b6cd99
updated "macOS" terminology: current Big Sur is already version 11;
wenzelm
parents:
72893
diff
changeset
|
278 |
Remote_Build("Poly/ML 5.7.1 macOS", "macbroy2", |
66931 | 279 |
history_base = "a9d5b59c3e12", |
280 |
options = "-m32 -B -M1x4,4 -t polyml-5.7.1-pre2 -i 'init_component /home/isabelle/contrib/polyml-test-905dae2ebfda'", |
|
281 |
args = "-a", |
|
282 |
detect = |
|
73342 | 283 |
Build_Log.Prop.build_tags.toString + " = " + SQL.string("polyml-5.7.1-pre1") + " OR " + |
284 |
Build_Log.Prop.build_tags + " = " + SQL.string("polyml-5.7.1-pre2")), |
|
72894
bd2269b6cd99
updated "macOS" terminology: current Big Sur is already version 11;
wenzelm
parents:
72893
diff
changeset
|
285 |
Remote_Build("macOS", "macbroy2", |
72893 | 286 |
options = "-m32 -M8" + |
287 |
" -e ISABELLE_GHC=ghc -e ISABELLE_MLTON=mlton -e ISABELLE_OCAML=ocaml" + |
|
288 |
" -e ISABELLE_OCAMLC=ocamlc -e ISABELLE_OCAML_SETUP=true" + |
|
289 |
" -e ISABELLE_OPAM_ROOT=\"$ISABELLE_HOME/opam\"" + |
|
290 |
" -e ISABELLE_SMLNJ=/home/isabelle/smlnj/110.85/bin/sml" + |
|
291 |
" -p pide_session=false", |
|
292 |
args = "-a", |
|
293 |
detect = Build_Log.Prop.build_tags.undefined, |
|
294 |
history_base = "2c0f24e927dd"), |
|
72894
bd2269b6cd99
updated "macOS" terminology: current Big Sur is already version 11;
wenzelm
parents:
72893
diff
changeset
|
295 |
Remote_Build("macOS, quick_and_dirty", "macbroy2", |
72893 | 296 |
options = "-m32 -M8 -t quick_and_dirty -p pide_session=false", args = "-a -o quick_and_dirty", |
73342 | 297 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("quick_and_dirty"), |
72893 | 298 |
history_base = "2c0f24e927dd"), |
72894
bd2269b6cd99
updated "macOS" terminology: current Big Sur is already version 11;
wenzelm
parents:
72893
diff
changeset
|
299 |
Remote_Build("macOS, skip_proofs", "macbroy2", |
72893 | 300 |
options = "-m32 -M8 -t skip_proofs -p pide_session=false", args = "-a -o skip_proofs", |
73342 | 301 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("skip_proofs"), |
72893 | 302 |
history_base = "2c0f24e927dd"), |
65806 | 303 |
Remote_Build("Poly/ML test", "lxbroy8", |
65843
d547173212d2
proper init_settings for init_component (before generated ML_OPTIONS etc.);
wenzelm
parents:
65840
diff
changeset
|
304 |
options = "-m32 -B -M1x2,2 -t polyml-test -i 'init_component /home/isabelle/contrib/polyml-5.7-20170217'", |
65806 | 305 |
args = "-N -g timing", |
73342 | 306 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("polyml-test")), |
72894
bd2269b6cd99
updated "macOS" terminology: current Big Sur is already version 11;
wenzelm
parents:
72893
diff
changeset
|
307 |
Remote_Build("macOS 10.12 Sierra", "macbroy30", options = "-m32 -M2 -p pide_session=false", args = "-a", |
73342 | 308 |
detect = Build_Log.Prop.build_start.toString + " > date '2017-03-03'"), |
72894
bd2269b6cd99
updated "macOS" terminology: current Big Sur is already version 11;
wenzelm
parents:
72893
diff
changeset
|
309 |
Remote_Build("macOS 10.10 Yosemite", "macbroy31", options = "-m32 -M2 -p pide_session=false", args = "-a"), |
bd2269b6cd99
updated "macOS" terminology: current Big Sur is already version 11;
wenzelm
parents:
72893
diff
changeset
|
310 |
Remote_Build("macOS 10.8 Mountain Lion", "macbroy30", options = "-m32 -M2", args = "-a", |
73342 | 311 |
detect = Build_Log.Prop.build_start.toString + " < date '2017-03-03'")) ::: |
71974
e5fe4d40326d
discontinued old AFP test: ancient hardware with insufficient resources;
wenzelm
parents:
71761
diff
changeset
|
312 |
{ |
78094 | 313 |
for ((n, hosts) <- List(1 -> List("lxbroy6"), 2 -> List("lxbroy8", "lxbroy5"))) |
71974
e5fe4d40326d
discontinued old AFP test: ancient hardware with insufficient resources;
wenzelm
parents:
71761
diff
changeset
|
314 |
yield { |
72073 | 315 |
Remote_Build("AFP old", host = hosts.head, more_hosts = hosts.tail, |
71974
e5fe4d40326d
discontinued old AFP test: ancient hardware with insufficient resources;
wenzelm
parents:
71761
diff
changeset
|
316 |
options = "-m32 -M1x2 -t AFP -P" + n + |
e5fe4d40326d
discontinued old AFP test: ancient hardware with insufficient resources;
wenzelm
parents:
71761
diff
changeset
|
317 |
" -e ISABELLE_GHC=ghc" + |
e5fe4d40326d
discontinued old AFP test: ancient hardware with insufficient resources;
wenzelm
parents:
71761
diff
changeset
|
318 |
" -e ISABELLE_MLTON=mlton" + |
e5fe4d40326d
discontinued old AFP test: ancient hardware with insufficient resources;
wenzelm
parents:
71761
diff
changeset
|
319 |
" -e ISABELLE_OCAML=ocaml -e ISABELLE_OCAMLC=ocamlc -e ISABELLE_OCAMLFIND=ocamlfind" + |
e5fe4d40326d
discontinued old AFP test: ancient hardware with insufficient resources;
wenzelm
parents:
71761
diff
changeset
|
320 |
" -e ISABELLE_SMLNJ=sml", |
e5fe4d40326d
discontinued old AFP test: ancient hardware with insufficient resources;
wenzelm
parents:
71761
diff
changeset
|
321 |
args = "-N -X large -X slow", |
e5fe4d40326d
discontinued old AFP test: ancient hardware with insufficient resources;
wenzelm
parents:
71761
diff
changeset
|
322 |
afp = true, |
73342 | 323 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("AFP")) |
71974
e5fe4d40326d
discontinued old AFP test: ancient hardware with insufficient resources;
wenzelm
parents:
71761
diff
changeset
|
324 |
} |
e5fe4d40326d
discontinued old AFP test: ancient hardware with insufficient resources;
wenzelm
parents:
71761
diff
changeset
|
325 |
} |
65806 | 326 |
|
75393 | 327 |
val remote_builds1: List[List[Remote_Build]] = { |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
328 |
List( |
74386
40804452ab6b
recover some Linux test, using virtual machine node (Ubuntu 20.04, 4 cores, 16 GB);
wenzelm
parents:
73945
diff
changeset
|
329 |
List(Remote_Build("Linux A", "augsburg1", |
74855
a5eb407ec867
clarified tests: omit somewhat pointless (unstable) results;
wenzelm
parents:
74459
diff
changeset
|
330 |
options = "-m32 -B -M4" + |
74459 | 331 |
" -e ISABELLE_OCAML=ocaml -e ISABELLE_OCAMLC=ocamlc -e ISABELLE_OCAMLFIND=ocamlfind" + |
74386
40804452ab6b
recover some Linux test, using virtual machine node (Ubuntu 20.04, 4 cores, 16 GB);
wenzelm
parents:
73945
diff
changeset
|
332 |
" -e ISABELLE_GHC_SETUP=true" + |
76181
d27ed188e0c4
support for ISABELLE_MLTON_OPTIONS, notably for Ubuntu 22.04 with external mlton executable;
wenzelm
parents:
76123
diff
changeset
|
333 |
" -e ISABELLE_MLTON=mlton -e ISABELLE_MLTON_OPTIONS=" + |
74386
40804452ab6b
recover some Linux test, using virtual machine node (Ubuntu 20.04, 4 cores, 16 GB);
wenzelm
parents:
73945
diff
changeset
|
334 |
" -e ISABELLE_SMLNJ=sml" + |
40804452ab6b
recover some Linux test, using virtual machine node (Ubuntu 20.04, 4 cores, 16 GB);
wenzelm
parents:
73945
diff
changeset
|
335 |
" -e ISABELLE_SWIPL=swipl", |
75520
65ecf4c5b868
removed obsolete self_update: always enabled, notably on lxbroy10 which is the only shared-home system (and still requires current isabelle_self);
wenzelm
parents:
75518
diff
changeset
|
336 |
args = "-a -d '~~/src/Benchmarks'")), |
78906
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
337 |
List(Remote_Build("Linux B", "lxbroy10", history = 90, |
65732 | 338 |
options = "-m32 -B -M1x4,2,4,6", args = "-N -g timing")), |
72893 | 339 |
List( |
78777
3b424f9cd5eb
update platforms: discontinue macOS 10.13 High Sierra, macOS 10.14 Mojave, macOS 10.15 Catalina;
wenzelm
parents:
78771
diff
changeset
|
340 |
Remote_Build("macOS 11 Big Sur (Intel)", "mini1", |
73141 | 341 |
options = "-m32 -B -M1x2,2,4 -p pide_session=false" + |
342 |
" -e ISABELLE_OCAML=ocaml -e ISABELLE_OCAMLC=ocamlc -e ISABELLE_OCAML_SETUP=true" + |
|
343 |
" -e ISABELLE_GHC_SETUP=true" + |
|
76181
d27ed188e0c4
support for ISABELLE_MLTON_OPTIONS, notably for Ubuntu 22.04 with external mlton executable;
wenzelm
parents:
76123
diff
changeset
|
344 |
" -e ISABELLE_MLTON=/usr/local/bin/mlton -e ISABELLE_MLTON_OPTIONS=" + |
73141 | 345 |
" -e ISABELLE_SMLNJ=/usr/local/smlnj/bin/sml" + |
346 |
" -e ISABELLE_SWIPL=/usr/local/bin/swipl", |
|
75520
65ecf4c5b868
removed obsolete self_update: always enabled, notably on lxbroy10 which is the only shared-home system (and still requires current isabelle_self);
wenzelm
parents:
75518
diff
changeset
|
347 |
args = "-a -d '~~/src/Benchmarks'")), |
78905 | 348 |
Library.replicate(2, |
349 |
Remote_Build("macOS 14 Sonoma (ARM)", "studio1-sonoma", |
|
350 |
history_base = "8e590adaac5e", |
|
351 |
options = "-m32 -B -M1x4,2x4,4x2,8 -p pide_session=false" + |
|
352 |
" -e ISABELLE_GHC_SETUP=true" + |
|
353 |
" -e ISABELLE_SMLNJ=/usr/local/smlnj/bin/sml" + |
|
354 |
" -e ISABELLE_SWIPL=/opt/homebrew/bin/swipl", |
|
355 |
args = "-a -d '~~/src/Benchmarks'")), |
|
78784 | 356 |
List( |
72894
bd2269b6cd99
updated "macOS" terminology: current Big Sur is already version 11;
wenzelm
parents:
72893
diff
changeset
|
357 |
Remote_Build("macOS, quick_and_dirty", "mini2", |
72893 | 358 |
options = "-m32 -M4 -t quick_and_dirty -p pide_session=false", |
75520
65ecf4c5b868
removed obsolete self_update: always enabled, notably on lxbroy10 which is the only shared-home system (and still requires current isabelle_self);
wenzelm
parents:
75518
diff
changeset
|
359 |
args = "-a -o quick_and_dirty", |
78744 | 360 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("quick_and_dirty"), |
361 |
active = () => false), |
|
72894
bd2269b6cd99
updated "macOS" terminology: current Big Sur is already version 11;
wenzelm
parents:
72893
diff
changeset
|
362 |
Remote_Build("macOS, skip_proofs", "mini2", |
72893 | 363 |
options = "-m32 -M4 -t skip_proofs -p pide_session=false", args = "-a -o skip_proofs", |
78744 | 364 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("skip_proofs"), |
365 |
active = () => false)), |
|
78905 | 366 |
Library.replicate(3, |
367 |
Remote_Build("macOS 13 Ventura (ARM)", "mini3", |
|
368 |
history_base = "8e590adaac5e", |
|
369 |
options = "-a -m32 -B -M1x4,2x2,4 -p pide_session=false" + |
|
370 |
" -e ISABELLE_GHC_SETUP=true" + |
|
371 |
" -e ISABELLE_MLTON=/opt/homebrew/bin/mlton -e ISABELLE_MLTON_OPTIONS=" + |
|
372 |
" -e ISABELLE_SWIPL=/opt/homebrew/bin/swipl", |
|
373 |
args = "-a -d '~~/src/Benchmarks'")), |
|
78485 | 374 |
List( |
78906
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
375 |
Remote_Build("Windows", "vmnipkow9", history = 90, |
77132
53ce5a39c987
more uniform components context for the managing "self_isabelle" and the managed "other_isabelle";
wenzelm
parents:
77131
diff
changeset
|
376 |
components_base = "/cygdrive/d/isatest/contrib", |
65906 | 377 |
options = "-m32 -M4" + |
69931
31ee094dea3d
prefer ISABELLE_OCAML_SETUP: Cygwin lacks libzarith;
wenzelm
parents:
69927
diff
changeset
|
378 |
" -e ISABELLE_OCAML=ocaml -e ISABELLE_OCAMLC=ocamlc -e ISABELLE_OCAML_SETUP=true" + |
69952 | 379 |
" -e ISABELLE_GHC_SETUP=true" + |
65906 | 380 |
" -e ISABELLE_SMLNJ=/usr/local/smlnj-110.81/bin/sml", |
65902 | 381 |
args = "-a", |
72317 | 382 |
detect = |
73342 | 383 |
Build_Log.Settings.ML_PLATFORM.toString + " = " + SQL.string("x86-windows") + " OR " + |
72317 | 384 |
Build_Log.Settings.ML_PLATFORM + " = " + SQL.string("x86_64_32-windows")), |
78906
004b39bf06a5
clarified exploration of history: more uniform options;
wenzelm
parents:
78905
diff
changeset
|
385 |
Remote_Build("Windows", "vmnipkow9", history = 90, |
77132
53ce5a39c987
more uniform components context for the managing "self_isabelle" and the managed "other_isabelle";
wenzelm
parents:
77131
diff
changeset
|
386 |
components_base = "/cygdrive/d/isatest/contrib", |
65906 | 387 |
options = "-m64 -M4" + |
72997
a562a0f656e8
more robust components_base: avoid fragile directory links on Windows (or Cygwin);
wenzelm
parents:
72994
diff
changeset
|
388 |
" -C /cygdrive/d/isatest/contrib" + |
69931
31ee094dea3d
prefer ISABELLE_OCAML_SETUP: Cygwin lacks libzarith;
wenzelm
parents:
69927
diff
changeset
|
389 |
" -e ISABELLE_OCAML=ocaml -e ISABELLE_OCAMLC=ocamlc -e ISABELLE_OCAML_SETUP=true" + |
69952 | 390 |
" -e ISABELLE_GHC_SETUP=true" + |
65906 | 391 |
" -e ISABELLE_SMLNJ=/usr/local/smlnj-110.81/bin/sml", |
65902 | 392 |
args = "-a", |
73342 | 393 |
detect = Build_Log.Settings.ML_PLATFORM.toString + " = " + SQL.string("x86_64-windows")))) |
65732 | 394 |
} |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
395 |
|
66898
8b7c4679c05b
parallel remote_builds2 for the sake of "AFP slow" (with theoretical data race on build_log_dirs);
wenzelm
parents:
66897
diff
changeset
|
396 |
val remote_builds2: List[List[Remote_Build]] = |
8b7c4679c05b
parallel remote_builds2 for the sake of "AFP slow" (with theoretical data race on build_log_dirs);
wenzelm
parents:
66897
diff
changeset
|
397 |
List( |
8b7c4679c05b
parallel remote_builds2 for the sake of "AFP slow" (with theoretical data race on build_log_dirs);
wenzelm
parents:
66897
diff
changeset
|
398 |
List( |
78451 | 399 |
Remote_Build("AFP", "lrzcloud2", history = 120, |
71993 | 400 |
java_heap = "8g", |
77171
e0e9f1b4c844
less ambitious parallelism: avoid exhaustion of memory (40GB total);
wenzelm
parents:
77163
diff
changeset
|
401 |
options = "-m32 -M1x5 -t AFP" + |
70467 | 402 |
" -e ISABELLE_GHC=ghc" + |
76181
d27ed188e0c4
support for ISABELLE_MLTON_OPTIONS, notably for Ubuntu 22.04 with external mlton executable;
wenzelm
parents:
76123
diff
changeset
|
403 |
" -e ISABELLE_MLTON=mlton -e ISABELLE_MLTON_OPTIONS=" + |
70467 | 404 |
" -e ISABELLE_OCAML=ocaml -e ISABELLE_OCAMLC=ocamlc -e ISABELLE_OCAMLFIND=ocamlfind" + |
405 |
" -e ISABELLE_SMLNJ=sml", |
|
70477 | 406 |
args = "-a -X large -X slow", |
70467 | 407 |
afp = true, |
77163
7ceed24c88dc
alternate AFP tests on lrzcloud2, to fit better into one day;
wenzelm
parents:
77135
diff
changeset
|
408 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("AFP"), |
7ceed24c88dc
alternate AFP tests on lrzcloud2, to fit better into one day;
wenzelm
parents:
77135
diff
changeset
|
409 |
active = () => Date.now().unix_epoch_day % 2 == 0), |
76123
4a0b7151fedc
removed remains of proxy_host management: delegated to .ssh/config;
wenzelm
parents:
76122
diff
changeset
|
410 |
Remote_Build("AFP", "lrzcloud2", |
71993 | 411 |
java_heap = "8g", |
412 |
options = "-m64 -M8 -U30000 -s10 -t AFP", |
|
70467 | 413 |
args = "-g large -g slow", |
414 |
afp = true, |
|
415 |
bulky = true, |
|
77163
7ceed24c88dc
alternate AFP tests on lrzcloud2, to fit better into one day;
wenzelm
parents:
77135
diff
changeset
|
416 |
detect = Build_Log.Prop.build_tags.toString + " = " + SQL.string("AFP"), |
7ceed24c88dc
alternate AFP tests on lrzcloud2, to fit better into one day;
wenzelm
parents:
77135
diff
changeset
|
417 |
active = () => Date.now().unix_epoch_day % 2 == 1))) |
66898
8b7c4679c05b
parallel remote_builds2 for the sake of "AFP slow" (with theoretical data race on build_log_dirs);
wenzelm
parents:
66897
diff
changeset
|
418 |
|
75393 | 419 |
def remote_build_history( |
420 |
rev: String, |
|
421 |
afp_rev: Option[String], |
|
422 |
i: Int, |
|
78885 | 423 |
r: Remote_Build, |
424 |
progress: Progress = new Progress |
|
75393 | 425 |
) : Logger_Task = { |
64294
303976a45afe
shared_home is default for classic isatest home setup;
wenzelm
parents:
64277
diff
changeset
|
426 |
val task_name = "build_history-" + r.host |
75394 | 427 |
Logger_Task(task_name, |
428 |
{ logger => |
|
76115
f17393e21388
clarified signature: discontinue somewhat pointless SSH.Context;
wenzelm
parents:
76027
diff
changeset
|
429 |
using(r.open_session(logger.options)) { ssh => |
75394 | 430 |
val results = |
75518
cb4af8c6152f
clarified remote vs. local build_history: operate on hg_sync directory instead of repository;
wenzelm
parents:
75498
diff
changeset
|
431 |
Build_History.remote_build(ssh, |
75394 | 432 |
isabelle_repos, |
433 |
isabelle_repos.ext(r.host), |
|
434 |
isabelle_identifier = "cronjob_build_history", |
|
77132
53ce5a39c987
more uniform components context for the managing "self_isabelle" and the managed "other_isabelle";
wenzelm
parents:
77131
diff
changeset
|
435 |
components_base = r.components_base, |
77131 | 436 |
clean_platform = r.clean_components, |
77125 | 437 |
clean_archives = r.clean_components, |
75394 | 438 |
rev = rev, |
75518
cb4af8c6152f
clarified remote vs. local build_history: operate on hg_sync directory instead of repository;
wenzelm
parents:
75498
diff
changeset
|
439 |
afp_repos = if (afp_rev.isDefined) Some(afp_repos) else None, |
cb4af8c6152f
clarified remote vs. local build_history: operate on hg_sync directory instead of repository;
wenzelm
parents:
75498
diff
changeset
|
440 |
afp_rev = afp_rev.getOrElse(""), |
75394 | 441 |
options = |
442 |
" -N " + Bash.string(task_name) + (if (i < 0) "" else "_" + (i + 1).toString) + |
|
77083 | 443 |
" -f " + r.build_history_options, |
78860
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
444 |
|
75394 | 445 |
args = "-o timeout=10800 " + r.args) |
64346 | 446 |
|
78860
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
447 |
val log_files = |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
448 |
for ((log_name, bytes) <- results) yield { |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
449 |
val log_file = logger.log_dir + Path.explode(log_name) |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
450 |
logger.log(Date.now(), log_name) |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
451 |
Bytes.write(log_file, bytes) |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
452 |
log_file |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
453 |
} |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
454 |
|
78885 | 455 |
Build_Log.build_log_database(logger.options, log_files, |
456 |
progress = progress, ml_statistics = true) |
|
75394 | 457 |
} |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
458 |
}) |
64294
303976a45afe
shared_home is default for classic isatest home setup;
wenzelm
parents:
64277
diff
changeset
|
459 |
} |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
460 |
|
65747 | 461 |
val build_status_profiles: List[Build_Status.Profile] = |
66898
8b7c4679c05b
parallel remote_builds2 for the sake of "AFP slow" (with theoretical data race on build_log_dirs);
wenzelm
parents:
66897
diff
changeset
|
462 |
(remote_builds_old :: remote_builds1 ::: remote_builds2).flatten.map(_.profile) |
65747 | 463 |
|
65746 | 464 |
|
64192 | 465 |
|
466 |
/** task logging **/ |
|
64171 | 467 |
|
75393 | 468 |
object Log_Service { |
71726
a5fda30edae2
clarified signature: more uniform treatment of stopped/interrupted state;
wenzelm
parents:
71684
diff
changeset
|
469 |
def apply(options: Options, progress: Progress = new Progress): Log_Service = |
76115
f17393e21388
clarified signature: discontinue somewhat pointless SSH.Context;
wenzelm
parents:
76027
diff
changeset
|
470 |
new Log_Service(options, progress) |
67752
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
471 |
} |
64154 | 472 |
|
76115
f17393e21388
clarified signature: discontinue somewhat pointless SSH.Context;
wenzelm
parents:
76027
diff
changeset
|
473 |
class Log_Service private(val options: Options, progress: Progress) { |
64219 | 474 |
current_log.file.delete |
475 |
||
64171 | 476 |
private val thread: Consumer_Thread[String] = |
477 |
Consumer_Thread.fork("cronjob: logger", daemon = true)( |
|
75394 | 478 |
consume = |
479 |
{ (text: String) => |
|
75393 | 480 |
// critical |
64219 | 481 |
File.append(current_log, text + "\n") |
482 |
File.append(cumulative_log, text + "\n") |
|
64171 | 483 |
progress.echo(text) |
484 |
true |
|
485 |
}) |
|
486 |
||
73340 | 487 |
def shutdown(): Unit = { thread.shutdown() } |
64171 | 488 |
|
71601 | 489 |
val hostname: String = Isabelle_System.hostname() |
64171 | 490 |
|
491 |
def log(date: Date, task_name: String, msg: String): Unit = |
|
76365 | 492 |
if (task_name != "") { |
64193 | 493 |
thread.send( |
494 |
"[" + Build_Log.print_date(date) + ", " + hostname + ", " + task_name + "]: " + msg) |
|
76365 | 495 |
} |
64171 | 496 |
|
497 |
def start_logger(start_date: Date, task_name: String): Logger = |
|
498 |
new Logger(this, start_date, task_name) |
|
64154 | 499 |
|
75393 | 500 |
def run_task(start_date: Date, task: Logger_Task): Unit = { |
64171 | 501 |
val logger = start_logger(start_date, task.name) |
78768
280a228dc2f1
prefer Exn.result: avoid accidental capture of interrupts, similar to ML;
wenzelm
parents:
78744
diff
changeset
|
502 |
val res = Exn.result { task.body(logger) } |
64171 | 503 |
val end_date = Date.now() |
504 |
val err = |
|
505 |
res match { |
|
506 |
case Exn.Res(_) => None |
|
64295 | 507 |
case Exn.Exn(exn) => |
67178 | 508 |
Output.writeln("Exception trace for " + quote(task.name) + ":") |
64397 | 509 |
exn.printStackTrace() |
66923 | 510 |
val first_line = split_lines(Exn.message(exn)).headOption getOrElse "exception" |
64295 | 511 |
Some(first_line) |
64171 | 512 |
} |
513 |
logger.log_end(end_date, err) |
|
514 |
} |
|
515 |
||
516 |
def fork_task(start_date: Date, task: Logger_Task): Task = |
|
517 |
new Task(task.name, run_task(start_date, task)) |
|
518 |
} |
|
519 |
||
520 |
class Logger private[Isabelle_Cronjob]( |
|
76115
f17393e21388
clarified signature: discontinue somewhat pointless SSH.Context;
wenzelm
parents:
76027
diff
changeset
|
521 |
log_service: Log_Service, |
75393 | 522 |
val start_date: Date, |
523 |
val task_name: String |
|
524 |
) { |
|
76115
f17393e21388
clarified signature: discontinue somewhat pointless SSH.Context;
wenzelm
parents:
76027
diff
changeset
|
525 |
def options: Options = log_service.options |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
526 |
|
64171 | 527 |
def log(date: Date, msg: String): Unit = log_service.log(date, task_name, msg) |
528 |
||
75393 | 529 |
def log_end(end_date: Date, err: Option[String]): Unit = { |
64171 | 530 |
val elapsed_time = end_date.time - start_date.time |
531 |
val msg = |
|
532 |
(if (err.isEmpty) "finished" else "ERROR " + err.get) + |
|
64197 | 533 |
(if (elapsed_time.seconds < 3.0) "" else " (" + elapsed_time.message_hms + " elapsed time)") |
64171 | 534 |
log(end_date, msg) |
535 |
} |
|
536 |
||
72376 | 537 |
val log_dir = Isabelle_System.make_directory(main_dir + Build_Log.log_subdir(start_date)) |
64195 | 538 |
|
64171 | 539 |
log(start_date, "started") |
540 |
} |
|
541 |
||
75393 | 542 |
class Task private[Isabelle_Cronjob](name: String, body: => Unit) { |
64171 | 543 |
private val future: Future[Unit] = Future.thread("cronjob: " + name) { body } |
544 |
def is_finished: Boolean = future.is_finished |
|
64162 | 545 |
} |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
546 |
|
64170 | 547 |
|
548 |
||
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
549 |
/** cronjob **/ |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
550 |
|
75393 | 551 |
def cronjob(progress: Progress, exclude_task: Set[String]): Unit = { |
64171 | 552 |
/* soft lock */ |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
553 |
|
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
554 |
val still_running = |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
555 |
try { Some(File.read(main_state_file)) } |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
556 |
catch { case ERROR(_) => None } |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
557 |
|
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
558 |
still_running match { |
64170 | 559 |
case None | Some("") => |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
560 |
case Some(running) => |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
561 |
error("Isabelle cronjob appears to be still running: " + running) |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
562 |
} |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
563 |
|
64199 | 564 |
|
565 |
/* log service */ |
|
566 |
||
67752
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
567 |
val log_service = Log_Service(Options.init(), progress = progress) |
64154 | 568 |
|
73340 | 569 |
def run(start_date: Date, task: Logger_Task): Unit = log_service.run_task(start_date, task) |
64199 | 570 |
|
73340 | 571 |
def run_now(task: Logger_Task): Unit = run(Date.now(), task) |
64154 | 572 |
|
573 |
||
64199 | 574 |
/* structured tasks */ |
64184 | 575 |
|
78870
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
576 |
def SEQ(tasks: List[() => Option[Logger_Task]]): Logger_Task = |
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
577 |
Logger_Task(body = _ => |
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
578 |
for { |
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
579 |
t <- tasks.iterator |
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
580 |
task <- t() |
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
581 |
if !exclude_task(task.name) || task.name == "" |
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
582 |
} run_now(task)) |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
583 |
|
78869 | 584 |
def SEQUENTIAL(tasks: Logger_Task*): Logger_Task = |
78870
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
585 |
SEQ(List.from(for (task <- tasks.iterator) yield () => Some(task))) |
78869 | 586 |
|
75394 | 587 |
def PAR(tasks: List[Logger_Task]): Logger_Task = |
588 |
Logger_Task(body = |
|
589 |
{ _ => |
|
590 |
@tailrec def join(running: List[Task]): Unit = { |
|
591 |
running.partition(_.is_finished) match { |
|
592 |
case (Nil, Nil) => |
|
593 |
case (Nil, _ :: _) => Time.seconds(0.5).sleep(); join(running) |
|
594 |
case (_ :: _, remaining) => join(remaining) |
|
595 |
} |
|
64199 | 596 |
} |
75394 | 597 |
val start_date = Date.now() |
598 |
val running = |
|
599 |
for (task <- tasks if !exclude_task(task.name)) |
|
600 |
yield log_service.fork_task(start_date, task) |
|
601 |
join(running) |
|
602 |
}) |
|
64193 | 603 |
|
64170 | 604 |
|
66897 | 605 |
/* repository structure */ |
64199 | 606 |
|
65820 | 607 |
val hg = Mercurial.repository(isabelle_repos) |
66895 | 608 |
val hg_graph = hg.graph() |
67048
ec438988b65a
local user_home for improved performance, but only after given changeset for stability of measurement history;
wenzelm
parents:
67008
diff
changeset
|
609 |
|
75393 | 610 |
def history_base_filter(r: Remote_Build): Item => Boolean = { |
66895 | 611 |
val base_rev = hg.id(r.history_base) |
612 |
val nodes = hg_graph.all_succs(List(base_rev)).toSet |
|
613 |
(item: Item) => nodes(item.isabelle_version) |
|
614 |
} |
|
615 |
||
66897 | 616 |
|
617 |
/* main */ |
|
618 |
||
619 |
val main_start_date = Date.now() |
|
73342 | 620 |
File.write(main_state_file, main_start_date.toString + " " + log_service.hostname) |
66897 | 621 |
|
78877
45d570945fe4
more detailed progress for build_log_database, to see better what happens when;
wenzelm
parents:
78873
diff
changeset
|
622 |
val build_log_database_progress = new File_Progress(build_log_database_log, verbose = true) |
78896 | 623 |
build_log_database_progress.echo( |
624 |
"Started at " + Build_Log.print_date(build_log_database_progress.start)) |
|
78877
45d570945fe4
more detailed progress for build_log_database, to see better what happens when;
wenzelm
parents:
78873
diff
changeset
|
625 |
|
64193 | 626 |
run(main_start_date, |
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
627 |
Logger_Task("isabelle_cronjob", logger => |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
628 |
run_now( |
78869 | 629 |
SEQUENTIAL( |
67766
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
630 |
init, |
78860
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
631 |
PAR( |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
632 |
List( |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
633 |
mailman_archives, |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
634 |
build_release, |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
635 |
Logger_Task("build_log_database", |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
636 |
logger => |
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
637 |
Build_Log.build_log_database(logger.options, build_log_dirs, |
78877
45d570945fe4
more detailed progress for build_log_database, to see better what happens when;
wenzelm
parents:
78873
diff
changeset
|
638 |
progress = build_log_database_progress, |
78860
4838a27794ac
performance tuning: parallel and incremental update of build_log_database;
wenzelm
parents:
78849
diff
changeset
|
639 |
vacuum = true, ml_statistics = true, |
78872 | 640 |
snapshot = Some(isabelle_devel + Path.explode("build_log.db")))))), |
67766
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
641 |
PAR( |
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
642 |
List(remote_builds1, remote_builds2).map(remote_builds => |
78870
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
643 |
SEQUENTIAL( |
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
644 |
PAR(remote_builds.map(_.filter(_.active())).map(seq => |
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
645 |
SEQ( |
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
646 |
for { |
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
647 |
(r, i) <- (if (seq.length <= 1) seq.map((_, -1)) else seq.zipWithIndex) |
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
648 |
} yield () => { |
78897 | 649 |
r.pick(logger.options, history_base_filter(r)) |
78885 | 650 |
.map({ case (rev, afp_rev) => |
651 |
remote_build_history(rev, afp_rev, i, r, |
|
652 |
progress = build_log_database_progress) }) |
|
78870
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
653 |
} |
674362fd8c96
clarified SEQ: more sequential evaluation to support multiple tests (see also 5c91bd51fc37);
wenzelm
parents:
78869
diff
changeset
|
654 |
))), |
78872 | 655 |
Logger_Task("build_status", logger => |
656 |
Isabelle_System.update_directory( |
|
657 |
isabelle_devel + Path.explode("build_status"), |
|
658 |
dir => |
|
659 |
Build_Status.build_status(logger.options, |
|
660 |
target_dir = dir, ml_statistics = true)))))), |
|
78869 | 661 |
exit)))) |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
662 |
|
64171 | 663 |
log_service.shutdown() |
64170 | 664 |
|
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
665 |
main_state_file.file.delete |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
666 |
} |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
667 |
|
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
668 |
|
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
669 |
|
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
670 |
/** command line entry point **/ |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
671 |
|
75393 | 672 |
def main(args: Array[String]): Unit = { |
71632 | 673 |
Command_Line.tool { |
64148 | 674 |
var force = false |
675 |
var verbose = false |
|
64187 | 676 |
var exclude_task = Set.empty[String] |
64148 | 677 |
|
678 |
val getopts = Getopts(""" |
|
679 |
Usage: Admin/cronjob/main [OPTIONS] |
|
680 |
||
681 |
Options are: |
|
682 |
-f apply force to do anything |
|
683 |
-v verbose |
|
64187 | 684 |
-x NAME exclude tasks with this name |
64148 | 685 |
""", |
686 |
"f" -> (_ => force = true), |
|
64187 | 687 |
"v" -> (_ => verbose = true), |
688 |
"x:" -> (arg => exclude_task += arg)) |
|
64148 | 689 |
|
690 |
val more_args = getopts(args) |
|
691 |
if (more_args.nonEmpty) getopts.usage() |
|
692 |
||
71726
a5fda30edae2
clarified signature: more uniform treatment of stopped/interrupted state;
wenzelm
parents:
71684
diff
changeset
|
693 |
val progress = if (verbose) new Console_Progress() else new Progress |
64148 | 694 |
|
64187 | 695 |
if (force) cronjob(progress, exclude_task) |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
696 |
else error("Need to apply force to do anything") |
64148 | 697 |
} |
698 |
} |
|
699 |
} |