Skip to content

[train][torchft] Fix Lighthouse Actor unschedulable error - #68635

Open
JasonLi1909 wants to merge 5 commits into
ray-project:masterfrom
JasonLi1909:train-torchft-lighthouse-num-cpus
Open

JasonLi1909 wants to merge 5 commits into
ray-project:masterfrom
JasonLi1909:train-torchft-lighthouse-num-cpus

Conversation

@JasonLi1909

@JasonLi1909 JasonLi1909 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

#61156 pins the torchft Lighthouse actor, with a hard node affinity, to the Train controller's node, which is the driver's node. The actor sets no resources, so Ray requires 1 CPU to schedule it. On a head node with no CPUs, the default on Anyscale, the actor is infeasible and every TorchftConfig run fails at startup:

ray.exceptions.ActorUnschedulableError: The actor is not schedulable: The node specified via NodeAffinitySchedulingStrategy doesn't exist any more or is infeasible, and soft=False was specified.

The fix schedules the Lighthouse with num_cpus=0, like the controller. CI missed this because the torchft tests run on ray.init(num_cpus=4).

Changes

  • Pass num_cpus=0 in the Lighthouse's .options() call, next to its node affinity, the way the controller and other Ray Train actors set resources where they're created.
  • Add a regression test to test_torch_trainer.py. To fit its multi-node Cluster there, the file now uses the per-test ray_start_4_cpus from conftest.py instead of a module-scoped override, like other files that mix cluster setups, and the target is bumped to large for the extra Ray startups.

Tests

  • test_torchft_lighthouse_on_zero_cpu_head_node: new. Trains the torchft linear example from a 0-CPU head node with a 4-CPU worker node. Runs in the torchft CI image. Not run locally, since torchft only ships Linux wheels.
  • Local repro on Ray 2.60.1 (same torchft_config.py as master), with only torchft.coordination.LighthouseServer stubbed: the error above before the fix, and a clean run after.

Not a duplicate: no existing issue or PR covers this. Found while validating the torchft guide example (#68464). AI assistance was used.

The Lighthouse actor is pinned with a hard node affinity to the Train
controller's node, which is the driver's node and often a head node with
no logical CPUs. Ray schedules an actor with 1 CPU by default, so on such
a head node the actor is infeasible and TorchTrainer.fit() fails with
ActorUnschedulableError. Schedule the actor with num_cpus=0 and add a
regression test with a zero-CPU head node.

Signed-off-by: JasonLi1909 <[email protected]>
@JasonLi1909
JasonLi1909 requested a review from a team as a code owner November 29, 2026 02:09

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request configures the LighthouseServerActor to reserve zero CPUs, allowing it to run on head nodes with no logical CPUs. It also introduces a new test suite, test_torchft_scheduling.py, to verify this behavior. Feedback suggests adding pytest.importorskip("torchft") to the test file to prevent failures in environments where torchft is not supported or installed.

…iner.py

Use the per-test ray_start_4_cpus fixture from conftest.py instead of a
module-scoped override, like the other test files that mix cluster
setups, so the multi-node test can live next to the other torchft tests.
Bump the target to large for the added per-test Ray startup.

Signed-off-by: JasonLi1909 <[email protected]>
The driver attaches to the head node, so assert that instead of pinning
a task there.

Signed-off-by: JasonLi1909 <[email protected]>
@JasonLi1909 JasonLi1909 changed the title [train][torchft] Don't reserve a CPU for the torchft Lighthouse actor [train][torchft] Fix Lighthouse Actor unschedulable error Nov 29, 2026
Pass num_cpus=0 in the .options() call next to its node affinity, the
way the controller and other Ray Train actors set resources, instead of
in the class decorator.

Signed-off-by: JasonLi1909 <[email protected]>
@ray-gardener ray-gardener Bot added the train Ray Train Related Issue label Nov 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

train Ray Train Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant