1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! Rank-side dashboard intent stash + emit helpers.
//!
//! When the user's harness on a rank process calls
//! [`crate::monitor::Monitor::serve`] / `.watch()` / `.set_metadata()`,
//! the rewired Monitor stashes the intent here instead of binding a
//! local HTTP server (the launcher hosts the dashboard post controller-
//! active refactor). The cluster_worker drains the stash at startup
//! and emits the matching [`crate::distributed::wire::TimingMsgWire`]
//! frames on the coord socket; the launcher's
//! [`crate::distributed::ClusterDashboardSink`] then binds the server
//! lazily on first arrival.
//!
//! Single global stash — every Monitor on the rank process writes here
//! (typical user code constructs one Monitor; multi-Monitor on the
//! same rank is not a documented pattern). The cluster_worker reads
//! once at startup; subsequent stashes after that point are no-ops
//! from the launcher's POV.
use Mutex;
/// Snapshot of the user's dashboard intent, populated by Monitor on
/// the rank's harness thread and drained by `cluster_worker` after
/// rendezvous.
pub
static PENDING: = new;
/// Record the dashboard port the user requested. Called from
/// `Monitor::serve` on the cluster-rank path.
pub
/// Record the graph SVG + identity. Called from `Monitor::watch` /
/// `Monitor::set_svg` on the cluster-rank path.
pub
/// Record the dashboard metadata JSON. Called from `Monitor::set_metadata`.
pub
/// Record the rank's hardware summary string. Called from `Monitor::new`
/// (so every rank's hardware reaches the launcher, even if the user
/// never opts into the dashboard — cheap stash, drained only when port
/// is also set).
pub
/// Drain the stash (atomic snapshot). Called from `cluster_worker` at
/// startup, after rendezvous but before the training loop begins.
/// Returns the current stash and resets it to default, so a hypothetical
/// re-call would not double-emit.
pub