@@ -123,6 +123,36 @@ index bee0ae6..ee0e3ea 100644
123
123
"actor_method_names": json.dumps(list(actor_method_names)),
124
124
}
125
125
126
+ diff --git a/python/ray/_private/resource_spec.py b/python/ray/_private/resource_spec.py
127
+ index 69780aade9..3be8cbbc4c 100644
128
+ --- a/python/ray/_private/resource_spec.py
129
+ +++ b/python/ray/_private/resource_spec.py
130
+ @@ -160,9 +160,22 @@ class ResourceSpec(
131
+ if is_head:
132
+ resources[HEAD_NODE_RESOURCE_NAME] = 1.0
133
+
134
+ - num_cpus = self.num_cpus
135
+ - if num_cpus is None:
136
+ - num_cpus = ray._private.utils.get_num_cpus()
137
+ + try:
138
+ + system_num_cpus = __graalpython__.get_max_process_count()
139
+ + factor = min(system_num_cpus, 4)
140
+ + num_cpus = system_num_cpus // factor
141
+ + if self.num_cpus:
142
+ + num_cpus = min(self.num_cpus, num_cpus)
143
+ + if num_cpus != self.num_cpus:
144
+ + logger.warning(
145
+ + f"GraalPy: user requested {self.num_cpus} for number"
146
+ + "of CPUs, but GraalPy can only support up to {num_cpus} CPUs"
147
+ + )
148
+ + except:
149
+ + # We are not running on GraalPy
150
+ + num_cpus = self.num_cpus
151
+ + if num_cpus is None:
152
+ + num_cpus = ray._private.utils.get_num_cpus()
153
+
154
+ num_gpus = 0
155
+ for (
126
156
diff --git a/python/ray/_private/services.py b/python/ray/_private/services.py
127
157
index 867b748..40b3fb2 100644
128
158
--- a/python/ray/_private/services.py
@@ -272,10 +302,10 @@ index a34a39c..51a1a17 100644
272
302
if BAZEL_ARGS:
273
303
diff --git a/ray_build_backend.py b/ray_build_backend.py
274
304
new file mode 100644
275
- index 0000000..9e7f3fd
305
+ index 0000000000..10f532ae9e
276
306
--- /dev/null
277
307
+++ b/ray_build_backend.py
278
- @@ -0,0 +1,117 @@
308
+ @@ -0,0 +1,125 @@
279
309
+ # We need a whole custom build backend just because the setup.py is in a subdir
280
310
+ import os
281
311
+ import re
@@ -385,6 +415,14 @@ index 0000000..9e7f3fd
385
415
+ env = os.environ.copy()
386
416
+ env['SKIP_THIRDPARTY_INSTALL'] = 'true'
387
417
+ try:
418
+ + system_num_cpus = __graalpython__.get_max_process_count()
419
+ + env['BAZEL_LIMIT_CPUS'] = '%d' % system_num_cpus
420
+ + except:
421
+ + # do not limit bazel
422
+ + pass
423
+ + try:
424
+ + if os.path.isdir(Path('dist')):
425
+ + shutil.rmtree(Path('dist'))
388
426
+ subprocess.run([sys.executable, 'setup.py', 'bdist_wheel'], env=env, check=True)
389
427
+ wheels = list(Path('dist').glob('*.whl'))
390
428
+ assert len(wheels) == 1, f"Expected 1 wheel, found {len(wheels)}"
0 commit comments