consolidated main cronjob server on virtual machine together with build_log database;
authorwenzelm
Sun, 04 Mar 2018 15:10:11 +0100
changeset 67766 603334230303
parent 67765 968f6891be62
child 67767 f95a163c58bb
consolidated main cronjob server on virtual machine together with build_log database; eliminated special tricks for Gentoo; import plain_identify logs, export all logs for backup; run build_release, build_history_base in parallel to remote_build_history tasks;
Admin/cronjob/README
Admin/cronjob/crontab.lxbroy10
Admin/cronjob/crontab.server
src/Pure/Admin/isabelle_cronjob.scala
--- a/Admin/cronjob/README	Sun Mar 04 13:51:58 2018 +0100
+++ b/Admin/cronjob/README	Sun Mar 04 15:10:11 2018 +0100
@@ -1,5 +1,9 @@
-Administrative Isabelle cronjob at TUM
-======================================
+Administrative Isabelle cronjob
+===============================
+
+- main server: virtual machine with cronjob and build_log database
+- backup file-system (for cumulative log files): isatest@lxbroy10:cronjob
+- backup identify job: isatest@lxbroy5
 
 - jobs: manual installation on target directory:
     cp "$ISABELLE_HOME/Admin/cronjob/self_update "$HOME/cronjob/self_update"
@@ -17,7 +21,7 @@
 Build Log Database Server
 =========================
 
-- Ubuntu 16.04 LTS Linux Server standard installation (e.g. on virtual host)
+- Ubuntu 16.04 LTS Linux Server standard installation
   https://help.ubuntu.com/lts/serverguide
 
 - apt install unattended-upgrades
@@ -53,21 +57,3 @@
 
      pg_dump -U postgres -Fc -v -d isatest > db.dump
   pg_restore -U postgres -Fc -v -d isatest < db.dump
-
-
-Build Status Charts
-===================
-
-- Gentoo Linux might require gnuplot from original source
-  (to avoid bad data interpolation)
-
-  http://gnuplot.sourceforge.net/
-  https://sourceforge.net/projects/gnuplot/files/gnuplot/5.0.6/
-
-  $ cd gnuplot-5.0.6
-  $ ./configure
-  $ make
-
-  edit $ISABELLE_HOME_USER/etc/settings
-
-  ISABELLE_GNUPLOT=".../src/gnuplot"
--- a/Admin/cronjob/crontab.lxbroy10	Sun Mar 04 13:51:58 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-SHELL=/bin/bash
-MAILTO=wenzelm
-
-03 00 * * *       $HOME/cronjob/self_update
-17 00 * * *       $HOME/cronjob/isabelle/Admin/cronjob/main -f > $HOME/cronjob/run/main.out 2>&1 || cat $HOME/cronjob/run/main.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Admin/cronjob/crontab.server	Sun Mar 04 15:10:11 2018 +0100
@@ -0,0 +1,5 @@
+SHELL=/bin/bash
+MAILTO=makarius
+
+03 00 * * *       $HOME/cronjob/self_update
+17 00 * * *       $HOME/cronjob/isabelle/Admin/cronjob/main -f > $HOME/cronjob/run/main.out 2>&1 || cat $HOME/cronjob/run/main.out
--- a/src/Pure/Admin/isabelle_cronjob.scala	Sun Mar 04 13:51:58 2018 +0100
+++ b/src/Pure/Admin/isabelle_cronjob.scala	Sun Mar 04 15:10:11 2018 +0100
@@ -15,6 +15,7 @@
 {
   /* global resources: owned by main cronjob */
 
+  val backup = "lxbroy10:cronjob"
   val main_dir = Path.explode("~/cronjob")
   val main_state_file = main_dir + Path.explode("run/main.state")
   val current_log = main_dir + Path.explode("run/main.log")  // owned by log service
@@ -35,7 +36,7 @@
   sealed case class Logger_Task(name: String = "", body: Logger => Unit)
 
 
-  /* init and identify Isabelle + AFP repository snapshots */
+  /* init and exit */
 
   def get_rev(): String = Mercurial.repository(isabelle_repos).id()
   def get_afp_rev(): String = Mercurial.repository(afp_repos).id()
@@ -50,6 +51,18 @@
 
         File.write(logger.log_dir + Build_Log.log_filename("isabelle_identify", logger.start_date),
           Build_Log.Identify.content(logger.start_date, Some(get_rev()), Some(get_afp_rev())))
+
+        Isabelle_System.bash(
+          """rsync -a --include="*/" --include="plain_identify*" --exclude="*" """ +
+            Bash.string(backup + "/log") + " " + File.bash_path(main_dir)).check
+      })
+
+  val exit =
+    Logger_Task("exit", logger =>
+      {
+        Isabelle_System.bash(
+          "rsync -a " + File.bash_path(main_dir + Path.explode("log")) + " " +
+            Bash.string(backup + "/cronjob/log")).check
       })
 
 
@@ -132,7 +145,7 @@
     proxy_host: String = "",
     proxy_user: String = "",
     proxy_port: Int = 0,
-    remote_home: Boolean = false,
+    remote_home: Boolean = true,  // false for lxbroy/homebroy
     historic: Boolean = false,
     history: Int = 0,
     history_base: String = "build_history_base",
@@ -489,8 +502,11 @@
     run(main_start_date,
       Logger_Task("isabelle_cronjob", logger =>
         run_now(
-          SEQ(List(init, build_release, build_history_base,
-            PAR(List(remote_builds1, remote_builds2).map(remote_builds =>
+          SEQ(List(
+            init,
+            PAR(
+              SEQ(List(build_release, build_history_base)) ::
+              List(remote_builds1, remote_builds2).map(remote_builds =>
               SEQ(List(
                 PAR(remote_builds.map(_.filter(_.active)).map(seq =>
                   SEQ(
@@ -503,7 +519,8 @@
                 Logger_Task("build_log_database",
                   logger => Isabelle_Devel.build_log_database(logger.options, build_log_dirs)),
                 Logger_Task("build_status",
-                  logger => Isabelle_Devel.build_status(logger.options)))))))))))
+                  logger => Isabelle_Devel.build_status(logger.options)))))),
+            exit)))))
 
     log_service.shutdown()