Skip to content

Commit 5130b24

Browse files
committed
Update docs for running ml_peg
1 parent 7ae776e commit 5130b24

File tree

1 file changed

+82
-30
lines changed

1 file changed

+82
-30
lines changed

docs/source/developer_guide/running.rst

Lines changed: 82 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,74 +9,118 @@ application.
99
Calculations
1010
------------
1111

12-
Currently, all calculations should be launched using ``pytest``. This will help to
13-
automatically discover and run each test, handle intermediate errors, and control
14-
which tests are run based on our
15-
`custom markers <https://docs.pytest.org/en/7.1.x/example/markers.html>`_.
12+
All calculations can be launched using our ``ml_peg calc`` command-line command.
1613

17-
ALl current tests can be launched using the
18-
`run_calcs.sh <https://github.com/ddmms/ml-peg/blob/main/run_calcs.sh>`_ script:
14+
Help for this command can be found by running ``ml_peg calc --help``:
1915

2016
.. code-block:: bash
2117
22-
./run_cals.sh
18+
Usage: ml_peg calc [OPTIONS]
19+
20+
Run calculations
2321
22+
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────╮
23+
│ --models TEXT Comma-separated models to run calculations on. Default is all models. │
24+
│ --category TEXT Category to run calculations for. Default is all categories. [default: *] │
25+
│ --test TEXT Test to run calculations for. Default is all tests. [default: *] │
26+
│ --run-slow --no-run-slow Whether to run calculations labelled slow. [default: run-slow] │
27+
│ --verbose --no-verbose Whether to run pytest with verbose and stdout printed. [default: verbose] │
28+
│ --help Show this message and exit. │
29+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
2430
25-
Individual tests or categories can be run using a similar command to the one in this
26-
script, such as:
31+
32+
``ml_peg calc`` launches calculations using ``pytest``, and will automatically
33+
discover and run each test, handle intermediate errors, and control which tests are
34+
run based on our
35+
`custom markers <https://docs.pytest.org/en/7.1.x/example/markers.html>`_.
36+
37+
For example, to run the ``S24`` test in the ``surfaces`` category, with the
38+
``mace_mp_0b3`` model, you could run:
2739

2840
.. code-block:: bash
2941
30-
pytest -v ml_peg/calcs/surfaces/*/calc* -s --run-slow
42+
ml_peg calc --category surfaces --test S24 --models mace_mp_0b3
43+
3144
45+
This is effectively equivalent to:
3246

33-
This will run all calculations in the surfaces category, including any marked as ``slow``.
47+
.. code-block:: bash
48+
49+
.. code-block:: bash
50+
51+
pytest -vvv ml_peg/calcs/surfaces/S24/calc_S24.py --models mace_mp_0b3
3452
3553
3654
Analysis
3755
--------
3856

39-
As with calculations, analysis of results should also be launched using ``pytest``,
40-
which can be done using the
41-
`run_analysis.sh <https://github.com/ddmms/ml-peg/blob/main/run_analysis.sh>`_ script:
57+
Similarly to calculations, analysis can be launched using our ``ml_peg analyse``
58+
command-line command.
59+
60+
Help for this command can be found by running ``ml_peg analyse --help``:
4261

4362
.. code-block:: bash
4463
45-
./run_analysis.sh
64+
Usage: ml_peg analyse [OPTIONS]
4665
66+
Run calculations
4767
48-
Individual tests or categories can be also analysed similarly. For example:
68+
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────╮
69+
│ --models TEXT Comma-separated models to run analysis for. Default is all models. │
70+
│ --category TEXT Category to run analysis for. Default is all categories. [default: *] │
71+
│ --test TEXT Test to run analysis for. Default is all tests. [default: *] │
72+
│ --verbose --no-verbose Whether to run pytest with verbose and stdout printed. [default: verbose] │
73+
│ --help Show this message and exit. │
74+
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
4975
50-
.. code-block:: bash
5176
52-
pytest -v ml_peg/analysis/surfaces/*/analyse* -s
77+
``ml_peg analyse`` launches analysis using ``pytest``.
5378

79+
For example, to run the ``OC157`` test in the
80+
``surfaces`` category, with the ``mace_mp_0b3`` and ``orb_v3_conservative_inf_omat__``
81+
models, you could run:
5482

55-
Will analyse the results of calculations in the surfaces category.
83+
.. code-block:: bash
5684
85+
ml_peg analyse --category surfaces --test OC157 --models mace_mp_0b3,orb_v3_conservative_inf_omat__
5786
58-
Application
59-
-----------
6087
61-
Having run analysis, the app can now be launched by running the
62-
`run_app.py <https://github.com/ddmms/ml-peg/blob/main/run_app.py>`_ Python script:
88+
This is effectively equivalent to:
6389

6490
.. code-block:: bash
6591
66-
python3 run_app.py
92+
.. code-block:: bash
93+
94+
pytest -vvv ml_peg/analysis/surfaces/OC157/analyse_OC157.py --models mace_mp_0b3,orb_v3_conservative_inf_omat__
6795
68-
.. tip::
6996
70-
``uv run`` can be used in place of ``python3``, removing the need to activate a
71-
virtual environment.
97+
Application
98+
-----------
7299

100+
Having run analysis, the app can now be launched by running the ``ml_peg app``
101+
command-line command.
102+
103+
Help for this command can be found by running ``ml_peg app --help``:
104+
105+
.. code-block:: bash
73106
74-
By default, this will make the app visiable at http://localhost:8050.
107+
Usage: ml_peg app [OPTIONS]
75108
76-
.. tip::
109+
Run application
77110
78-
You can set the ``PORT`` environment variable to change the port used by Dash.
111+
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────╮
112+
│ --models TEXT Comma-separated models to build interactivity for. Default is all models. │
113+
│ --category TEXT Category to build app for. Default is all categories. [default: *] │
114+
│ --port TEXT Port to run application on. [default: 8050] │
115+
│ --debug --no-debug Whether to run with Dash debugging. [default: debug] │
116+
│ --help Show this message and exit. │
117+
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
79118
119+
.. note::
120+
121+
The ``models`` option for this command only influences building interactive
122+
callbacks, and does not change whether the models are included in tables, scores,
123+
or summaries,
80124

81125
When launched, the app will attempt to automatically construct tables, figures, and
82126
interactive features, based on any importable test apps defined in ``ml_peg/apps/``.
@@ -86,3 +130,11 @@ be rendered for the test.
86130

87131
If a test's table is also unable to be loaded, the test will not be added to the app,
88132
but the app builder should continue to attempt adding other tests.
133+
134+
By default, the live app can then be accessed at http://localhost:8050.
135+
136+
To run the app on a different port (e.g. 8060), and for only the NEBs category, run:
137+
138+
.. code-block:: bash
139+
140+
ml_peg app --category nebs --port 8060

0 commit comments

Comments
 (0)