You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a repository for storing profiling outputs from the TLOmodel, an epidemiology modelling framework for the Thanzi la Onse project.
2
+
3
+
Please head to the `online documentation <http://github-pages.ucl.ac.uk/TLOmodel-profiling/>` for details about this repository, and to access the results from profiling runs of the `TLO model <https://github.com/UCL/TLOmodel>`.
This is a repository for storing profiling outputs from the TLOmodel, an epidemiology modelling framework for the Thanzi la Onse project.
18
+
19
+
Running Simulations with the Model
20
+
----------------------------------
21
+
22
+
For more information about setting up, using, and running simulations using the model, `please see the main repository <https://github.com/UCL/TLOmodel>`_ and information provided there.
23
+
24
+
View the Profiling Results
25
+
--------------------------
26
+
27
+
Profiling results are hosted on `GitHub pages <http://github-pages.ucl.ac.uk/TLOmodel-profiling>`_ and are built using ``sphinx`` and some custom Python scripts to process the results data.
28
+
29
+
* :ref:`Lookup table for profiling runs <profiling>`
30
+
* :ref:`Summary page for captured run statistics <run-statistics>`
31
+
32
+
Developer Documentation
33
+
-----------------------
34
+
35
+
For developer information about this repository; such as how the repository is organised, how the website is built, and documentation for the functions and scripts, :ref:`please see the online documentation <developers>`.
Copy file name to clipboardExpand all lines: source/repo-overview.rst
+25-15Lines changed: 25 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,41 @@
1
-
Repository Overview
2
-
===================
1
+
Developer Documentation
2
+
=======================
3
+
4
+
.. _developers:
3
5
4
6
The purpose of this repository is to provide a storage space for profiling runs performed on the `Thanzi la Onse model <https://github.com/UCL/TLOmodel>`_, and a convenient way to page through the results that doesn't require developers to download the results for themselves.
5
7
The result is this repository, or specifically `the pages deployment <http://github-pages.ucl.ac.uk/TLOmodel-profiling>`_.
6
8
7
9
Profiling session outputs, ``.pyisession`` files, are pushed from the `model repository`_ when the profiling workflow has completed to the `source branch`_.
8
10
This triggers the `build-website <https://github.com/UCL/TLOmodel-profiling/blob/main/.github/workflows/build-website.yaml>`_ workflow which will run the `build script`_.
9
-
This script will parse the files on the source branch, as well as update the developer docs with any changes, and deploy the new website over the old one.
11
+
This script will parse the files on the `source branch`_, as well as update the developer docs with any changes, and deploy the new website over the old one.
10
12
11
13
On PRs, the profiling results HTML and developer docs HTML are required to build successfully before merging, however deployment only takes place when the ``build-website`` workflow is run on ``main``, or triggered as a direct result of new profiling results being pushed.
12
14
13
15
Build Steps
14
16
-----------
15
17
16
-
The build steps can be summarised as follows.
18
+
The website consists of two parts:
19
+
* The profiling results and statistics, which are created by the scripts in ``website_build`` and the results stored on the `source branch`_.
20
+
* The developer documentation, which is created from the content of the ``source`` folder.
21
+
22
+
The website is built using `sphinx <https://www.sphinx-doc.org/en/master/index.html>`_, which is invoked at the end of the ``website_build/build_site.py`` script (specifically within the ``WebsiteBuilder.build()`` method).
23
+
Before ``sphinx-build`` can be invoked however, the profiling results on the `source branch`_ need to be parsed before ``sphinx`` is in a position to publish the website.
24
+
As such, the ``WebsiteBuilder`` first creates a *pre-build* directory, and copies the content of the ``source`` directory into this pre-build directory as a starting point.
25
+
Files are then added to the pre-build directory as needed; these include ``pyinstrumment`` sessions rendered as HTML, and plots for runtime statistics.
26
+
Lookup tables for profiling runs are also generated and their content is inserted into the placeholder locations in the `profiling.rst` and `run-statistics.rst` files in the pre-build directory.
27
+
Having done this pre-build step, ``sphinx`` will be invoked on the pre-build directory to build the HTML content of the website.
17
28
18
-
* Use `sphinx <https://www.sphinx-doc.org/en/master/index.html>`_ to build the developer docs; documenting the functions, classes, and scripts that perform the heavy lifting.
19
-
* Run the build script to process the profiling results.
20
-
#. Scan the source branch for all ``pyisession`` files
21
-
#. Render all profiling output files to HTML
22
-
#. Process additional statistics that were pushed across with the profiling outputs, and produce plots.
23
-
#. Write the lookup table, profiling_index.md
24
-
#. Write the run statistics, run_statistics.md
25
-
#. Include the index page in the build directory
26
-
* Combine the ``sphinx`` build and profiling results, and deploy to GitHub pages.
29
+
An overview of the steps in the ``build_site.py`` script is provided below:
30
+
#. Copy the ``source`` directory into the pre-build directory.
31
+
#. Scan the source branch for all ``.pyisession`` files
32
+
#. Render all profiling output files to HTML
33
+
#. Process additional statistics that were pushed across with the profiling outputs, and produce plots.
34
+
#. Write the lookup table to ``profiling.rst``.
35
+
#. Write the run statistics to ``run_statistics.rst``.
36
+
#. Invoke ``sphinx-build`` on the pre-build directory to create the website.
27
37
28
-
The build script makes use of a ``pandas`` DataFrame to keep track of the summary stats and the correspondence between ``.pyisession`` files and HTML outputs, for example.
38
+
The build script makes use of a ``pandas`` DataFrame to keep track of the summary stats and the correspondence between ``.pyisession`` files and HTML outputs.
29
39
30
40
Contents of the source branch
31
41
-----------------------------
@@ -40,7 +50,7 @@ Files on the source branch as assumed to have filenames in the following style:
40
50
* ``run_number``: The ``github.run_id`` of the workflow that ran.
41
51
* ``commit_sha``: The ``github.sha`` of the commit on which the profiling run was triggered.
42
52
43
-
In addition to the ``pyisession`` files, additional statistics that cannot be saved by the profiler (like the size of the final simulation population) can also be present on the source branch.
53
+
In addition to the ``.pyisession`` files, additional statistics that cannot be saved by the profiler (like the size of the final simulation population) can also be present on the source branch.
44
54
The additional statistics are assumed to be in ``JSON`` files that carry the same filename as their profiling output counterpart, but with the ``.stats.json`` extension.
45
55
These files are processed by the build script when producing the additional statistics page.
46
56
Additional statistics are not required to be present, as missing entries will be skipped or highlighted when rendering the corresponding page.
0 commit comments