src/Pure/Admin/isabelle_cronjob.scala
changeset 65746 dead16007097
parent 65736 2e7230b66a32
child 65747 5a3052b2095f
equal deleted inserted replaced
65745:a124fbf8b2b9 65746:dead16007097
    27   val isabelle_dev_source = "http://isabelle.in.tum.de/repos/isabelle"
    27   val isabelle_dev_source = "http://isabelle.in.tum.de/repos/isabelle"
    28   val isabelle_release_source = "http://bitbucket.org/isabelle_project/isabelle-release"
    28   val isabelle_release_source = "http://bitbucket.org/isabelle_project/isabelle-release"
    29   val afp_source = "https://bitbucket.org/isa-afp/afp-devel"
    29   val afp_source = "https://bitbucket.org/isa-afp/afp-devel"
    30 
    30 
    31   val devel_dir = Path.explode("~/html-data/devel")
    31   val devel_dir = Path.explode("~/html-data/devel")
    32   val release_snapshot = devel_dir + Path.explode("release_snapshot")
    32   val release_snapshot_dir = devel_dir + Path.explode("release_snapshot")
    33   val build_log_snapshot = devel_dir + Path.explode("build_log.db")
    33   val build_log_db = devel_dir + Path.explode("build_log.db")
       
    34   val build_status_dir = devel_dir + Path.explode("build_status")
    34 
    35 
    35   val jenkins_jobs = "identify" :: Jenkins.build_log_jobs
    36   val jenkins_jobs = "identify" :: Jenkins.build_log_jobs
    36 
    37 
    37 
    38 
    38 
    39 
    48           val afp_rev = Mercurial.setup_repository(afp_source, afp_repos).id()
    49           val afp_rev = Mercurial.setup_repository(afp_source, afp_repos).id()
    49 
    50 
    50           File.write(logger.log_dir + Build_Log.log_filename("isabelle_identify", logger.start_date),
    51           File.write(logger.log_dir + Build_Log.log_filename("isabelle_identify", logger.start_date),
    51             Build_Log.Identify.content(logger.start_date, Some(rev), Some(afp_rev)))
    52             Build_Log.Identify.content(logger.start_date, Some(rev), Some(afp_rev)))
    52 
    53 
    53           val new_snapshot = release_snapshot.ext("new")
    54           val new_snapshot = release_snapshot_dir.ext("new")
    54           val old_snapshot = release_snapshot.ext("old")
    55           val old_snapshot = release_snapshot_dir.ext("old")
    55 
    56 
    56           Isabelle_System.rm_tree(new_snapshot)
    57           Isabelle_System.rm_tree(new_snapshot)
    57           Isabelle_System.rm_tree(old_snapshot)
    58           Isabelle_System.rm_tree(old_snapshot)
    58 
    59 
    59           Build_Release.build_release(base_dir, rev = rev, afp_rev = afp_rev,
    60           Build_Release.build_release(base_dir, rev = rev, afp_rev = afp_rev,
    60             parallel_jobs = 4, remote_mac = "macbroy31", website = Some(new_snapshot))
    61             parallel_jobs = 4, remote_mac = "macbroy31", website = Some(new_snapshot))
    61 
    62 
    62           if (release_snapshot.is_dir) File.move(release_snapshot, old_snapshot)
    63           if (release_snapshot_dir.is_dir) File.move(release_snapshot_dir, old_snapshot)
    63           File.move(new_snapshot, release_snapshot)
    64           File.move(new_snapshot, release_snapshot_dir)
    64           Isabelle_System.rm_tree(old_snapshot)
    65           Isabelle_System.rm_tree(old_snapshot)
    65         }))
    66         }))
    66 
    67 
    67 
    68 
    68   /* integrity test of build_history vs. build_history_base */
    69   /* integrity test of build_history vs. build_history_base */
   173   {
   174   {
   174     val store = Build_Log.store(options)
   175     val store = Build_Log.store(options)
   175     using(store.open_database())(db =>
   176     using(store.open_database())(db =>
   176     {
   177     {
   177       store.update_database(db, database_dirs, ml_statistics = true)
   178       store.update_database(db, database_dirs, ml_statistics = true)
   178       store.snapshot_database(db, build_log_snapshot)
   179       store.snapshot_database(db, build_log_db)
   179     })
   180     })
       
   181   }
       
   182 
       
   183 
       
   184   /* present build status */
       
   185 
       
   186   def build_status(options: Options)
       
   187   {
       
   188     Build_Status.present_data(Build_Status.read_data(options), target_dir = build_status_dir)
   180   }
   189   }
   181 
   190 
   182 
   191 
   183 
   192 
   184   /** task logging **/
   193   /** task logging **/
   324       Logger_Task("isabelle_cronjob", _ =>
   333       Logger_Task("isabelle_cronjob", _ =>
   325         run_now(
   334         run_now(
   326           SEQ(List(build_release, build_history_base,
   335           SEQ(List(build_release, build_history_base,
   327             PAR(remote_builds.map(seq => SEQ(seq.map(remote_build_history(rev, _))))),
   336             PAR(remote_builds.map(seq => SEQ(seq.map(remote_build_history(rev, _))))),
   328             Logger_Task("jenkins_logs", _ => Jenkins.download_logs(jenkins_jobs, main_dir)),
   337             Logger_Task("jenkins_logs", _ => Jenkins.download_logs(jenkins_jobs, main_dir)),
   329             Logger_Task("build_log_database", logger => database_update(logger.options)))))))
   338             Logger_Task("build_log_database", logger => database_update(logger.options)),
       
   339             Logger_Task("build_status", logger => build_status(logger.options)))))))
   330 
   340 
   331     log_service.shutdown()
   341     log_service.shutdown()
   332 
   342 
   333     main_state_file.file.delete
   343     main_state_file.file.delete
   334   }
   344   }