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

Ray Launcher Plugin support for Python 3.11 #2778

Closed
wants to merge 8 commits into from
Closed
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
7 changes: 6 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,12 @@ def test_selected_plugins(session: Session, selected_plugins: List[Plugin]) -> N
# Run tests for all installed plugins
for plugin in selected_plugins:
session.chdir(plugin.abspath)
run_pytest(session)
run_pytest(
session,
".",
"-W ignore:pkg_resources is deprecated as an API.",
*session.posargs,
)


@nox.session(python="3.8") # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from dataclasses import dataclass, field
from enum import Enum, IntEnum
from importlib import import_module
from importlib.metadata import version
from typing import Any, Dict, List, Optional

from hydra.core.config_store import ConfigStore
from omegaconf import OmegaConf
from pkg_resources import get_distribution


@dataclass
Expand Down Expand Up @@ -178,11 +178,11 @@ def _pip_pkgs_default_factory() -> Dict[str, str]:
"hydra_core": "${ray_pkg_version:hydra}",
"ray": "${ray_pkg_version:ray}",
"cloudpickle": "${ray_pkg_version:cloudpickle}",
"hydra_ray_launcher": get_distribution("hydra_ray_launcher").version,
"hydra_ray_launcher": version("hydra_ray_launcher"),
}

if sys.version_info < (3, 8):
d["pickle5"] = get_distribution("pickle5").version
d["pickle5"] = version("pickle5")

return d

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
import warnings
from typing import Optional, Sequence

from hydra.core.utils import JobReturn
Expand Down Expand Up @@ -30,6 +31,8 @@ def __init__(
create_update_cluster: RayCreateOrUpdateClusterConf,
teardown_cluster: RayTeardownClusterConf,
) -> None:
warnings.warn("RayAWSLauncher may not work", DeprecationWarning, stacklevel=2)

self.ray_cfg = ray
self.stop_cluster = stop_cluster
self.sync_up = sync_up
Expand Down
14 changes: 8 additions & 6 deletions plugins/hydra_ray_launcher/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
],
install_requires=[
"boto3==1.22.6",
"hydra-core>=1.1.2",
"ray[default]~=1.12",
"aiohttp==3.8.1",
"cloudpickle==2.0.0",
"pickle5==0.0.11; python_version < '3.8'",
"boto3>=1.28,<1.29",
Copy link
Contributor

Choose a reason for hiding this comment

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

boto3 is constantly updating minor versions, and this constraint may be too harsh. What about the following?

Suggested change
"boto3>=1.28,<1.29",
"boto3>=1.28,<2",

"hydra-core>=1.2",
"ray[default]>=2,<3",
"aiohttp>=3,<4",
"cloudpickle>=3,<4",
"pickle5==0.0.12; python_version < '3.8'",
],
include_package_data=True,
)
5 changes: 2 additions & 3 deletions plugins/hydra_ray_launcher/tests/test_ray_aws_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import subprocess
import sys
import tempfile
from importlib.metadata import version
from pathlib import Path
from typing import Any, Dict, Generator, Optional

import boto3 # type: ignore
import pkg_resources
from botocore.exceptions import NoCredentialsError, NoRegionError # type: ignore
from hydra.core.plugins import Plugins
from hydra.plugins.launcher import Launcher
Expand Down Expand Up @@ -195,11 +195,10 @@ def validate_lib_version(connect_config: Dict[Any, Any]) -> None:
# a few lib versions that we care about
libs = ["ray", "cloudpickle", "pickle5"]
for lib in libs:
local_version = f"{pkg_resources.get_distribution(lib).version}"
out = sdk.run_on_cluster(
connect_config, cmd=f"pip show {lib} | grep Version", with_output=True
).decode()
assert local_version in out, f"{lib} version mismatch"
assert version(lib) in out, f"{lib} version mismatch"

# validate python version
info = sys.version_info
Expand Down