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