Skip to content

Commit 3c3d515

Browse files
committed
Add Submission example to docs
1 parent e50c1bb commit 3c3d515

2 files changed

Lines changed: 58 additions & 4 deletions

File tree

docs/source/index.rst

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,71 @@ Quick Start
3434

3535
.. code-block:: python
3636
37-
from ray_utilities.setup import PPOSetup
37+
from ray_utilities.config import DefaultArgumentParser
3838
from ray_utilities.runfiles import run_tune
39+
from ray_utilities.setup import PPOSetup
3940
40-
with PPOSetup() as setup:
41+
with (
42+
DefaultArgumentParser.patch_args(
43+
# Override default CLI arguments. Passed CLI arguments still have a higher priority.
44+
"--batch-size", 1024,
45+
),
46+
PPOSetup() as setup
47+
):
4148
# Inside the with block modify your configuration
42-
setup.config.env = "CartPole-v1"
49+
# setup.config can be any AlgorithmConfig
50+
setup.config.environment(env="CartPole-v1")
4351
setup.config.lr = 0.001
44-
# Now the config is frozen and the setup.trainable is build
52+
# After the with block the config is frozen and the setup.trainable is ready to use with Ray Tune
4553
4654
# Run hyperparameter optimization
4755
results = run_tune(setup)
4856
57+
58+
Ray Job Submission CLI
59+
----------------------
60+
61+
The script ``ray_submit.py`` provides a command-line interface for submitting and monitoring Ray jobs in bulk using a YAML configuration file.
62+
It leverages the Ray Job Submission API to automate experiment runs and track their status.
63+
See one of the submission scripts in ``experiments/`` for example usage how to define an entrypoint template and replacement variables.
64+
65+
**Basic Usage:**
66+
67+
.. code-block:: bash
68+
69+
# Basic use
70+
python ray_submit.py <group|"all"|"monitor"|"restore"> <submissions_file.yaml> [--address <RAY_DASHBOARD_URL>] [--max-jobs <N>] [--test]
71+
72+
# View the help message for detailed options
73+
python ray_submit.py --help
74+
75+
**Arguments:**
76+
77+
- ``group``: The group key in the YAML file to run, ``all`` for all groups, or ``monitor`` to only monitor jobs.
78+
``restore`` can be used to restore failed jobs. These must be labled with ``status: RESTORE`` in the YAML file.
79+
- ``submissions_file``: Path to the YAML file containing job definitions.
80+
- ``monitor_group``: (Optional) Additional group(s) to monitor.
81+
82+
**Options:**
83+
84+
- ``--address``: Address of the Ray cluster (default: uses ``DASHBOARD_ADDRESS`` env or ``localhost:8265``).
85+
- ``--test``: Run in test mode without submitting jobs.
86+
- ``--failed-only``: Only submit jobs that have previously failed.
87+
- ``--max-jobs``: Maximum number of jobs to submit concurrently.
88+
- ``--excludes ...``: Space-separated key words in the job name to exclude from submission.
89+
- ``--includes ...``: Space-separated key words in the job name to include for submission, excludes all non-matching jobs.
90+
91+
**Example:**
92+
93+
.. code-block:: bash
94+
95+
python ray_submit.py all submissions.yaml --failed-only
96+
97+
This will submit all jobs defined in ``submissions.yaml`` that have previously failed, using the specified Ray cluster address.
98+
99+
For more details, see the script's docstring or run ``python ray_submit.py --help``.
100+
101+
49102
Installation
50103
------------
51104

experiments/create_tune_parameters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"vf_clip_param": {"grid_search": [0.05, 0.125, 0.33, 1.0, 2.0, 10.0, 100.0]},
8080
# kl_coeff if use_kl_loss; default is 0.2, target is 0.1
8181
"kl_coeff": {"grid_search": [0.025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3]},
82+
# num_epochs: {"grid_search": [1, 4, 8, 16, 32, 64, 128]},
8283
# endregion PPO
8384
# Dummy value --tune test
8485
"test": {"grid_search": [1, 2, 3]},

0 commit comments

Comments
 (0)