Workers can spawn subprocesses just like any Python program. Ray adds two requirements: the subprocess must inherit the worker’s resources, and Ray must be able to reap it when the worker exits.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.
Spawn a subprocess
Standardsubprocess calls work without modification.
Long-running subprocesses
For subprocesses that outlive a single method call (a server, a worker pool), wrap them in an actor and clean up in__del__ or an explicit shutdown method.
Resource isolation
Subprocesses spawned by a Ray worker share its resource budget. If your task requestsnum_cpus=4 and spawns a subprocess that uses 8 CPUs, Ray won’t enforce the limit — the subprocess can over-subscribe the host.
For strict isolation, use container runtime environments or cgroup-based scheduling on Kubernetes.
Killing orphaned processes
Ray sendsSIGTERM to the worker when it shuts down or restarts. The worker is responsible for terminating its subprocesses; otherwise they may linger as zombies.
Next steps
Fault tolerance
Recovery semantics when workers crash.
Configure
System-level configuration knobs.