Repository navigation
PoolActor now uses num_cpus=0 to avoid any deadlock - #22048
Merged
Merged
Conversation
Contributor
Author
wuisawesome
requested changes
Feb 2, 2022
wuisawesome
left a comment
Contributor
There was a problem hiding this comment.
Can we add the repro from #21488 as a test case?
wuisawesome
reviewed
Feb 3, 2022
| with Pool(ray_address="auto") as pool: | ||
| return list(pool.map(poolit_a, range(2, 4, 1))) | ||
|
|
||
| ray.init(num_cpus=1) |
Contributor
There was a problem hiding this comment.
nit: can we initialize ray with a fixture if possible? Ideally we can use ray_start_shared_local_modes?
wuisawesome
approved these changes
Feb 3, 2022
simonsays1980
pushed a commit
to simonsays1980/ray
that referenced
this pull request
Feb 27, 2022
ray-project#21488 (comment) : > We discussed this issue in a bit more detail and came to the conclusion that we should set the CPU resource requirement for each actor in the actor pool to 0, to make the Ray Pool compatible/same behavior as the Python multiprocessing pool. Would that work for you @yogeveran ? (very similar to solution 4 mentioned above, but with 0.0 instead of 0.1, so it works in all cases).
2 tasks
OneSizeFitsQuorum
added a commit
to OneSizeFitsQuorum/ray
that referenced
this pull request
Jul 23, 2026
Add an opt-in joblib backend that runs each batch as a short-lived Ray task instead of a long-lived actor, so pending work surfaces CPU demand to the Ray autoscaler and finished tasks release their CPUs. The existing "ray" backend keeps a fixed-size pool of num_cpus=0 actors (set by ray-project#22048) for the whole Parallel call, which surfaces no resource demand and prevents worker scale-down. The new "ray_tasks" backend submits num_cpus=1 tasks; Ray's scheduler bounds concurrency to the available CPUs, pending tasks drive autoscaling, and tasks release CPUs on completion. n_jobs is a concurrency cap, not a startup requirement: with M < N available CPUs and n_jobs=N, M tasks run and N-M stay pending (and drive autoscaling toward N). n_jobs=-1 keeps joblib's "all cores" convention; max_n_jobs sets an explicit cap. register_ray(register_tasks=True) additionally registers "ray_tasks"; the default is unchanged. Reuses RayBatchedCalls object-store dedup so a shared sklearn dataset is ray.put once across batches. Talks only to Ray Core APIs; does not call the Kubernetes API and does not depend on KubeRay. Documented in doc/source/ray-more-libs/joblib.rst. Signed-off-by: OneSizeFitsQuorum <[email protected]>
OneSizeFitsQuorum
added a commit
to OneSizeFitsQuorum/ray
that referenced
this pull request
Jul 29, 2026
Add an opt-in joblib backend that runs each batch as a short-lived Ray task instead of a long-lived actor, so pending work surfaces CPU demand to the Ray autoscaler and finished tasks release their CPUs. The existing "ray" backend keeps a fixed-size pool of num_cpus=0 actors (set by ray-project#22048) for the whole Parallel call, which surfaces no resource demand and prevents worker scale-down. The new "ray_tasks" backend submits num_cpus=1 tasks; Ray's scheduler bounds concurrency to the available CPUs, pending tasks drive autoscaling, and tasks release CPUs on completion. n_jobs is a concurrency cap, not a startup requirement: with M < N available CPUs and n_jobs=N, M tasks run and N-M stay pending (and drive autoscaling toward N). n_jobs=-1 keeps joblib's "all cores" convention; max_n_jobs sets an explicit cap. register_ray(register_tasks=True) additionally registers "ray_tasks"; the default is unchanged. Reuses RayBatchedCalls object-store dedup so a shared sklearn dataset is ray.put once across batches. Talks only to Ray Core APIs; does not call the Kubernetes API and does not depend on KubeRay. Documented in doc/source/ray-more-libs/joblib.rst. Signed-off-by: OneSizeFitsQuorum <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
#21488 (comment) :
Related issue number
Closes #21488
Checks
scripts/format.shto lint the changes in this PR.