# HG changeset patch # User Fabian Huch # Date 1738451321 -3600 # Node ID b8ba54ab790bd51087761a1826e396ee3214e16f # Parent c1685983428828e09fe8196bb47ff18b0acb87c4 documentation about Build_Manager; diff -r c16859834288 -r b8ba54ab790b src/Doc/System/Sessions.thy --- a/src/Doc/System/Sessions.thy Sat Feb 01 22:41:43 2025 +0100 +++ b/src/Doc/System/Sessions.thy Sun Feb 02 00:08:41 2025 +0100 @@ -1065,4 +1065,132 @@ @{verbatim [display] \ isabelle sync -A: -T -H -s testmachine test/isabelle_afp\} \ + +section \Remote build management\ + +text \ + Building large collections of Isabelle session (e.g., the AFP) is an + expensive operation that might not be feasible on a local device, so + powerful remote hardware is necessary to be able to test changes quickly. + In a multi-user environment, these hardware resources must be managed such + that important tasks can be completed as soon as possible, and automated + tasks run in the background when necessary. +\ + +subsection \Build manager server\ + +text \ + The @{tool_def build_manager} tool starts a server process that manages + a queue of tasks, runs build jobs, and serves a web view that displays the + results. It consists of several threads: + + \<^item> \<^emph>\poller\: listens to repository updates and queues automatic tasks. + + \<^item> \<^emph>\timer\: queues periodic tasks at specific points in time. + + \<^item> \<^emph>\runner\: starts jobs for feasible tasks with the highest priority + whenever possible. Jobs run exclusively on their resources, either on the + cluster specified via @{system_option build_manager_cluster} (the + connection to the \<^verbatim>\build_master\ host must be specified via + \<^verbatim>\build_manager_cluster_ssh\ connection options), or on a single remote + host (under the identifier given by + @{system_option build_manager_identifier}). + + \<^item> \<^emph>\web_server\: serves the web page. If the web address is not reachable + under the SSH hostname of the server, it must be set via + @{system_option build_manager_address}. + + Automated tasks must be registered in a \<^scala_type>\isabelle.Isabelle_CI_Jobs\ + service. The system option @{system_option build_manager_ci_jobs} controls + which jobs are executed by the \<^verbatim>\Build_Manager\. + + The command-line usage to start the server is: + @{verbatim [display] +\Usage: isabelle build_manager [OPTIONS] + + Options are: + -A ROOT include AFP with given root directory (":" for $AFP_BASE) + -D DIR include extra component in given directory + -H HOSTS host specifications for all available hosts of the form + NAMES:PARAMETERS (separated by commas) + -o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) + -p PORT explicit web server port + + Run Isabelle build manager. +\} + + \<^medskip> Options \<^verbatim>\-o\ and \<^verbatim>\-p\ are the same as in other server applications. + + \<^medskip> Option \<^verbatim>\-A\ refers to the AFP (must be a Mercurial clone) + + \<^medskip> Option \<^verbatim>\-D\ extra Isabelle components in a Mercurial repository clone to + be considered by the poller and CI jobs. + + \<^medskip> Option \<^verbatim>\-H\ must list all host specifications to be used in the build + cluster or as remote host. + + \<^medskip> + In case a job does not complete on its own, it is terminated after a timeout + defined by the CI job, or @{system_option build_manager_timeout} for + user-submitted tasks. + + \<^medskip> + To gracefully stop the build manager, it should be sent an interrupt signal + (\<^verbatim>\kill -INT\). This will stop all threads gracefully: Any running build is + allowed to complete before the Isabelle process terminates. + + \<^medskip> + The build manager stores its persistent data (including user-submitted tasks + and build logs) in the directory given by @{system_option build_manager_dir}. + It must be writable by the common Unix group specified in + @{system_option build_manager_group}. It also needs a PostgreSQL database + (via \<^verbatim>\build_manager_database\ connection options) for shared state. + A clean database state (e.g., after a schema update) can be restored from + build logs via the @{tool_def build_manager_database} tool: + @{verbatim [display] +\Usage: isabelle build_manager_database [OPTIONS] + + Options are: + -A ROOT include AFP with given root directory (":" for $AFP_BASE) + -o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) + -u update reports + + Restore build_manager database from log files. +\} + + Options \<^verbatim>\-A\ and \<^verbatim>\-o\ are the same as in @{tool_ref build_manager}. + + Option \<^verbatim>\-u\ updates Mercurial reports in the persistent storage based on + the version history (e.g., to change the diff display in the web server). +\ + +subsection \Submitting build tasks\ + +text \ + The @{tool_def build_task} tool submits user-defined build tasks by syncing + the local Isabelle repository to the server and queuing a task in the shared + state. Command-line options are almost identical to the regular @{tool_ref + build}, with the exception of preferences in the remote build. + + For the SSH connection, the server needs to be accessible with the system + options @{system_option build_manager_ssh_user}, @{system_option + build_manager_ssh_host}, etc. + + The database needs to be configured similarly (via \<^verbatim>\build_manager_database\ + connection options) though the PostgreSQL server can also be configured + to trust connections of logged in users via ``peer authentication''. +\ + +subsubsection \Examples\ + +text \ +Clean build of the distribution: + + @{verbatim [display] \ isabelle build_task -c -a\} + +Build all sessions in the AFP excluding the \<^verbatim>\very_slow\ group: + + @{verbatim [display] \ isabelle build_task -A: -X slow -g AFP\} +\ + end