Skip to content

Commit 5b082bc

Browse files
committed
Add ray 2.9.1 patch
1 parent e8f832f commit 5b082bc

File tree

2 files changed

+157
-0
lines changed

2 files changed

+157
-0
lines changed

graalpython/lib-graalpython/patches/ray/metadata.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ patch = 'ray-2.3.0.patch'
55
[[add-sources]]
66
version = '2.3.0'
77
url = 'https://github.com/ray-project/ray/releases/download/ray-2.3.0/ray-2.3.0.tar.gz'
8+
9+
[[rules]]
10+
version = '== 2.9.1'
11+
patch = 'ray-2.9.1.patch'
12+
13+
[[add-sources]]
14+
version = '2.9.1'
15+
url = 'https://github.com/ray-project/ray/archive/refs/tags/ray-2.9.1.tar.gz'
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
diff --git a/bazel/ray.bzl b/bazel/ray.bzl
2+
index 4cd1aa2..95250a4 100644
3+
--- a/bazel/ray.bzl
4+
+++ b/bazel/ray.bzl
5+
@@ -30,6 +30,9 @@ PYX_COPTS = select({
6+
"//conditions:default": [
7+
# Ignore this warning since CPython and Cython have issue removing deprecated tp_print on MacOS
8+
"-Wno-deprecated-declarations",
9+
+ "-Wno-unused-variable",
10+
+ "-Wno-unused-function",
11+
+ "-Wno-sign-compare",
12+
],
13+
}) + select({
14+
"@bazel_tools//src/conditions:windows": [
15+
diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl
16+
index f91eb30..b0d11ea 100644
17+
--- a/bazel/ray_deps_setup.bzl
18+
+++ b/bazel/ray_deps_setup.bzl
19+
@@ -188,6 +188,10 @@ def ray_deps_setup():
20+
build_file = True,
21+
url = "https://github.com/cython/cython/archive/c48361d0a0969206e227ec016f654c9d941c2b69.tar.gz",
22+
sha256 = "37c466fea398da9785bc37fe16f1455d2645d21a72e402103991d9e2fa1c6ff3",
23+
+ patch_cmds = [
24+
+ 'graalpy -m autopatch_capi .',
25+
+ '''patch -p1 < "$(graalpy -c 'print(__graalpython__.core_home)')/patches/Cython/Cython-0.29.32.patch"''',
26+
+ ],
27+
)
28+
29+
auto_http_archive(
30+
diff --git a/dashboard/optional_deps.py b/dashboard/optional_deps.py
31+
index 1dfaaca..6eeb618 100644
32+
--- a/dashboard/optional_deps.py
33+
+++ b/dashboard/optional_deps.py
34+
@@ -15,7 +15,7 @@ import aiohttp_cors # noqa: F401
35+
from aiohttp import hdrs # noqa: F401
36+
from aiohttp.typedefs import PathLike # noqa: F401
37+
from aiohttp.web import RouteDef # noqa: F401
38+
-import pydantic # noqa: F401
39+
+# import pydantic # noqa: F401
40+
import grpc # noqa: F401
41+
42+
# Adding new modules should also be reflected in the
43+
diff --git a/pyproject.toml b/pyproject.toml
44+
new file mode 100644
45+
index 0000000..de2b7ad
46+
--- /dev/null
47+
+++ b/pyproject.toml
48+
@@ -0,0 +1,4 @@
49+
+[build-system]
50+
+requires = ["setuptools >= 40.6.0", "wheel", "pip", "psutil", "setproctitle", "colorama"]
51+
+build-backend = "ray_build_backend"
52+
+backend-path = ["."]
53+
diff --git a/python/ray/_private/services.py b/python/ray/_private/services.py
54+
index 867b748..40b3fb2 100644
55+
--- a/python/ray/_private/services.py
56+
+++ b/python/ray/_private/services.py
57+
@@ -1000,7 +1000,7 @@ def start_ray_process(
58+
stdout=stdout_file,
59+
stderr=stderr_file,
60+
stdin=subprocess.PIPE if pipe_stdin else None,
61+
- preexec_fn=preexec_fn if sys.platform != "win32" else None,
62+
+ #preexec_fn=preexec_fn if sys.platform != "win32" else None,
63+
creationflags=CREATE_SUSPENDED if win32_fate_sharing else 0,
64+
)
65+
66+
diff --git a/python/ray/cloudpickle/cloudpickle.py b/python/ray/cloudpickle/cloudpickle.py
67+
index 9c67ec6..12fda5a 100644
68+
--- a/python/ray/cloudpickle/cloudpickle.py
69+
+++ b/python/ray/cloudpickle/cloudpickle.py
70+
@@ -521,10 +521,8 @@ def _walk_global_ops(code):
71+
"""
72+
Yield referenced name for all global-referencing instructions in *code*.
73+
"""
74+
- for instr in dis.get_instructions(code):
75+
- op = instr.opcode
76+
- if op in GLOBAL_OPS:
77+
- yield instr.argval
78+
+ # GraalPy change: we don't support dis
79+
+ yield from code.co_names
80+
81+
82+
def _extract_class_dict(cls):
83+
diff --git a/ray_build_backend.py b/ray_build_backend.py
84+
new file mode 100644
85+
index 0000000..e9d325f
86+
--- /dev/null
87+
+++ b/ray_build_backend.py
88+
@@ -0,0 +1,41 @@
89+
+# We need a whole custom build backend just because the setup.py is in a subdir
90+
+import os
91+
+import re
92+
+import sys
93+
+import tarfile
94+
+import subprocess
95+
+import tempfile
96+
+import shutil
97+
+from pathlib import Path
98+
+
99+
+
100+
+def build_sdist(sdist_directory, config_settings=None):
101+
+ nv = 'ray-2.9.1'
102+
+ srcdir = Path(__file__).parent
103+
+ archive_path = Path(sdist_directory) / f'{nv}.tar.gz'
104+
+
105+
+ def tarfilter(info):
106+
+ if re.match(r'\./(?:.git|bazel-|venv|[^-/]+-venv|dist)', info.name):
107+
+ return None
108+
+ info.name = f'./{nv}/{info.name}'
109+
+ return info
110+
+
111+
+ with tarfile.open(archive_path, 'w:gz') as tar:
112+
+ tar.add('.', filter=tarfilter)
113+
+ return archive_path.name
114+
+
115+
+
116+
+def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
117+
+ wheel_directory = Path(wheel_directory).absolute()
118+
+ os.chdir('python')
119+
+ env = os.environ.copy()
120+
+ env['SKIP_THIRDPARTY_INSTALL'] = 'true'
121+
+ try:
122+
+ subprocess.run([sys.executable, 'setup.py', 'bdist_wheel'], env=env, check=True)
123+
+ wheels = list(Path('dist').glob('*.whl'))
124+
+ assert len(wheels) == 1, f"Expected 1 wheel, found {len(wheels)}"
125+
+ wheel = wheels[0]
126+
+ shutil.copyfile(wheel, wheel_directory / wheel.name)
127+
+ return str(wheel.name)
128+
+ finally:
129+
+ os.chdir('..')
130+
diff --git a/src/ray/util/logging.cc b/src/ray/util/logging.cc
131+
index f41aa65..f8e895d 100644
132+
--- a/src/ray/util/logging.cc
133+
+++ b/src/ray/util/logging.cc
134+
@@ -374,6 +374,7 @@ bool RayLog::IsFailureSignalHandlerEnabled() {
135+
}
136+
137+
void RayLog::InstallFailureSignalHandler(const char *argv0, bool call_previous_handler) {
138+
+ /*
139+
#ifdef _WIN32
140+
// If process fails to initialize, don't display an error window.
141+
SetErrorMode(GetErrorMode() | SEM_FAILCRITICALERRORS);
142+
@@ -389,6 +390,7 @@ void RayLog::InstallFailureSignalHandler(const char *argv0, bool call_previous_h
143+
options.writerfn = WriteFailureMessage;
144+
absl::InstallFailureSignalHandler(options);
145+
is_failure_signal_handler_installed_ = true;
146+
+ */
147+
}
148+
149+
void RayLog::InstallTerminateHandler() { std::set_terminate(TerminateHandler); }

0 commit comments

Comments
 (0)