Skip to content

[Docs] Enumerate accepted resource keys for ScalingConfig (#46608)#63449

Open
dstrodtman wants to merge 1 commit into
ray-project:masterfrom
dstrodtman:doc-980-scalingconfig-resource-keys
Open

[Docs] Enumerate accepted resource keys for ScalingConfig (#46608)#63449
dstrodtman wants to merge 1 commit into
ray-project:masterfrom
dstrodtman:doc-980-scalingconfig-resource-keys

Conversation

@dstrodtman
Copy link
Copy Markdown
Contributor

Description

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 — the reporter explicitly asked whether they could request memory. 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.

Related issues

Closes #46608

[DOC-980]

Additional information

Target files:

  • python/ray/air/config.py — V1 ScalingConfig (the base class; documents both trainer_resources and resources_per_worker).
  • python/ray/train/v2/api/config.py — V2 ScalingConfig (subclasses V1 and overrides the resources_per_worker docstring; trainer_resources is deprecated in V2 and not re-documented here).

No code or behavior changes; docstrings only.

Generated with Claude Code

…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>
@dstrodtman dstrodtman requested a review from a team as a code owner May 18, 2026 16:03
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread python/ray/air/config.py

- ``"CPU"``: number of logical CPUs.
- ``"GPU"``: number of logical GPUs.
- ``"memory"``: heap memory reserved on the node, in bytes
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
- ``"memory"``: heap memory reserved on the node, in bytes
- ``"memory"``: heap memory reserved for the coordinator, in bytes

Comment thread python/ray/air/config.py
Comment on lines +123 to +124
Keys are case-sensitive: use ``"CPU"`` and ``"GPU"`` (uppercase),
and ``"memory"`` (lowercase).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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).

Comment thread python/ray/air/config.py
Comment on lines +149 to +150
Keys are case-sensitive: use ``"CPU"`` and ``"GPU"`` (uppercase),
and ``"memory"`` (lowercase).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the examples and the V2 documentation, consider including "TPU" in the list of uppercase keys in the case-sensitivity note.

Suggested change
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).

@ray-gardener ray-gardener Bot added docs An issue or change related to documentation train Ray Train Related Issue labels May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs An issue or change related to documentation train Ray Train Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Doc | Ray Train] Make it clear what resources are accpeted by trainer_resources and resources_per_worker

1 participant