Ray’s scheduler matches tasks and actors to nodes based on requested resources and a scheduling strategy. For workloads that need precise placement — gang scheduling, locality, or anti-affinity — use placement groups to reserve resources up front.Documentation Index
Fetch the complete documentation index at: https://ray-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Resource requests
Each task or actor declares resources vianum_cpus, num_gpus, memory, and a resources={...} dictionary for custom labels.
Scheduling strategies
Usescheduling_strategy on .options() to control placement.
| Strategy | Behavior |
|---|---|
"DEFAULT" | Spread across the cluster while honoring locality. |
"SPREAD" | Spread tasks/actors across as many nodes as possible. |
NodeAffinitySchedulingStrategy(node_id, soft) | Pin to a specific node (soft or hard). |
PlacementGroupSchedulingStrategy(pg, bundle_index) | Schedule into a placement group bundle. |
Placement groups
A placement group reserves a set of resource bundles across the cluster up front. Tasks and actors then schedule into specific bundles.Strategies
| Strategy | Effect |
|---|---|
PACK | Try to pack bundles onto as few nodes as possible. |
SPREAD | Spread bundles across as many nodes as possible. |
STRICT_PACK | Like PACK, but fail if bundles can’t fit on one node. |
STRICT_SPREAD | One bundle per node; fail if not possible. |
Schedule into a bundle
Release resources
Placement groups are reference-counted; they release their reservations when the Python handle is garbage-collected. Callray.util.remove_placement_group(pg) to release explicitly.
Locality-aware scheduling
When a task takes anObjectRef argument, Ray prefers to schedule it on a node that already holds the object. This avoids unnecessary data movement.
Memory-aware scheduling
Setmemory=... to request a memory allocation. Ray tracks memory usage and refuses to schedule tasks on nodes without enough headroom.
Next steps
Resources
Configure node resources at cluster start time.
Fault tolerance
Recovery semantics for tasks, actors, and placement groups.