author | wenzelm |
Thu, 15 Mar 2018 16:16:19 +0100 | |
changeset 67868 | 35b1b23fd4d4 |
parent 67854 | 8374c80165e1 |
child 68209 | aeffd8f1f079 |
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 |
import scala.collection.mutable |
|
14 |
||
15 |
||
64148 | 16 |
object Isabelle_Cronjob |
17 |
{ |
|
66897 | 18 |
/* global resources: owned by main cronjob */ |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
19 |
|
67766
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
20 |
val backup = "lxbroy10:cronjob" |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
21 |
val main_dir = Path.explode("~/cronjob") |
64194
b5ada7dcceaa
integrity test of build_history vs. build_history_base;
wenzelm
parents:
64193
diff
changeset
|
22 |
val main_state_file = main_dir + Path.explode("run/main.state") |
64219 | 23 |
val current_log = main_dir + Path.explode("run/main.log") // owned by log service |
24 |
val cumulative_log = main_dir + Path.explode("log/main.log") // owned by log service |
|
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
25 |
|
67753
f28aee3ad1e6
uniform setup_repository (pull/clone without update);
wenzelm
parents:
67752
diff
changeset
|
26 |
val isabelle_repos_source = "https://isabelle.in.tum.de/repos/isabelle" |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
27 |
val isabelle_repos = main_dir + Path.explode("isabelle") |
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
28 |
val afp_repos = main_dir + Path.explode("AFP") |
64236
358f9ff08681
discontinued somewhat pointless cronjob.options -- compile-time constants are sufficient;
wenzelm
parents:
64235
diff
changeset
|
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 |
|
67752
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
45 |
val init = |
67751 | 46 |
Logger_Task("init", logger => |
66859 | 47 |
{ |
48 |
Isabelle_Devel.make_index() |
|
65771 | 49 |
|
67753
f28aee3ad1e6
uniform setup_repository (pull/clone without update);
wenzelm
parents:
67752
diff
changeset
|
50 |
Mercurial.setup_repository(isabelle_repos_source, isabelle_repos) |
f28aee3ad1e6
uniform setup_repository (pull/clone without update);
wenzelm
parents:
67752
diff
changeset
|
51 |
Mercurial.setup_repository(AFP.repos_source, afp_repos) |
64192 | 52 |
|
66859 | 53 |
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
|
54 |
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
|
55 |
|
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
56 |
Isabelle_System.bash( |
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
57 |
"""rsync -a --include="*/" --include="plain_identify*" --exclude="*" """ + |
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
58 |
Bash.string(backup + "/log") + " " + File.bash_path(main_dir)).check |
67854
8374c80165e1
publish current log file, e.g. for easy error detection;
wenzelm
parents:
67775
diff
changeset
|
59 |
|
8374c80165e1
publish current log file, e.g. for easy error detection;
wenzelm
parents:
67775
diff
changeset
|
60 |
if (!Isabelle_Devel.cronjob_log.is_file) |
8374c80165e1
publish current log file, e.g. for easy error detection;
wenzelm
parents:
67775
diff
changeset
|
61 |
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
|
62 |
}) |
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 |
val exit = |
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
65 |
Logger_Task("exit", logger => |
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
66 |
{ |
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
67 |
Isabelle_System.bash( |
67769 | 68 |
"rsync -a " + File.bash_path(main_dir + Path.explode("log")) + " " + Bash.string(backup)) |
69 |
.check |
|
67751 | 70 |
}) |
71 |
||
72 |
||
73 |
/* build release */ |
|
74 |
||
67752
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
75 |
val build_release = |
67751 | 76 |
Logger_Task("build_release", logger => |
77 |
{ |
|
67758 | 78 |
Isabelle_Devel.release_snapshot( |
67763
f4b1cf9e7010
proper remote_mac according to Admin/Release/CHECKLIST;
wenzelm
parents:
67758
diff
changeset
|
79 |
rev = get_rev(), afp_rev = get_afp_rev(), remote_mac = "macbroy30") |
66859 | 80 |
}) |
64192 | 81 |
|
82 |
||
64194
b5ada7dcceaa
integrity test of build_history vs. build_history_base;
wenzelm
parents:
64193
diff
changeset
|
83 |
/* integrity test of build_history vs. build_history_base */ |
64193 | 84 |
|
67752
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
85 |
val build_history_base = |
64193 | 86 |
Logger_Task("build_history_base", logger => |
87 |
{ |
|
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
|
88 |
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
|
89 |
{ |
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
|
90 |
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
|
91 |
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
|
92 |
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
|
93 |
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
|
94 |
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
|
95 |
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
|
96 |
rev = "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
|
97 |
options = "-f", |
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
|
98 |
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
|
99 |
|
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
|
100 |
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
|
101 |
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
|
102 |
} |
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 |
}) |
64193 | 104 |
}) |
105 |
||
106 |
||
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
107 |
/* remote build_history */ |
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
108 |
|
66864 | 109 |
sealed case class Item( |
110 |
known: Boolean, |
|
111 |
isabelle_version: String, |
|
112 |
afp_version: Option[String], |
|
113 |
pull_date: Date) |
|
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
114 |
{ |
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
115 |
def unknown: Boolean = !known |
66864 | 116 |
def versions: (String, Option[String]) = (isabelle_version, afp_version) |
117 |
||
118 |
def known_versions(rev: String, afp_rev: Option[String]): Boolean = |
|
119 |
known && rev != "" && isabelle_version == rev && |
|
120 |
(afp_rev.isEmpty || afp_rev.get != "" && afp_version == afp_rev.get) |
|
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
121 |
} |
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
122 |
|
66864 | 123 |
def recent_items(db: SQL.Database, |
124 |
days: Int, rev: String, afp_rev: Option[String], sql: SQL.Source): List[Item] = |
|
65807 | 125 |
{ |
66880
486f4af28db9
more thorough treatment of afp_version and afp_pull_date;
wenzelm
parents:
66879
diff
changeset
|
126 |
val afp = afp_rev.isDefined |
65807 | 127 |
val select = |
66864 | 128 |
Build_Log.Data.select_recent_versions( |
129 |
days = days, rev = rev, afp_rev = afp_rev, sql = "WHERE " + sql) |
|
65807 | 130 |
|
131 |
db.using_statement(select)(stmt => |
|
132 |
stmt.execute_query().iterator(res => |
|
133 |
{ |
|
134 |
val known = res.bool(Build_Log.Data.known) |
|
135 |
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
|
136 |
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
|
137 |
val pull_date = res.date(Build_Log.Data.pull_date(afp)) |
66864 | 138 |
Item(known, isabelle_version, afp_version, pull_date) |
65807 | 139 |
}).toList) |
140 |
} |
|
141 |
||
142 |
def unknown_runs(items: List[Item]): List[List[Item]] = |
|
143 |
{ |
|
144 |
val (run, rest) = Library.take_prefix[Item](_.unknown, items.dropWhile(_.known)) |
|
145 |
if (run.nonEmpty) run :: unknown_runs(rest) else Nil |
|
146 |
} |
|
147 |
||
64409
70c87ca55f2c
tuned signature -- more friendly for experimentation;
wenzelm
parents:
64405
diff
changeset
|
148 |
sealed case class Remote_Build( |
65764 | 149 |
description: String, |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
150 |
host: String, |
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
151 |
user: String = "", |
65594 | 152 |
port: Int = 0, |
67746 | 153 |
ssh_host: String = "", |
67772 | 154 |
ssh_permissive: Boolean = false, |
67746 | 155 |
proxy_host: String = "", |
156 |
proxy_user: String = "", |
|
157 |
proxy_port: Int = 0, |
|
67775 | 158 |
self_update: Boolean = false, |
65820 | 159 |
historic: Boolean = false, |
65789 | 160 |
history: Int = 0, |
65820 | 161 |
history_base: String = "build_history_base", |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
162 |
options: String = "", |
65732 | 163 |
args: String = "", |
66864 | 164 |
afp: Boolean = false, |
66980 | 165 |
slow: Boolean = false, |
67075
eada9bd5fff2
avoid lxbroy7, which is presently inaccessible, but retain its build history in db queries;
wenzelm
parents:
67070
diff
changeset
|
166 |
more_hosts: List[String] = Nil, |
67080 | 167 |
detect: SQL.Source = "", |
168 |
active: Boolean = true) |
|
65732 | 169 |
{ |
67750 | 170 |
def ssh_session(context: SSH.Context): SSH.Session = |
171 |
context.open_session(host = proper_string(ssh_host) getOrElse host, user = user, port = port, |
|
67772 | 172 |
proxy_host = proxy_host, proxy_user = proxy_user, proxy_port = proxy_port, |
173 |
permissive = ssh_permissive) |
|
67750 | 174 |
|
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
175 |
def sql: SQL.Source = |
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
176 |
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
|
177 |
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
|
178 |
(if (detect == "") "" else " AND " + SQL.enclose(detect)) |
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
179 |
|
65747 | 180 |
def profile: Build_Status.Profile = |
66980 | 181 |
Build_Status.Profile(description, history = history, afp = afp, slow = slow, sql = sql) |
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
182 |
|
66864 | 183 |
def pick( |
184 |
options: Options, |
|
185 |
rev: String = "", |
|
66865 | 186 |
filter: Item => Boolean = _ => true): Option[(String, Option[String])] = |
65747 | 187 |
{ |
67753
f28aee3ad1e6
uniform setup_repository (pull/clone without update);
wenzelm
parents:
67752
diff
changeset
|
188 |
val afp_rev = if (afp) Some(get_afp_rev()) else None |
66864 | 189 |
|
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
190 |
val store = Build_Log.store(options) |
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
191 |
using(store.open_database())(db => |
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
192 |
{ |
66864 | 193 |
def pick_days(days: Int, gap: Int): Option[(String, Option[String])] = |
65810 | 194 |
{ |
66865 | 195 |
val items = recent_items(db, days, rev, afp_rev, sql).filter(filter) |
66007 | 196 |
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
|
197 |
|
66864 | 198 |
if (historic || items.exists(_.known_versions(rev, afp_rev))) { |
65810 | 199 |
val longest_run = |
200 |
(List.empty[Item] /: runs)({ case (item1, item2) => |
|
201 |
if (item1.length >= item2.length) item1 else item2 |
|
202 |
}) |
|
203 |
if (longest_run.isEmpty) None |
|
66864 | 204 |
else Some(longest_run(longest_run.length / 2).versions) |
65810 | 205 |
} |
66864 | 206 |
else if (rev != "") Some((rev, afp_rev)) |
207 |
else runs.flatten.headOption.map(_.versions) |
|
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
208 |
} |
65810 | 209 |
|
66007 | 210 |
pick_days(options.int("build_log_history") max history, 2) orElse |
211 |
pick_days(200, 5) orElse |
|
212 |
pick_days(2000, 1) |
|
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
213 |
}) |
65747 | 214 |
} |
65732 | 215 |
} |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
216 |
|
65806 | 217 |
val remote_builds_old: List[Remote_Build] = |
218 |
List( |
|
67608 | 219 |
Remote_Build("AFP", "lxbroy7", |
220 |
args = "-N -X slow", |
|
221 |
afp = true, |
|
222 |
detect = Build_Log.Prop.build_tags + " = " + SQL.string("AFP")), |
|
66762 | 223 |
Remote_Build("Poly/ML 5.7 Linux", "lxbroy8", |
224 |
history_base = "37074e22e8be", |
|
225 |
options = "-m32 -B -M1x2,2 -t polyml-5.7 -i 'init_component /home/isabelle/contrib/polyml-5.7'", |
|
226 |
args = "-N -g timing", |
|
227 |
detect = Build_Log.Prop.build_tags + " = " + SQL.string("polyml-5.7") + " AND " + |
|
228 |
Build_Log.Settings.ML_OPTIONS + " <> " + SQL.string("-H 500")), |
|
66931 | 229 |
Remote_Build("Poly/ML 5.7.1 Linux", "lxbroy8", |
230 |
history_base = "a9d5b59c3e12", |
|
231 |
options = "-m32 -B -M1x2,2 -t polyml-5.7.1-pre2 -i 'init_component /home/isabelle/contrib/polyml-test-905dae2ebfda'", |
|
232 |
args = "-N -g timing", |
|
233 |
detect = |
|
234 |
Build_Log.Prop.build_tags + " = " + SQL.string("polyml-5.7.1-pre1") + " OR " + |
|
235 |
Build_Log.Prop.build_tags + " = " + SQL.string("polyml-5.7.1-pre2")), |
|
66762 | 236 |
Remote_Build("Poly/ML 5.7 Mac OS X", "macbroy2", |
237 |
history_base = "37074e22e8be", |
|
238 |
options = "-m32 -B -M1x4,4 -t polyml-5.7 -i 'init_component /home/isabelle/contrib/polyml-5.7'", |
|
239 |
args = "-a", |
|
240 |
detect = Build_Log.Prop.build_tags + " = " + SQL.string("polyml-5.7")), |
|
66931 | 241 |
Remote_Build("Poly/ML 5.7.1 Mac OS X", "macbroy2", |
242 |
history_base = "a9d5b59c3e12", |
|
243 |
options = "-m32 -B -M1x4,4 -t polyml-5.7.1-pre2 -i 'init_component /home/isabelle/contrib/polyml-test-905dae2ebfda'", |
|
244 |
args = "-a", |
|
245 |
detect = |
|
246 |
Build_Log.Prop.build_tags + " = " + SQL.string("polyml-5.7.1-pre1") + " OR " + |
|
247 |
Build_Log.Prop.build_tags + " = " + SQL.string("polyml-5.7.1-pre2")), |
|
65806 | 248 |
Remote_Build("Poly/ML test", "lxbroy8", |
65843
d547173212d2
proper init_settings for init_component (before generated ML_OPTIONS etc.);
wenzelm
parents:
65840
diff
changeset
|
249 |
options = "-m32 -B -M1x2,2 -t polyml-test -i 'init_component /home/isabelle/contrib/polyml-5.7-20170217'", |
65806 | 250 |
args = "-N -g timing", |
251 |
detect = Build_Log.Prop.build_tags + " = " + SQL.string("polyml-test")), |
|
252 |
Remote_Build("Mac OS X 10.8 Mountain Lion", "macbroy30", options = "-m32 -M2", args = "-a", |
|
253 |
detect = Build_Log.Prop.build_start + " < date '2017-03-03'")) |
|
254 |
||
255 |
||
66898
8b7c4679c05b
parallel remote_builds2 for the sake of "AFP slow" (with theoretical data race on build_log_dirs);
wenzelm
parents:
66897
diff
changeset
|
256 |
val remote_builds1: List[List[Remote_Build]] = |
65732 | 257 |
{ |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
258 |
List( |
65764 | 259 |
List(Remote_Build("Linux A", "lxbroy9", |
65732 | 260 |
options = "-m32 -B -M1x2,2", args = "-N -g timing")), |
65820 | 261 |
List(Remote_Build("Linux B", "lxbroy10", historic = true, history = 90, |
65732 | 262 |
options = "-m32 -B -M1x4,2,4,6", args = "-N -g timing")), |
64351 | 263 |
List( |
67103
39cc38a06610
clarified description for mixed Mavericks / El Capitan system;
wenzelm
parents:
67089
diff
changeset
|
264 |
Remote_Build("Mac OS X", "macbroy2", |
65906 | 265 |
options = "-m32 -M8" + |
266 |
" -e ISABELLE_GHC=ghc -e ISABELLE_MLTON=mlton -e ISABELLE_OCAML=ocaml" + |
|
267 |
" -e ISABELLE_OCAMLC=ocamlc -e ISABELLE_SMLNJ=/mnt/nfsbroy/home/smlnj/bin/sml", |
|
65902 | 268 |
args = "-a", |
67080 | 269 |
detect = Build_Log.Prop.build_tags.undefined, |
67089
c96ee0eb0d5f
macbroy2 is back, still pretending to be on Mavericks for better comparison of performance;
wenzelm
parents:
67080
diff
changeset
|
270 |
history_base = "2c0f24e927dd"), |
67103
39cc38a06610
clarified description for mixed Mavericks / El Capitan system;
wenzelm
parents:
67089
diff
changeset
|
271 |
Remote_Build("Mac OS X, quick_and_dirty", "macbroy2", |
65732 | 272 |
options = "-m32 -M8 -t quick_and_dirty", args = "-a -o quick_and_dirty", |
67080 | 273 |
detect = Build_Log.Prop.build_tags + " = " + SQL.string("quick_and_dirty"), |
67089
c96ee0eb0d5f
macbroy2 is back, still pretending to be on Mavericks for better comparison of performance;
wenzelm
parents:
67080
diff
changeset
|
274 |
history_base = "2c0f24e927dd"), |
67103
39cc38a06610
clarified description for mixed Mavericks / El Capitan system;
wenzelm
parents:
67089
diff
changeset
|
275 |
Remote_Build("Mac OS X, skip_proofs", "macbroy2", |
65732 | 276 |
options = "-m32 -M8 -t skip_proofs", args = "-a -o skip_proofs", |
67080 | 277 |
detect = Build_Log.Prop.build_tags + " = " + SQL.string("skip_proofs"), |
67089
c96ee0eb0d5f
macbroy2 is back, still pretending to be on Mavericks for better comparison of performance;
wenzelm
parents:
67080
diff
changeset
|
278 |
history_base = "2c0f24e927dd")), |
65768 | 279 |
List( |
280 |
Remote_Build("Mac OS X 10.12 Sierra", "macbroy30", options = "-m32 -M2", args = "-a", |
|
281 |
detect = Build_Log.Prop.build_start + " > date '2017-03-03'")), |
|
282 |
List(Remote_Build("Mac OS X 10.10 Yosemite", "macbroy31", options = "-m32 -M2", args = "-a")), |
|
64351 | 283 |
List( |
67775 | 284 |
Remote_Build("Windows", "vmnipkow9", historic = true, history = 90, self_update = true, |
65906 | 285 |
options = "-m32 -M4" + |
286 |
" -e ISABELLE_OCAML=ocaml -e ISABELLE_OCAMLC=ocamlc" + |
|
287 |
" -e ISABELLE_GHC=/usr/local/ghc-8.0.2/bin/ghc" + |
|
288 |
" -e ISABELLE_SMLNJ=/usr/local/smlnj-110.81/bin/sml", |
|
65902 | 289 |
args = "-a", |
65732 | 290 |
detect = Build_Log.Settings.ML_PLATFORM + " = " + SQL.string("x86-windows")), |
67775 | 291 |
Remote_Build("Windows", "vmnipkow9", historic = true, history = 90, self_update = true, |
65906 | 292 |
options = "-m64 -M4" + |
293 |
" -e ISABELLE_OCAML=ocaml -e ISABELLE_OCAMLC=ocamlc" + |
|
294 |
" -e ISABELLE_GHC=/usr/local/ghc-8.0.2/bin/ghc" + |
|
295 |
" -e ISABELLE_SMLNJ=/usr/local/smlnj-110.81/bin/sml", |
|
65902 | 296 |
args = "-a", |
66868 | 297 |
detect = Build_Log.Settings.ML_PLATFORM + " = " + SQL.string("x86_64-windows"))), |
66864 | 298 |
) ::: |
299 |
{ |
|
67607 | 300 |
for { (n, hosts) <- List(1 -> List("lxbroy6"), 2 -> List("lxbroy8", "lxbroy5")) } |
66864 | 301 |
yield { |
67075
eada9bd5fff2
avoid lxbroy7, which is presently inaccessible, but retain its build history in db queries;
wenzelm
parents:
67070
diff
changeset
|
302 |
List(Remote_Build("AFP", host = hosts.head, more_hosts = hosts.tail, |
67568 | 303 |
options = "-m32 -M1x2 -t AFP -P" + n + |
304 |
" -e ISABELLE_GHC=ghc" + |
|
305 |
" -e ISABELLE_MLTON=mlton" + |
|
306 |
" -e ISABELLE_OCAML=ocaml -e ISABELLE_OCAMLC=ocamlc" + |
|
307 |
" -e ISABELLE_SMLNJ=/home/smlnj/bin/sml", |
|
66864 | 308 |
args = "-N -X slow", |
309 |
afp = true, |
|
310 |
detect = Build_Log.Prop.build_tags + " = " + SQL.string("AFP"))) |
|
311 |
} |
|
312 |
} |
|
65732 | 313 |
} |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
314 |
|
66898
8b7c4679c05b
parallel remote_builds2 for the sake of "AFP slow" (with theoretical data race on build_log_dirs);
wenzelm
parents:
66897
diff
changeset
|
315 |
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
|
316 |
List( |
8b7c4679c05b
parallel remote_builds2 for the sake of "AFP slow" (with theoretical data race on build_log_dirs);
wenzelm
parents:
66897
diff
changeset
|
317 |
List( |
67775 | 318 |
Remote_Build("AFP slow", "lrzcloud1", self_update = true, |
67868 | 319 |
proxy_host = "lxbroy10", proxy_user = "i21isatest", |
67772 | 320 |
ssh_host = "10.155.208.96", ssh_permissive = 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
|
321 |
options = "-m64 -M6 -U30000 -s10 -t AFP", |
8b7c4679c05b
parallel remote_builds2 for the sake of "AFP slow" (with theoretical data race on build_log_dirs);
wenzelm
parents:
66897
diff
changeset
|
322 |
args = "-g slow", |
8b7c4679c05b
parallel remote_builds2 for the sake of "AFP slow" (with theoretical data race on build_log_dirs);
wenzelm
parents:
66897
diff
changeset
|
323 |
afp = true, |
66980 | 324 |
slow = 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
|
325 |
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
|
326 |
|
67752
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
327 |
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
|
328 |
: Logger_Task = |
64294
303976a45afe
shared_home is default for classic isatest home setup;
wenzelm
parents:
64277
diff
changeset
|
329 |
{ |
303976a45afe
shared_home is default for classic isatest home setup;
wenzelm
parents:
64277
diff
changeset
|
330 |
val task_name = "build_history-" + r.host |
303976a45afe
shared_home is default for classic isatest home setup;
wenzelm
parents:
64277
diff
changeset
|
331 |
Logger_Task(task_name, logger => |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
332 |
{ |
67750 | 333 |
using(r.ssh_session(logger.ssh_context))(ssh => |
334 |
{ |
|
335 |
val results = |
|
336 |
Build_History.remote_build_history(ssh, |
|
337 |
isabelle_repos, |
|
338 |
isabelle_repos.ext(r.host), |
|
339 |
isabelle_identifier = "cronjob_build_history", |
|
67775 | 340 |
self_update = r.self_update, |
67750 | 341 |
rev = rev, |
342 |
afp_rev = afp_rev, |
|
343 |
options = |
|
344 |
" -N " + Bash.string(task_name) + (if (i < 0) "" else "_" + (i + 1).toString) + |
|
345 |
" -f " + r.options, |
|
346 |
args = "-o timeout=10800 " + r.args) |
|
64346 | 347 |
|
67750 | 348 |
for ((log_name, bytes) <- results) { |
349 |
logger.log(Date.now(), log_name) |
|
350 |
Bytes.write(logger.log_dir + Path.explode(log_name), bytes) |
|
351 |
} |
|
352 |
}) |
|
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
353 |
}) |
64294
303976a45afe
shared_home is default for classic isatest home setup;
wenzelm
parents:
64277
diff
changeset
|
354 |
} |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
355 |
|
65747 | 356 |
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
|
357 |
(remote_builds_old :: remote_builds1 ::: remote_builds2).flatten.map(_.profile) |
65747 | 358 |
|
65746 | 359 |
|
64192 | 360 |
|
361 |
/** task logging **/ |
|
64171 | 362 |
|
67752
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
363 |
object Log_Service |
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
364 |
{ |
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
365 |
def apply(options: Options, progress: Progress = No_Progress): Log_Service = |
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
366 |
new Log_Service(SSH.init_context(options), progress) |
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
367 |
} |
64154 | 368 |
|
67752
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
369 |
class Log_Service private(val ssh_context: SSH.Context, progress: Progress) |
64171 | 370 |
{ |
64219 | 371 |
current_log.file.delete |
372 |
||
64171 | 373 |
private val thread: Consumer_Thread[String] = |
374 |
Consumer_Thread.fork("cronjob: logger", daemon = true)( |
|
375 |
consume = (text: String) => |
|
64219 | 376 |
{ // critical |
377 |
File.append(current_log, text + "\n") |
|
378 |
File.append(cumulative_log, text + "\n") |
|
64171 | 379 |
progress.echo(text) |
380 |
true |
|
381 |
}) |
|
382 |
||
383 |
def shutdown() { thread.shutdown() } |
|
384 |
||
385 |
val hostname = Isabelle_System.hostname() |
|
386 |
||
387 |
def log(date: Date, task_name: String, msg: String): Unit = |
|
64193 | 388 |
if (task_name != "") |
389 |
thread.send( |
|
390 |
"[" + Build_Log.print_date(date) + ", " + hostname + ", " + task_name + "]: " + msg) |
|
64171 | 391 |
|
392 |
def start_logger(start_date: Date, task_name: String): Logger = |
|
393 |
new Logger(this, start_date, task_name) |
|
64154 | 394 |
|
64171 | 395 |
def run_task(start_date: Date, task: Logger_Task) |
396 |
{ |
|
397 |
val logger = start_logger(start_date, task.name) |
|
398 |
val res = Exn.capture { task.body(logger) } |
|
399 |
val end_date = Date.now() |
|
400 |
val err = |
|
401 |
res match { |
|
402 |
case Exn.Res(_) => None |
|
64295 | 403 |
case Exn.Exn(exn) => |
67178 | 404 |
Output.writeln("Exception trace for " + quote(task.name) + ":") |
64397 | 405 |
exn.printStackTrace() |
66923 | 406 |
val first_line = split_lines(Exn.message(exn)).headOption getOrElse "exception" |
64295 | 407 |
Some(first_line) |
64171 | 408 |
} |
409 |
logger.log_end(end_date, err) |
|
410 |
} |
|
411 |
||
412 |
def fork_task(start_date: Date, task: Logger_Task): Task = |
|
413 |
new Task(task.name, run_task(start_date, task)) |
|
414 |
} |
|
415 |
||
416 |
class Logger private[Isabelle_Cronjob]( |
|
417 |
val log_service: Log_Service, val start_date: Date, val task_name: String) |
|
64162 | 418 |
{ |
64257 | 419 |
def ssh_context: SSH.Context = log_service.ssh_context |
65640 | 420 |
def options: Options = ssh_context.options |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
421 |
|
64171 | 422 |
def log(date: Date, msg: String): Unit = log_service.log(date, task_name, msg) |
423 |
||
424 |
def log_end(end_date: Date, err: Option[String]) |
|
425 |
{ |
|
426 |
val elapsed_time = end_date.time - start_date.time |
|
427 |
val msg = |
|
428 |
(if (err.isEmpty) "finished" else "ERROR " + err.get) + |
|
64197 | 429 |
(if (elapsed_time.seconds < 3.0) "" else " (" + elapsed_time.message_hms + " elapsed time)") |
64171 | 430 |
log(end_date, msg) |
431 |
} |
|
432 |
||
64195 | 433 |
val log_dir: Path = main_dir + Build_Log.log_subdir(start_date) |
434 |
||
435 |
Isabelle_System.mkdirs(log_dir) |
|
64171 | 436 |
log(start_date, "started") |
437 |
} |
|
438 |
||
439 |
class Task private[Isabelle_Cronjob](name: String, body: => Unit) |
|
440 |
{ |
|
441 |
private val future: Future[Unit] = Future.thread("cronjob: " + name) { body } |
|
442 |
def is_finished: Boolean = future.is_finished |
|
64162 | 443 |
} |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
444 |
|
64170 | 445 |
|
446 |
||
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
447 |
/** cronjob **/ |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
448 |
|
64187 | 449 |
def cronjob(progress: Progress, exclude_task: Set[String]) |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
450 |
{ |
64171 | 451 |
/* soft lock */ |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
452 |
|
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
453 |
val still_running = |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
454 |
try { Some(File.read(main_state_file)) } |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
455 |
catch { case ERROR(_) => None } |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
456 |
|
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
457 |
still_running match { |
64170 | 458 |
case None | Some("") => |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
459 |
case Some(running) => |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
460 |
error("Isabelle cronjob appears to be still running: " + running) |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
461 |
} |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
462 |
|
64199 | 463 |
|
464 |
/* log service */ |
|
465 |
||
67752
636f633552a3
clarified signature: facilitate interactive experimentation;
wenzelm
parents:
67751
diff
changeset
|
466 |
val log_service = Log_Service(Options.init(), progress = progress) |
64154 | 467 |
|
64199 | 468 |
def run(start_date: Date, task: Logger_Task) { log_service.run_task(start_date, task) } |
469 |
||
470 |
def run_now(task: Logger_Task) { run(Date.now(), task) } |
|
64154 | 471 |
|
472 |
||
64199 | 473 |
/* structured tasks */ |
64184 | 474 |
|
64350
3af8566788e7
remote_builds has PAR-SEQ semantics of old isatest-makedist;
wenzelm
parents:
64348
diff
changeset
|
475 |
def SEQ(tasks: List[Logger_Task]): Logger_Task = Logger_Task(body = _ => |
64193 | 476 |
for (task <- tasks.iterator if !exclude_task(task.name) || task.name == "") |
64199 | 477 |
run_now(task)) |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
478 |
|
64350
3af8566788e7
remote_builds has PAR-SEQ semantics of old isatest-makedist;
wenzelm
parents:
64348
diff
changeset
|
479 |
def PAR(tasks: List[Logger_Task]): Logger_Task = Logger_Task(body = _ => |
64170 | 480 |
{ |
64199 | 481 |
@tailrec def join(running: List[Task]) |
482 |
{ |
|
483 |
running.partition(_.is_finished) match { |
|
484 |
case (Nil, Nil) => |
|
485 |
case (Nil, _ :: _) => Thread.sleep(500); join(running) |
|
486 |
case (_ :: _, remaining) => join(remaining) |
|
487 |
} |
|
64170 | 488 |
} |
64199 | 489 |
val start_date = Date.now() |
490 |
val running = |
|
64350
3af8566788e7
remote_builds has PAR-SEQ semantics of old isatest-makedist;
wenzelm
parents:
64348
diff
changeset
|
491 |
for (task <- tasks if !exclude_task(task.name)) |
64199 | 492 |
yield log_service.fork_task(start_date, task) |
493 |
join(running) |
|
494 |
}) |
|
64193 | 495 |
|
64170 | 496 |
|
66897 | 497 |
/* repository structure */ |
64199 | 498 |
|
65820 | 499 |
val hg = Mercurial.repository(isabelle_repos) |
66895 | 500 |
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
|
501 |
|
66895 | 502 |
def history_base_filter(r: Remote_Build): Item => Boolean = |
503 |
{ |
|
504 |
val base_rev = hg.id(r.history_base) |
|
505 |
val nodes = hg_graph.all_succs(List(base_rev)).toSet |
|
506 |
(item: Item) => nodes(item.isabelle_version) |
|
507 |
} |
|
508 |
||
66897 | 509 |
|
510 |
/* main */ |
|
511 |
||
512 |
val main_start_date = Date.now() |
|
513 |
File.write(main_state_file, main_start_date + " " + log_service.hostname) |
|
514 |
||
64193 | 515 |
run(main_start_date, |
65783
d3d5cb2d6866
pick isabelle_version based on build_log database;
wenzelm
parents:
65771
diff
changeset
|
516 |
Logger_Task("isabelle_cronjob", logger => |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64220
diff
changeset
|
517 |
run_now( |
67766
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
518 |
SEQ(List( |
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
519 |
init, |
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
|
520 |
build_history_base, |
67766
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
521 |
PAR( |
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
|
522 |
build_release :: |
67766
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
523 |
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
|
524 |
SEQ(List( |
67080 | 525 |
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
|
526 |
SEQ( |
8b7c4679c05b
parallel remote_builds2 for the sake of "AFP slow" (with theoretical data race on build_log_dirs);
wenzelm
parents:
66897
diff
changeset
|
527 |
for { |
8b7c4679c05b
parallel remote_builds2 for the sake of "AFP slow" (with theoretical data race on build_log_dirs);
wenzelm
parents:
66897
diff
changeset
|
528 |
(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
|
529 |
(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
|
530 |
} yield remote_build_history(rev, afp_rev, i, r)))), |
67008 | 531 |
Logger_Task("jenkins_logs", _ => |
532 |
Jenkins.download_logs(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
|
533 |
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
|
534 |
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
|
535 |
Logger_Task("build_status", |
67766
603334230303
consolidated main cronjob server on virtual machine together with build_log database;
wenzelm
parents:
67763
diff
changeset
|
536 |
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
|
537 |
exit))))) |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
538 |
|
64171 | 539 |
log_service.shutdown() |
64170 | 540 |
|
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
541 |
main_state_file.file.delete |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
542 |
} |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
543 |
|
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
544 |
|
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
545 |
|
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
546 |
/** command line entry point **/ |
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
547 |
|
64148 | 548 |
def main(args: Array[String]) |
549 |
{ |
|
550 |
Command_Line.tool0 { |
|
551 |
var force = false |
|
552 |
var verbose = false |
|
64187 | 553 |
var exclude_task = Set.empty[String] |
64148 | 554 |
|
555 |
val getopts = Getopts(""" |
|
556 |
Usage: Admin/cronjob/main [OPTIONS] |
|
557 |
||
558 |
Options are: |
|
559 |
-f apply force to do anything |
|
560 |
-v verbose |
|
64187 | 561 |
-x NAME exclude tasks with this name |
64148 | 562 |
""", |
563 |
"f" -> (_ => force = true), |
|
64187 | 564 |
"v" -> (_ => verbose = true), |
565 |
"x:" -> (arg => exclude_task += arg)) |
|
64148 | 566 |
|
567 |
val more_args = getopts(args) |
|
568 |
if (more_args.nonEmpty) getopts.usage() |
|
569 |
||
64909 | 570 |
val progress = if (verbose) new Console_Progress() else No_Progress |
64148 | 571 |
|
64187 | 572 |
if (force) cronjob(progress, exclude_task) |
64153
769791954872
some timing and logging, similar to old isatest.log;
wenzelm
parents:
64148
diff
changeset
|
573 |
else error("Need to apply force to do anything") |
64148 | 574 |
} |
575 |
} |
|
576 |
} |