Repository navigation
[train][4/n] Add HealthManager to ray.train.health - #66649
Conversation
701a91b to
d1e3fe3
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces the HealthManager to coordinate health probes, evaluators, and decisions, and adds support for keeping a history of probe results up to a specified window_size. Feedback on these changes suggests ensuring that the result deque is correctly resized if the window size decreases dynamically, and skipping disabled evaluators during worker group restarts to avoid unnecessary exceptions.
d1e3fe3 to
f44901a
Compare
f44901a to
594f753
Compare
594f753 to
7fd4f5c
Compare
7fd4f5c to
64fa3f2
Compare
64fa3f2 to
9869576
Compare
9869576 to
7347ff5
Compare
67de6b0 to
a6dd39c
Compare
…cisions, policies (#66536) ## Description First PR of a stack implementing the [Ray Train Monitoring and Diagnostics REP](https://github.com/ray-project/enhancements/tree/main/reps/2026-08-11-ray-train-monitoring-and-diagnostics). This one adds only the data contracts in a new `ray.train.health` module; nothing is wired into the controller yet. - `probe.py`: `ProbeResult` (named numeric readings, plus when they were taken), `Probe`, and the two probe kinds, named for where they run: `WorkerProbe` (inside each training worker) and `NodeProbe` (on each node, outside the workers). - `state.py`: `HealthState`, what evaluators read: `probe_results`, the latest `ProbeResult` of each probe, keyed by probe name and then world rank or node ID. - `decision.py`: the decisions `Noop`, `Reattempt`, `Evict` and `Diagnose`. `Diagnose.checks` names the health checks to run once. - `evaluator.py`: `Evaluator` (returns one `HealthDecision`, with an optional `on_worker_group_start()` hook). - `check.py`: `HealthCheck` (probes plus the evaluators that decide on their readings; both creators default to none), `PeriodicHealthCheck` (a `HealthCheck` whose probes are polled every `poll_interval_s`), and `HealthConfig` (`inflight_checks`, which are `PeriodicHealthCheck`s that run during training, and `preflight_checks`, which run once before training). Next in the stack: `ControllerProbe` (#66648), `NodeMonitor` (#66650), `HealthManager` (#66649), then `ray.train.health.report()`, the controller integration, and running checks once (diagnostics and pre-flight). See a draft for the REP in: #66247 ```mermaid classDiagram direction LR class HealthConfig { inflight_checks: List~PeriodicHealthCheck~ preflight_checks: List~HealthCheck~ } class HealthCheck { probe_creator() List~Probe~ evaluator_creator() List~Evaluator~ } class PeriodicHealthCheck { poll_interval_s: float } class Probe { <<abstract>> name: str } class WorkerProbe { <<abstract>> poll() ProbeResult } class NodeProbe { <<abstract>> poll() ProbeResult } class ProbeResult { metrics: Dict~str,float~ timestamp_s: float } class HealthState { probe_results: Dict } class Evaluator { <<abstract>> evaluate(state) HealthDecision on_worker_group_start() } class HealthDecision { <<abstract>> reason: str } class Evict { target_nodes: List~str~ } class Diagnose { checks: List~HealthCheck~ } HealthConfig o-- PeriodicHealthCheck : inflight HealthConfig o-- HealthCheck : preflight HealthCheck <|-- PeriodicHealthCheck HealthCheck ..> Probe : creates HealthCheck ..> Evaluator : creates Probe <|-- WorkerProbe Probe <|-- NodeProbe WorkerProbe ..> ProbeResult : returns NodeProbe ..> ProbeResult : returns HealthState o-- ProbeResult : latest per probe, per rank or node Evaluator ..> HealthState : reads Evaluator ..> HealthDecision : returns HealthDecision <|-- Noop HealthDecision <|-- Reattempt HealthDecision <|-- Evict HealthDecision <|-- Diagnose Diagnose o-- HealthCheck : runs once ``` ## Test 1. test with draft PR #66247 with script: https://gist.github.com/liulehui/5d65f0fc9c27298872ec49e454d65ad7 2. example logs: ``` ============================================================================== health: ray.train.health ============================================================================== injected: rank 1 stops calling the collective at step 100 and sleeps (a silent hang) (TrainController pid=25958) [State Transition] SHUTTING_DOWN -> ERRORED. (TrainController pid=26887) Requesting resources: {'GPU': 1} * 4 (TrainController pid=26887) /home/ray/anaconda3/lib/python3.12/site-packages/ray/data/_internal/execution/interfaces/execution_options.py:436: RayDeprecationWarning: `ExecutionOptions.exclude_resources` is deprecated and will be removed after January 2027. Use `ExecutionOptions.label_selector` to constrain Ray Data work to labeled nodes. (TrainController pid=26887) self.exclude_resources = exclude_resources (TrainController pid=26887) [State Transition] INITIALIZING -> SCHEDULING. (TrainController pid=26887) [Health] pre-flight passed on 4 node(s). (TrainController pid=26887) Attempting to start training worker group of size 4 with the following resources: [{'GPU': 1}] * 4 (RayTrainWorker pid=8859, ip=10.0.154.65) Setting up process group for: env:// [rank=0, world_size=4] (TrainController pid=26887) {"asctime":"2026-09-28 10:59:04,061","levelname":"E","message":"Actor with class name: 'PreemptionWatcher' and ID: '527407ea2951e6244aed01d302000000' has constructor arguments in the object store and max_restarts > 0. If the arguments in the object store go out of scope or are lost, the actor restart will fail. See #53727 for more details.","filename":"core_worker.cc","lineno":2465} (TrainController pid=26887) Started training worker group of size 4: (TrainController pid=26887) - (ip=10.0.154.65, pid=8859) world_rank=0, local_rank=0, node_rank=0 (TrainController pid=26887) - (ip=10.0.149.4, pid=8860) world_rank=1, local_rank=0, node_rank=1 (TrainController pid=26887) - (ip=10.0.138.97, pid=8935) world_rank=2, local_rank=0, node_rank=2 (TrainController pid=26887) - (ip=10.0.132.60, pid=8993) world_rank=3, local_rank=0, node_rank=3 (TrainController pid=26887) [State Transition] SCHEDULING -> RUNNING. (TrainController pid=26887) [Health] DIAGNOSE (NO_PROGRESS): 1 of 1 NCCL communicators (0x6b6b31bd2e55f51) made no progress for 20s; running diagnostics before attributing it (TrainController pid=26887) [Health] diagnostic output: /mnt/cluster_storage/nccl_hang_health_1790618333/health_diagnostics/nccl_ras (TrainController pid=26887) [Health] diagnostic output: /mnt/cluster_storage/nccl_hang_health_1790618333/health_diagnostics/nvidia_smi (TrainController pid=26887) [Health] diagnostic output: /mnt/cluster_storage/nccl_hang_health_1790618333/health_diagnostics/stack_traces (TrainController pid=26887) [Health] REATTEMPT (NO_PROGRESS): 1 of 1 NCCL communicators (0x6b6b31bd2e55f51) made no progress for 20s; diagnostics found no hardware fault, so this is software or data (TrainController pid=26887) [FailurePolicy] RAISE (TrainController pid=26887) Source: worker group (TrainController pid=26887) Error count: 1 (max allowed: 0) (TrainController pid=26887) Error: Training failed due to worker errors: (TrainController pid=26887) 1 of 1 NCCL communicators (0x6b6b31bd2e55f51) made no progress for 20s; diagnostics found no hardware fault, so this is software or data (TrainController pid=26887) ray.train.v2.api.exceptions.HealthDecisionError: Training failed due to worker errors: (TrainController pid=26887) 1 of 1 NCCL communicators (0x6b6b31bd2e55f51) made no progress for 20s; diagnostics found no hardware fault, so this is software or data (TrainController pid=26887) [State Transition] RUNNING -> SHUTTING_DOWN. (TrainController pid=26887) Torch process group shutdown timed out after 30 seconds (TrainController pid=26887) [State Transition] SHUTTING_DOWN -> ERRORED. ``` 3. Unit tests and checks on this PR: - `pytest python/ray/train/v2/tests/test_health_contracts.py`: 12 passed. - `pre-commit run` on the changed files: all passed. - `ci/ray_ci/doc/cmd_check_api_param_coverage.py .`: no newly-undocumented public-API parameters. The run in (1) and (2) used the earlier prototype; the release scripts move onto these contracts later in the stack. ## Duplicate check and AI assistance No other open PR adds a Ray Train health module; searching open PRs for "train health probe", "ray.train.health" and "health monitoring train" returns only this stack and the draft #66247. Written with AI assistance (Claude Code); I reviewed every changed line. --------- Signed-off-by: Lehui Liu <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
The Decide stage. One HealthManager per run, on the controller, runs the run's periodic health checks. Nothing calls it yet; wiring it into the controller comes later in the stack. Lifecycle: - start(node_ids) starts a NodeMonitor on each node the workers use, through a NodeMonitorGroup the manager owns. reset(node_ids) prepares for a new set of workers: it drops the previous readings, calls each evaluator's on_worker_group_start(), and moves the monitors to the new nodes. shutdown() stops them. Collecting readings: - poll_probes(timeout) polls each ControllerProbe that is due, in process, and collects the NodeMonitors' latest samples. A monitor that reports an error is restarted. - store_worker_results(rank, results) takes the WorkerProbe readings a worker returns with its status. - Every reading goes into a window per probe and key, sized by the probe's window_size (1 to MAX_WINDOW_SIZE = 100). A reading without a timestamp is stamped; one already stored with the same timestamp is not stored again. Deciding: - poll_decisions() runs every evaluator and chooses what to carry out. Noops and decisions about already-evicted nodes are dropped, and only the most severe kind is kept (each decision class has a private _severity). Reattempts or Evicts are combined into one, since one restart covers all of them; Diagnoses are carried out one by one. - An evaluator that raises, or does not return a Noop, Reattempt, Evict or Diagnose, is logged and not called again during the run. Pre-flight checks get their own PR. Public API added here: Probe.window_size; HealthState.probe_results now holds a window of readings per key. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lehui Liu <[email protected]>
Rework the HealthManager on top of the merged NodeMonitor (#66650), and keep it simple: - Keep only the latest result of each probe. Windows, Probe.window_size and the private _severity on the decision classes are gone, so this PR no longer changes the public contracts. - A probe in several checks runs once, at the shortest of their poll_interval_s. Two different probe classes with the same name raise ValueError. - Each check runs its evaluators every poll_interval_s of the check. - One poll() per controller tick: collect the NodeMonitors' latest samples, restarting a monitor that reports an error; poll the ControllerProbes that are due; run the evaluators of the checks that are due; and merge their decisions. - reset(node_ids) starts every attempt, including the first, and calls each evaluator's on_worker_group_start(). start() is gone. - A failing evaluator is skipped and logged once until it recovers, instead of being turned off for the rest of the run. A failing probe is logged the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lehui Liu <[email protected]>
a2b4670 to
c04d520
Compare
- poll_interval_s only sets how often probes are sampled. Every poll() runs every in-flight evaluator on each probe's latest result, and an evaluator keeps any history itself. HealthState is unchanged. - poll() returns the health decision to carry out: Noop() when there is nothing to do, or a Diagnose for the caller to run. - diagnose(checks, timeout) runs on-demand checks once, such as pre-flight checks or a Diagnose's checks: it polls their probes once on every node, and evaluates what comes back within the timeout. - merge_decisions() only merges: the most severe kind wins, and the decisions of that kind are combined into one. The manager drops the nodes it already evicted. - A NodeMonitor that fails stops, with its results, until the next reset(), instead of being restarted on every poll. - Only NodeProbes run for now: store_worker_results() and the in-process ControllerProbe polling move to the PRs that integrate worker and controller probes. - Log less: probe errors reach evaluators in ProbeResult.error, a failing evaluator is logged on its first failure only, and NodeMonitorGroup no longer logs a failed poll that the manager logs. - Move ScheduledProbe and merge_probes() to probe_utils.py, and the NodeMonitor timeouts to constants.py. - Rename Evaluator.on_worker_group_start() to on_reset(). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lehui Liu <[email protected]>
- diagnose(checks, timeout) starts on-demand checks, such as pre-flight checks or a Diagnose's checks, on the nodes of the last reset(). poll_diagnosis() returns their health decision once every node answered or the timeout passed, and None until then. poll() only evaluates the in-flight checks. - NodeMonitorGroup keeps the on-demand polls: poll_probes_async(probes, timeout_s) starts them, and poll_probe_results() collects them. A node that does not answer in time, or whose monitor failed, gets a result with that error for each probe. - NodeMonitor polls on-demand probes in their own concurrency group, so poll_status keeps answering while they run. - An evaluator that returns something other than a HealthDecision is handled like one that raises, without raising an exception to catch it. - Evaluator.on_reset()'s docstring says what it is for. - test_a_failing_evaluator_is_skipped_and_logged_once uses the propagate_logs fixture, so caplog sees Ray's logs on CI. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lehui Liu <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d493c95. Configure here.
NodeMonitorGroup.shutdown() no longer drops a node's pending on-demand poll. The stopped monitor's poll fails with RayActorError, so a running diagnosis records an error result for each probe on that node instead of leaving the node out. NodeMonitor.poll_probes' docstring says that its calls run one at a time. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lehui Liu <[email protected]>
pseudo-rnd-thoughts
left a comment
There was a problem hiding this comment.
Overall good, I'm excited to see how the completed classes will interacts with each other. I just want to check that I understand the design decisions later and if the function names make sense. Also I suspect you need to run pre-commit as there are a number of docstring without args or return documentation
| diagnoses.append(decision) | ||
|
|
||
| if evicts: | ||
| nodes = dict.fromkeys(n for d in evicts for n in d.target_nodes) |
There was a problem hiding this comment.
Given your converting this to list(nodes) why isn't this [node for eviction in evicts for node in eviction.target_nodes]
There was a problem hiding this comment.
changed to {}, this is for dedupe.
There was a problem hiding this comment.
Shouldn't we use a Set to achieve this then rather than a dict?
There was a problem hiding this comment.
yes, I think the {} is just a Set() in python syntax sugar.
There was a problem hiding this comment.
I just realised that dict.fromkeys will preserve insertion order where as using a set won't
| """ | ||
| evicts, reattempts, diagnoses = [], [], [] | ||
| for decision in decisions: | ||
| if isinstance(decision, Evict): |
There was a problem hiding this comment.
Read this reminds me of wanting more descriptive HealthDecision. Is this evict a node, reattempt this training run (i.e., throw an error to kill this attempt and start a new one) and diagnose (run a suite of diagnostics after killing the training run). If this interpretation is correct then I would be expecting Diagnose to be higher than Reattempt ironically
There was a problem hiding this comment.
A Diagnose doesn’t stop training. Its checks run while training continues, since on-demand probes have their own thread in each NodeMonitor, and what they find can lead to an Evict or Reattempt. That makes it the least disruptive action after Noop. If an evaluator already wants a restart, Reattempt wins and the run restarts without waiting for a diagnosis.”
There was a problem hiding this comment.
Ok, but don't we want to an option thats basically "stop what you get doing and run this diagnostic script". The problem I see that is some diagnostics like the all reduce test will require that the GPUs aren't doing anything else. Therefore this can't be happening concurrently with standard training and if you have a DCGM or Nvidia-smi detector that suddenly starts getting Xid errors. Then you don't want to Evict the node necessary but investigate further. I would place this between Evict and Reattempt in priority.
Do you have an imagined use case for each of the HealthDecisions?
There was a problem hiding this comment.
yes, there will be an option for the diagnostic that requires stop_training=True in HealthCheck, this functionality will be added in that PR. Added a TODO for this.
The use cases I have in mind:
Noop: nothing to do.
Reattempt: training is stuck or failed with no node to blame, for example a NCCL hang with no faulty rank. Restart on the same nodes.
Evict: a probe pins the problem on a node, for example an uncorrectable ECC error or a GPU that fell off the bus. Replace the node.
Diagnose: a symptom with no culprit yet, for example new Xid errors from DCGM or a slow step. Run checks to find which node, if any, to evict.
- evaluate_inflight_checks() (was poll()), start_on_demand_checks() (was diagnose()) and evaluate_on_demand_checks() (was poll_diagnosis()). The class docstring describes both kinds of checks. - reset()'s docstring says it is called at the start of each attempt, before its pre-flight checks and training. - An Evict's nodes are deduplicated with a sorted set. - Helpers' docstrings list their Args and Returns, and the error for two probes with the same name reads more clearly. - A TODO for per-probe timeouts and poll intervals. - The history test checks the evaluator's own history after each evaluation. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lehui Liu <[email protected]>
… stops the workers - The comment on HealthManager._latest_results says what keys each probe's results: the node ID, the world rank, or the ControllerProbe's own key. - A TODO in merge_decisions to add a field to Diagnose for checks that need the workers stopped, and rank those above Reattempt. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lehui Liu <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lehui Liu <[email protected]>
| reattempts.append(decision) | ||
| elif isinstance(decision, Diagnose): | ||
| diagnoses.append(decision) | ||
|
|
There was a problem hiding this comment.
else: raise TypeError()
- merge_decisions raises TypeError on a decision that is not a Noop, Reattempt, Evict or Diagnose. - HealthManager._evaluate accepts only those four kinds; an evaluator that returns another HealthDecision subclass is skipped with a warning, so it can't crash the controller loop. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lehui Liu <[email protected]>
## Description 4th PR of the [Ray Train Monitoring and Diagnostics REP](https://github.com/ray-project/enhancements/tree/main/reps/2026-08-11-ray-train-monitoring-and-diagnostics) stack. Adds the Decide stage: `HealthManager`, internal, one per run on the controller. It runs the run's health checks and evaluates their results into a `HealthDecision`. Nothing calls it yet; the controller integration comes later in the stack. ### How it works - **`poll()`** collects each node's latest results and runs every in-flight evaluator on them. The controller will call it on its health-check tick, every 2s by default; - **`diagnose(checks, timeout)`** runs on-demand checks once, such as pre-flight checks or a `Diagnose`'s checks: it polls their probes once on every node, waits up to `timeout`, and runs their evaluators on what came back. The caller decides when to run it. - **Deciding.** The evaluators' decisions are merged into one `HealthDecision`: the most severe kind wins (`Evict`, then `Reattempt`, then `Diagnose`), and decisions of that kind are combined into one. A node is evicted once per run. A failing evaluator decides `Noop()`, and only its first failure is logged. Both methods return `Noop()` when there is nothing to do. - A `NodeMonitor` that fails stops, with its results, until the next `reset()`. <img width="1020" height="720" alt="image" src="https://github.com/user-attachments/assets/a2d6a861-d365-4d11-8d92-8b9adf30e11e" /> ### Evaluating on history `HealthState` holds the latest result of each probe on each node. An evaluator that needs history keeps it, as in the REP. For example, this evaluator from the tests evicts a node whose GPU stayed over 90°C for its last 3 samples: ```python class EvictHotGpu(Evaluator): def __init__(self, samples=3): self.samples = samples self.history = defaultdict(lambda: deque(maxlen=self.samples)) def evaluate(self, state): for node, result in state.probe_results.get("Temp", {}).items(): history = self.history[node] # A result stays the latest until the probe samples again. if not history or history[-1].timestamp_s != result.timestamp_s: history.append(result) hot = [ node for node, history in self.history.items() if len(history) == self.samples and all(r.metrics["temp_c"] > 90 for r in history) ] return Evict(reason="GPU over 90C", target_nodes=hot) if hot else Noop() def on_reset(self): self.history.clear() ``` ## Test unit tests --------- Signed-off-by: Lehui Liu <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…67671) ## Description 5th PR of the [Ray Train Monitoring and Diagnostics REP](https://github.com/ray-project/enhancements/tree/main/reps/2026-08-11-ray-train-monitoring-and-diagnostics) stack, after #66536, #66648, #66650 and #66649. `ControllerProbe` (2/n) had nowhere to run. This PR runs it on a `NodeMonitor` on the controller's node, next to the `NodeMonitor`s on the worker nodes, so a slow or hanging probe never blocks the controller. ### How it works - **`NodeMonitor`** samples and polls on demand any probe the same way. A `NodeProbe` gives a `ProbeResult`, and a `ControllerProbe` gives `{key: ProbeResult}`. A poll that raises gives a `ProbeResult` with the `error`. - **`NodeMonitorGroup`** runs a monitor of the `NodeProbe`s on each worker node, with `start_worker_node_monitors(node_ids)` / `shutdown_worker_node_monitors()`, and a monitor of the `ControllerProbe`s on the controller's node, with `start_controller_node_monitor(node_id)`. It polls both kinds in one issue-and-collect loop, as `WorkerGroup` polls its workers. `poll_status()` (in-flight) and `poll_probe_results()` (on-demand) both return a `NodeMonitorGroupPollStatus`, where a monitor that died or did not answer in time has its `monitor_error`. - **`HealthManager.reset()`** starts both. The controller node's monitor always starts, so on-demand `ControllerProbe`s work without an in-flight one; without `ControllerProbe`s it has no sampling threads. One function builds the `HealthState` of both in-flight and on-demand checks, and a failed monitor gives each of its probes its error. As in 4/n, a worker node's failed monitor stops, with its results, until the next `reset()`. While the controller node's monitor fails, each `ControllerProbe` has its error. - **`HealthState`** has two new fields for the `ControllerProbe`s: `controller_probe_results`, `{probe name: {key: ProbeResult}}`, and `controller_probe_errors`, `{probe name: exception}` for each whose latest poll failed. `probe_results` now holds only `WorkerProbe` and `NodeProbe` results. Nothing calls the `HealthManager` yet; the controller integration comes later in the stack. ### In-flight checks <img width="686" height="955" alt="image" src="https://github.com/user-attachments/assets/23b502d2-417d-4008-bc22-dd5bfe2807bb" /> ### On-demand checks <img width="1024" height="895" alt="image" src="https://github.com/user-attachments/assets/e1f4eb22-376d-4f21-bb7d-59a6b0683b60" /> ## Test unit tests --------- Signed-off-by: Lehui Liu <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
) ## Description 6th PR of the [Ray Train Monitoring and Diagnostics REP](https://github.com/ray-project/enhancements/tree/main/reps/2026-08-11-ray-train-monitoring-and-diagnostics) stack, on top of #67671. The `HealthManager` decides on `Reattempt`, `Evict` or `Diagnose`, but nothing acted on its decisions yet. This PR runs its in-flight checks in the Ray Train controller and acts on what they decide. ### How it works - **`RunConfig.health_config`** (Alpha) takes a `HealthConfig`. The controller makes a `HealthManager` of its `inflight_checks`. `preflight_checks` only logs a warning for now. - **`HealthCallback`**, a `WorkerGroupCallback`, calls `HealthManager.reset()` with the worker group's nodes after each attempt starts, and `shutdown()` before the worker group shuts down or aborts. - **The `RUNNING` step** calls `evaluate_inflight_checks()` after it acts on worker errors. Each decision other than a `Noop` first goes to the new `after_health_decision` hook of `ControllerCallback` and `UserCallback`, then: - `Reattempt` restarts the worker group through the failure policy with a `HealthCheckError`, like a worker error, so it counts against `max_failures`. - `Evict` restarts the worker group without going through the failure policy. Every later attempt adds `ray.io/node-id: !in(<evicted nodes>)` to each worker's label selector, so no worker lands on an evicted node. A node is evicted once, so evictions are bounded by the number of nodes. - `Diagnose` is not acted on yet. - **`HealthCheckError`** (DeveloperAPI) is a `WorkerGroupError` that keeps the `decision` behind the restart. WorkerProbes in the controller's `HealthState`, pre-flight checks and `Diagnose` come later in the stack. ### Controller flow ## Related 1. REP: https://github.com/ray-project/enhancements/tree/main/reps/2026-08-11-ray-train-monitoring-and-diagnostics 2. #66536, #66648, #66650, #66649, #67671 ## Test `test_health_e2e` trains on a cluster of two 1-CPU nodes with `max_failures=0` and an evaluator that evicts every node: the second attempt runs on the other node, and the run fails once no node is left to start on. --------- Signed-off-by: Lehui Liu <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>

Description
4th PR of the Ray Train Monitoring and Diagnostics REP stack.
Adds the Decide stage:
HealthManager, internal, one per run on the controller.It runs the run's health checks and evaluates their results into a
HealthDecision. Nothing calls it yet; the controller integration comes later in the stack.How it works
poll()collects each node's latest results and runs every in-flight evaluator on them. The controller will call it on its health-check tick, every 2s by default;diagnose(checks, timeout)runs on-demand checks once, such as pre-flight checks or aDiagnose's checks: it polls their probes once on every node, waits up totimeout, and runs their evaluators on what came back. The caller decides when to run it.HealthDecision: the most severe kind wins (Evict, thenReattempt, thenDiagnose), and decisions of that kind are combined into one. A node is evicted once per run. A failing evaluator decidesNoop(), and only its first failure is logged. Both methods returnNoop()when there is nothing to do.NodeMonitorthat fails stops, with its results, until the nextreset().Evaluating on history
HealthStateholds the latest result of each probe on each node. An evaluator that needs history keeps it, as in the REP. For example, this evaluator from the tests evicts a node whose GPU stayed over 90°C for its last 3 samples:Test
unit tests