Skip to content

Commit fbad4b9

Browse files
add table of cli options; minor other updates
1 parent 5d1e93a commit fbad4b9

File tree

4 files changed

+77
-33
lines changed

4 files changed

+77
-33
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
**2.0.2 - 08/29/24**
2+
3+
- Strengthen the API documentation
4+
- Update existing documentation to include new psimulate options
5+
16
**2.0.1 - 08/21/24**
27

38
- Use script to install dependencies in CI

docs/source/distributed_runner.rst

Lines changed: 66 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,90 @@ a model specification file in this way
1111

1212
.. code-block:: console
1313
14-
simulate run /path/to/your/model/specification
14+
simulate run <PATH-TO-MODEL-SPECIFICATION-YAML>
1515
1616
Very similar to this, ``vivarium-cluster-tools`` includes a command for simulating in parallel
1717

1818
.. code-block:: console
1919
20-
psimulate run /path/to/your/model/specification /path/to/your/branch
20+
psimulate run <PATH-TO-MODEL-SPECIFICATION-YAML> <PATH-TO-BRANCH-SPECIFICATION-YAML>
2121
22-
By default, output will be saved in ``/mnt/team/simulation_science/costeffectiveness/results``. If you want to save the
23-
results somewhere else you can specify your output directory as an optional argument
22+
Aside from providing the model specification and branches filepaths, you must provide an
23+
output directory with the ``-o`` flag and which project you'd like to run on with the ``-P`` flag.
2424

2525
.. code-block:: console
2626
27-
psimulate run /path/to/your/model/specification /path/to/your/branch -o /path/to/output
28-
29-
Another optional argument is the cluster project under which to run the simulations. By default, the cluster project
30-
used is ``proj_cost_effect``. To use a different project, specify it with the ``-P`` flag
27+
psimulate run <PATH-TO-MODEL-SPECIFICATION-YAML> <PATH-TO-BRANCH-SPECIFICATION-YAML> -o <PATH-TO-OUTPUT-DIRECTORY> -P <PROJECT>
28+
29+
``psimulate run`` also provides various optional flags which you can use to configure options for the run. These are:
30+
31+
.. list-table:: **Available** ``psimulate run`` **options**
32+
:header-rows: 1
33+
:widths: 30, 40
34+
35+
* - Option
36+
- Description
37+
* - | **-\-artifact_path** or **-i**
38+
- | The path to a directory containing the artifact data file that the
39+
| model requires. This is only required if the model specification
40+
| file does not contain the artifact path or you want to override it.
41+
* - | **-\-pdb**
42+
- | If an error occurs, drop into the python debugger.
43+
* - | **-\-verbose** or **-v**
44+
- | Report each time step as it occurs during the run.
45+
* - | **-\-backup-freq**
46+
- | The frequency with which to save a backup of the simulation state to disk.
47+
* - | **-\-no-batch**
48+
- | Do not write results in batches; write them as they come in.
49+
* - | **-\-redis**
50+
- | Number of redis databases to use.
51+
* - | **-\-max-workers** or **-w**
52+
- | The maximum number of workers to run concurrently.
53+
* - | **-\-hardware** or **-h**
54+
- | A comma-separated list of the specific cluster hardware to run on.
55+
| Refer to the --help for currently-supported opions.
56+
* - | **-\-peak-memory** or **-m**
57+
- | The maximum amount of memory to request per worker (in GB).
58+
* - | **-\-max-runtime** or **-r**
59+
- | The maximum amount of time to request per worker (hh:mm:ss). Note that
60+
| the session you are launching the ``psimulate run`` from must also
61+
| be able to live at least as long as this value (and this does not account)
62+
| for the time jobs may spend in PENDING.
63+
* - | **-\-queue** or **-q**
64+
- | The queue to submit jobs to.
65+
* - | **-\-help**
66+
- | Print a help message and exit.
67+
68+
.. note::
69+
70+
You can see a description of any of the available commands by using the
71+
**-\-help** flag, e.g. ``psimulate --help`` or ``psimulate run --help``.
72+
73+
Restarting a Simulation
74+
-----------------------
75+
76+
If your ``psimulate run`` has jobs that failed to complete, you can restart them using ``psimulate restart``.
77+
You must specify the results directory that includes the partially completed jobs as well as the project
78+
you want to use for the restart.
3179

3280
.. code-block:: console
3381
34-
psimulate run /path/to/your/model/specification /path/to/your/branch -P proj_csu
35-
36-
Currently, the projects that simulation science has access to are ``proj_cost_effect``, ``proj_cost_effect_diarrhea``,
37-
``proj_cost_effect_dcpn``, ``proj_cost_effect_conic``, and ``proj_csu``. Only these projects may be used.
82+
psimulate restart <PATH-TO-PREVIOUS-RESULTS-DIRECTORY> -P <PROJECT>
3883
39-
If your ``psimulate run`` has failed to complete you can restart the failed jobs by specifying which output directory
40-
includes the partially completed jobs using ``restart``
41-
42-
.. code-block:: console
84+
Many of the same optional flags exist for ``psimulate restart`` as for ``psimulate run``. You can see a description of
85+
these by using the ``psimulate restart --help``.
4386

44-
psimulate restart /path/to/the/previous/results/
87+
Expanding a Simulation
88+
----------------------
4589

46-
For ``psimulate restart`` you can also choose a project with optional flag ``-P``.
47-
48-
49-
If you wish to expand a previous ``psimulate run`` by adding additional input draws and/or random seeds, you can do so
50-
using ``expand``.
90+
If you wish to expand an existing simulation running new simulations with additional input draws and/or random seeds,
91+
you can do so using ``psimulate expand``. Just like for ``psimulate restart``, you must specify the results directory
92+
that includes the results that you'd like to expand as well as a project. Further, you must specify the number of
93+
additional draws and/or seeds you'd like to add to the simulation.
5194

5295
.. code-block:: console
5396
54-
psimulate expand /path/to/the/previous/results/ --add-draws 10 --add-seeds 5
97+
psimulate expand <PATH-TO-PREVIOUS-RESULTS-DIRECTORY> -P <PROJECT> --add-draws 10 --add-seeds 5
5598
5699
You can use one or both of ``--add-draws`` and ``--add-seeds`` to expand your simulation. Any previous results will not
57100
be overwritten, but any additional simulations resulting from the new input draws and/or random seeds will be run.
58-
59-
``psimulate expand`` also supports choosing a project via the option flag ``-P``.

src/vivarium_cluster_tools/psimulate/cluster/cli_options.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def with_queue_and_max_runtime(func):
7373
default=PEAK_MEMORY_DEFAULT,
7474
show_default=True,
7575
help=(
76-
"The estimated maximum memory usage in GB of an individual simulate job. "
77-
"The simulations will be run with this as a limit."
76+
"The memory request in GB of each individual simulation job. "
77+
"The simulations will be killed if they exceed this limit."
7878
),
7979
)
8080

@@ -165,10 +165,10 @@ def _validate_runtime_and_queue(runtime_string: str, queue: str):
165165
default=MAX_RUNTIME_DEFAULT,
166166
show_default=True,
167167
help=(
168-
f"The estimated maximum runtime ({_RUNTIME_FORMAT}) of the simulation jobs. "
168+
f"The runtime request ({_RUNTIME_FORMAT}) of each individual simulation job. "
169169
"The maximum supported runtime is 3 days. Keep in mind that the "
170170
"session you are launching from must be able to live at least as long "
171-
"as the simulation jobs, and that runtimes by node vary wildly."
171+
"as the simulation jobs and that runtimes by node vary wildly."
172172
),
173173
callback=_queue_and_runtime_callback,
174174
)

src/vivarium_cluster_tools/psimulate/redis_dbs/cli_options.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Command line options for configuring job/result queue Redis DBs in psimulate runs.
77
88
"""
9+
910
import click
1011

1112
from vivarium_cluster_tools.psimulate.redis_dbs.launcher import (
@@ -29,8 +30,5 @@
2930
type=click.IntRange(min=1),
3031
default=8000,
3132
show_default=True,
32-
help=(
33-
"The maximum number of workers (and therefore jobs) to run "
34-
"concurrently. Defaults to the total number of jobs."
35-
),
33+
help=("The maximum number of workers (and therefore jobs) to run concurrently."),
3634
)

0 commit comments

Comments
 (0)