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