Repository navigation
Conversation
Signed-off-by: rangelml <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces validation to prevent the use of colons (":") in the cluster name when Docker bind mounts are active, which prevents potential Docker startup failures. The reviewer suggests extending this validation to also cover "head_file_mounts" and "worker_file_mounts" since they are also bind-mounted, and updating the corresponding unit tests to include these scenarios.
| has_mounts = bool(config.get("file_mounts")) or ( | ||
| config.get("auth_mode", "token") == "token" | ||
| ) |
There was a problem hiding this comment.
In addition to file_mounts, Ray also supports head_file_mounts and worker_file_mounts which are bind-mounted into the Docker container. If a user specifies either of these while file_mounts is empty and auth_mode is "disabled", the validation check will be bypassed, leading to the same Docker startup failure when the cluster name contains a colon. We should include these in the has_mounts check.
has_mounts = (
bool(config.get("file_mounts"))
or bool(config.get("head_file_mounts"))
or bool(config.get("worker_file_mounts"))
or (config.get("auth_mode", "token") == "token")
)| @pytest.mark.parametrize( | ||
| "mount_config", | ||
| [{"auth_mode": "disabled", "file_mounts": {"/home/ray/path": "."}}, {}], | ||
| ) |
There was a problem hiding this comment.
Update the test parametrization to cover head_file_mounts and worker_file_mounts to ensure that the validation correctly rejects colons in the cluster name when these types of mounts are used.
@pytest.mark.parametrize(
"mount_config",
[
{"auth_mode": "disabled", "file_mounts": {"/home/ray/path": "."}},
{"auth_mode": "disabled", "head_file_mounts": {"/home/ray/path": "."}},
{"auth_mode": "disabled", "worker_file_mounts": {"/home/ray/path": "."}},
{},
],
)
Description
Why are these changes needed?
The Docker autoscaler uses the cluster name in the host path of a
-vbind mount. Docker parses a colon in that name as a mount separator and fails when starting the container. Report an actionable config error before provisioning when user file mounts or the default token mount need a bind mount.Related issues
Related issue number
Closes #45189
The issue is unassigned. Searches for the issue number and Docker cluster-name and bind-mount keywords found no competing open PR.
Additional information
The two invalid configurations passed validation on
upstream/masterand raised the expected error with the fix. The regression also covers configurations that can use a colon without a bind mount.The autoscaler utility and command runner test files passed (19 tests). From the checkout, with the matching Ray wheel installed, the command was:
../.venv/bin/python -c 'import sys; from pathlib import Path; import ray; ray.__path__.insert(0, str(Path("python/ray").resolve())); import pytest; sys.exit(pytest.main(sys.argv[1:]))' -q python/ray/tests/test_autoscaler_util.py python/ray/tests/test_command_runner.pyRuff, Black, and the applicable pre-commit hooks passed.
AI assistance was used for triage, implementation, and testing.