Skip to content

Commit 4a76da3

Browse files
committed
Move README content to index, repo readme to redirect to pages site
1 parent c8391f7 commit 4a76da3

File tree

8 files changed

+56
-34
lines changed

8 files changed

+56
-34
lines changed

README.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
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>`.

source/index.rst

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
Welcome to TLO Model: Profiling, Developer Documentation!
7-
=========================================================
6+
Welcome to the TLO Model: Profiling Documentation
7+
=================================================
88

99
.. toctree::
1010
:maxdepth: 1
@@ -14,6 +14,26 @@ Welcome to TLO Model: Profiling, Developer Documentation!
1414
run-statistics
1515
repo-overview
1616

17+
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>`.
36+
1737
Indices and tables
1838
==================
1939

source/profiling.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
Profiling Runs: Lookup Page
22
===========================
33

4+
.. _profiling:
5+
46
<<<MATCH_PATTERN_FOR_MARKDOWN_TABLE_INSERT>>>

source/repo-overview.rst

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
1-
Repository Overview
2-
===================
1+
Developer Documentation
2+
=======================
3+
4+
.. _developers:
35

46
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.
57
The result is this repository, or specifically `the pages deployment <http://github-pages.ucl.ac.uk/TLOmodel-profiling>`_.
68

79
Profiling session outputs, ``.pyisession`` files, are pushed from the `model repository`_ when the profiling workflow has completed to the `source branch`_.
810
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.
1012

1113
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.
1214

1315
Build Steps
1416
-----------
1517

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.
1728

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.
2737

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.
2939

3040
Contents of the source branch
3141
-----------------------------
@@ -40,7 +50,7 @@ Files on the source branch as assumed to have filenames in the following style:
4050
* ``run_number``: The ``github.run_id`` of the workflow that ran.
4151
* ``commit_sha``: The ``github.sha`` of the commit on which the profiling run was triggered.
4252

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.
4454
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.
4555
These files are processed by the build script when producing the additional statistics page.
4656
Additional statistics are not required to be present, as missing entries will be skipped or highlighted when rendering the corresponding page.

source/run-statistics.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
Run Statistics
22
==============
33

4+
.. _run-statistics:
5+
46
<<<MATCH_PATTERN_FOR_RUN_STATS_PLOTS>>>

website_build/stat_plots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def rst_for_run_plots(plot_dict: Dict[str, Path], build_dir: Path) -> List[str]:
6161
rst_string = ""
6262
for plot_name, location in plot_dict.items():
6363
rst_string += f"\n{plot_name}"
64-
rst_string += "\n" + ("=" * len(plot_name))
64+
rst_string += "\n" + ("-" * len(plot_name))
6565
rst_string += "\n" * 2
6666
rst_string += write_rst_image(location, build_dir)
6767
rst_string += "\n"

website_build/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def write_rst_image(link: Path, relative_to: Path = None) -> str:
9191
image_source = os.path.relpath(link, relative_to)
9292
else:
9393
image_source = str(link)
94-
return f"..image:: {image_source}"
94+
return f".. image:: {image_source}"
9595

9696

9797
def replace_in_file(file: Path, search_for: str, replace_with: str) -> None:

0 commit comments

Comments
 (0)