Distributed Dashboard
A grid of worker cards for visualising the state of a distributed-training cluster. Each card shows a worker's label, lifecycle status, progress through the current epoch, throughput, and current step. When currentBarrier is supplied, every worker that has reached it is highlighted with the accent ring — the visual stand-in for "these ones cleared the barrier; the slow ones haven't yet". Use it to teach data parallelism, all-reduce cost, and stragglers in synchronous SGD.
Distributed workersbarrier 42 · 02/04
rank 0: waiting, 100% complete. rank 1: waiting, 100% complete. rank 2: computing, 48% complete. rank 3: computing, 35% complete. 2 of 4 workers reached barrier 42.- rank 0waitingstep 0421.2k tok/s
- rank 1waitingstep 0421.2k tok/s
- rank 2computingstep 0411.1k tok/s
- rank 3computingstep 0411.0k tok/s
Customize
Cluster
4
42
State
Installation
npx shadcn@latest add https://craftbits.dev/r/distributed-dashboard.jsonUsage
import { DistributedDashboard } from "@craft-bits/core";
<DistributedDashboard
workers={[
{ id: "w0", label: "rank 0", progress: 1, status: "waiting", currentStep: 42 },
{ id: "w1", label: "rank 1", progress: 0.6, status: "computing", currentStep: 41 },
]}
currentBarrier={42}
/>Stream the worker list from a query — the component is pure, it just renders whatever you give it:
const workers = useWorkerStates();
<DistributedDashboard workers={workers} currentBarrier={epoch} />Switch the throughput unit for inference dashboards:
<DistributedDashboard workers={workers} throughputUnit="req/s" />Understanding the component
- One card per worker. Each card carries the label, a status dot, a progress bar, a step counter, and a throughput readout. Cards lay out in a
repeat(auto-fill, minmax(13rem, 1fr))grid so the dashboard scales from a single worker to thirty-two without changing markup. - Status drives the tone.
idle→ subtle grey,computing→ success,waiting→ warning,error→ error. The dot and the progress bar share the same tone so the status reads at a glance — colour is only ever a secondary signal alongside the textual badge. - Progress is
scaleX, notwidth. The fill bar usestransform: scaleX(p)with aorigin-leftanchor so the GPU compositor handles the animation. Animatingwidthwould force a layout pass per frame. - Barrier highlight via accent border + ring. Workers whose
currentStep === currentBarrieranimate to a--cb-accentborder + 1px outer ring. Other workers stay on the default border — the contrast carries the "reached vs straggling" story without flashing or pulsing. SPRINGS.defaultfor everything. The dot, the bar, and the border / ring transition together using the library's default spring, so the whole row settles in one motion. Reduced-motion users get{ duration: 0 }and a snap-in render.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
workers | readonly DistributedWorker[] | — | The set of workers to display. Order is preserved. |
currentBarrier | number | — | When set, workers whose currentStep matches are highlighted with the accent ring. |
throughputUnit | string | "tok/s" | Unit string appended after each worker's throughput readout. |
transition | Transition | SPRINGS.default | Spring used for the dot / bar / border / ring transitions. |
className | string | — | Merged onto the root <div> via cn(). |
DistributedWorker
| Field | Type | Description |
|---|---|---|
id | string | Unique key — used as the React key and the a11y token. |
label | string | Human-readable card heading. |
progress | number | Progress through the current epoch / barrier in [0, 1]. Clamped before render. |
throughput | number? | Optional throughput. Pre-formatted with k suffix above 1000. |
currentStep | number? | Optional step counter. Compared against currentBarrier for the highlight. |
status | "idle" | "computing" | "waiting" | "error"? | Lifecycle state. Defaults to "idle". |
Accessibility
- The root is
role="figure"witharia-labelledbypointing at the visually-hidden "Distributed workers" heading andaria-describedbyat anaria-live="polite"summary. - The summary narrates each worker's label, status, and percent complete, plus the barrier count when
currentBarrieris set. - Each progress bar is a
role="progressbar"witharia-valuemin,aria-valuemax,aria-valuenow, and anaria-labelnaming the worker. - Status is encoded in three signals — the dot tone, the textual badge ("computing", "waiting", …), and the
data-statusattribute — so colour is never the only cue. prefers-reduced-motion: reduceshort-circuits the spring to{ duration: 0 }for the dot, bar, border, and ring — the dashboard renders in its final state with no transitions.
Credits
- Extracted from:
craftingattention(app/src/lessons/primitives/viz/DistributedDashboard.tsx). The original was a four-panel lesson visualisation tightly coupled torunTrainingLoop, aMetricsSnapshotinterface, and an internalVizComponentPropscontract — loss curves, comm timeline, worker-state pills, and a topology SVG, all driven by an in-component training simulator. Stripped the simulator, the loss/comm/topology panels, theworldSizemath, and therunCountautoplay machinery. Generalised the surviving worker-state panel into the public surface: a flatworkersarray plus an optionalcurrentBarrierhighlight, with progress bars rendered viascaleXand the original--color-success-400/--color-warning-400ad-hoc palette swapped for--cb-success/--cb-warningsemantic tokens.