[Docs] Enumerate accepted resource keys for ScalingConfig (#46608)#63449
[Docs] Enumerate accepted resource keys for ScalingConfig (#46608)#63449dstrodtman wants to merge 1 commit into
Conversation
…t#46608) The ``trainer_resources`` and ``resources_per_worker`` docstrings on ``ScalingConfig`` previously only named ``"CPU"`` (and ``"GPU"``) and pointed at the ``custom-resources`` ref without listing the pre-defined keys users can actually pass. Expand both docstrings in ``python/ray/air/config.py`` (V1) and the V2 override in ``python/ray/train/v2/api/config.py`` to enumerate ``"CPU"``, ``"GPU"``, ``"memory"`` (bytes), ``"TPU"`` (V2 only), and custom resources, with case-sensitivity callouts and a link to the Ray Core resources page. Closes ray-project#46608 [DOC-980] Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
There was a problem hiding this comment.
Code Review
This pull request improves the documentation for ScalingConfig in both the Ray AIR and Train V2 APIs by explicitly listing supported resource keys and their case sensitivity. The review feedback suggests clarifying that memory in trainer_resources is reserved for the coordinator actor and ensuring that 'TPU' is consistently included in the case-sensitivity notes across all configuration versions.
|
|
||
| - ``"CPU"``: number of logical CPUs. | ||
| - ``"GPU"``: number of logical GPUs. | ||
| - ``"memory"``: heap memory reserved on the node, in bytes |
There was a problem hiding this comment.
For trainer_resources, the memory is reserved specifically for the training coordinator actor, not for the entire node. Using "reserved for the coordinator" would be more accurate and consistent with the "reserved per worker" phrasing used in the resources_per_worker section below.
| - ``"memory"``: heap memory reserved on the node, in bytes | |
| - ``"memory"``: heap memory reserved for the coordinator, in bytes |
| Keys are case-sensitive: use ``"CPU"`` and ``"GPU"`` (uppercase), | ||
| and ``"memory"`` (lowercase). |
There was a problem hiding this comment.
Since "TPU" is used as a common example of a resource key in the preceding lines, it would be helpful to include it in the case-sensitivity summary for consistency, even if it is technically a custom resource in this version. This aligns with the documentation in the V2 ScalingConfig.
| Keys are case-sensitive: use ``"CPU"`` and ``"GPU"`` (uppercase), | |
| and ``"memory"`` (lowercase). | |
| Keys are case-sensitive: use ``"CPU"``, ``"GPU"``, and ``"TPU"`` | |
| (uppercase), and ``"memory"`` (lowercase). |
| Keys are case-sensitive: use ``"CPU"`` and ``"GPU"`` (uppercase), | ||
| and ``"memory"`` (lowercase). |
There was a problem hiding this comment.
For consistency with the examples and the V2 documentation, consider including "TPU" in the list of uppercase keys in the case-sensitivity note.
| Keys are case-sensitive: use ``"CPU"`` and ``"GPU"`` (uppercase), | |
| and ``"memory"`` (lowercase). | |
| Keys are case-sensitive: use ``"CPU"``, ``"GPU"``, and ``"TPU"`` | |
| (uppercase), and ``"memory"`` (lowercase). |
Description
The
trainer_resourcesandresources_per_workerdocstrings onScalingConfigpreviously only named"CPU"(and"GPU") and pointed at thecustom-resourcesref without listing the pre-defined keys users can actually pass — the reporter explicitly asked whether they could requestmemory. Expand both docstrings inpython/ray/air/config.py(V1) and the V2 override inpython/ray/train/v2/api/config.pyto enumerate"CPU","GPU","memory"(bytes),"TPU"(V2 only), and custom resources, with case-sensitivity callouts and a link to the Ray Core resources page.Related issues
Closes #46608
[DOC-980]
Additional information
Target files:
python/ray/air/config.py— V1ScalingConfig(the base class; documents bothtrainer_resourcesandresources_per_worker).python/ray/train/v2/api/config.py— V2ScalingConfig(subclasses V1 and overrides theresources_per_workerdocstring;trainer_resourcesis deprecated in V2 and not re-documented here).No code or behavior changes; docstrings only.
Generated with Claude Code