Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Warn when --temp-dir is given on a worker node ray start #31294

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions python/ray/scripts/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,14 @@ def start(
DeprecationWarning,
stacklevel=2,
)
if temp_dir and not head:
cli_logger.warning(
f"`--temp-dir={temp_dir}` option will be ignored. "
"`--head` is a required flag to use `--temp-dir`. "
"temp_dir is only configurable from a head node. "
"All the worker nodes will use the same temp_dir as a head node. "
)
temp_dir = None

redirect_output = None if not no_redirect_output else True
ray_params = ray._private.parameter.RayParams(
Expand Down
28 changes: 28 additions & 0 deletions python/ray/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,34 @@ def test_ray_start(configure_lang, monkeypatch, tmp_path, cleanup_ray):
)


@pytest.mark.skipif(
sys.platform == "darwin" and "travis" in os.environ.get("USER", ""),
reason=("Mac builds don't provide proper locale support"),
)
def test_ray_start_worker_cannot_specify_temp_dir(
configure_lang, tmp_path, cleanup_ray
):
"""
Verify ray start --temp-dir raises an exception when it is used without --head.
"""
runner = CliRunner()
temp_dir = os.path.join("/tmp", uuid.uuid4().hex)
result = runner.invoke(
scripts.start,
[
"--head",
],
)
print(result.output)
_die_on_error(result)
result = runner.invoke(
scripts.start,
[f"--address=localhost:{ray_constants.DEFAULT_PORT}", f"--temp-dir={temp_dir}"],
)
assert result.exit_code == 0
assert "--head` is a required flag to use `--temp-dir`" in str(result.output)


def _ray_start_hook(ray_params, head):
os.makedirs(ray_params.temp_dir, exist_ok=True)
with open(os.path.join(ray_params.temp_dir, "ray_hook_ok"), "w") as f:
Expand Down