Router that virtually distributes inference across connected devices in the home.
Go
Label jobs that have not started as In flight, in the GPU-chart yellow (#141)
ckelseynve3679c4279c7
diff --git a/desktop/src/ui/components/Workloads/WorkloadItemCard.tsx b/desktop/src/ui/components/Workloads/WorkloadItemCard.tsxindex 799de94..42466cd 100644--- a/desktop/src/ui/components/Workloads/WorkloadItemCard.tsx+++ b/desktop/src/ui/components/Workloads/WorkloadItemCard.tsx@@ -1,13 +1,15 @@// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.// SPDX-License-Identifier: Apache-2.0-import { useMemo, memo } from 'react'+import { useMemo, memo, type CSSProperties } from 'react'import { Card, Flex, Stack, Text } from '@nvidia/foundations-react-core'import type { Workload } from '@/shared/types/workloads'import { workloadExecutionNodeId } from '@/shared/utils/workloads'import { useNodesStore } from '@/ui/stores/nodes.store'+import { WORKLOAD_COLOR_MAP } from '@/ui/constants/colors'import { formatModelDisplayName } from '@/ui/utils/format-model-display-name'import { getWorkloadColorBar } from '@/ui/utils/colors'+import { workloadNodeLabel } from '@/ui/utils/workload-labels'import EngineIcon from '@/ui/components/EngineIcon'const formatDate = (timestamp: number) => {@@ -40,10 +42,17 @@ const formatDate = (timestamp: number) => {}}+// sheen.css paints the in-flight card's corner from this property, so the card+// and its connection line share one color.+const CARD_STYLE: CSSProperties & { '--workload-in-flight-color': string } = {+ direction: 'ltr',+ '--workload-in-flight-color': WORKLOAD_COLOR_MAP.yellow+}+function WorkloadItemCard({ workload }: { workload: Workload }) {// Subscribe to only this workload's execution node name. Selecting the whole// nodes array re-rendered every job card on any node/metrics update.- const ranOnNodeText = useNodesStore(state => {+ const executionNodeText = useNodesStore(state => {const executionNodeId = workloadExecutionNodeId(workload)if (!executionNodeId) return ''return state.nodes.get(executionNodeId)?.name ?? ''@@ -54,7 +63,6 @@ function WorkloadItemCard({ workload }: { workload: Workload }) {if (!workload.originatedFrom) return ''return state.nodes.get(workload.originatedFrom)?.name ?? ''})- const ranOnLabel = workload.state === 'running' ? 'Running on' : 'Ran on'const barColor = useMemo(() => getWorkloadColorBar(workload.state), [workload.state])const subtext = useMemo(() => {@@ -65,10 +73,11 @@ function WorkloadItemCard({ workload }: { workload: Workload }) {switch (state) {case 'queued':value = workload.createdAt- // Not "Queued at": PAIR runs no queue of its own, and the- // elapsed wait is the useful part for a job that has been- // accepted but is not generating yet.- label = 'Waiting since'+ // "In flight", not "Queued": PAIR runs no queue of its own, and+ // a job that has not started may be waiting for a node, waiting+ // in an engine's queue, or already being processed where PAIR+ // cannot see it.+ label = 'In flight since'breakcase 'running':value = workload.startedAt ?? 0@@ -120,7 +129,7 @@ function WorkloadItemCard({ workload }: { workload: Workload }) {<CardclassName={className}density="compact"- style={{ direction: 'ltr' }}+ style={CARD_STYLE}data-workload-id={workload.id}data-workload-origin={workload.originatedFrom ?? ''}attributes={{ CardContent: { className: 'workload-card-content' } }}@@ -134,7 +143,7 @@ function WorkloadItemCard({ workload }: { workload: Workload }) {</Text></Flex>- {(requestedFromNodeText || ranOnNodeText) && (+ {(requestedFromNodeText || executionNodeText) && (<Stack gap="0" className="mt-1">{requestedFromNodeText && (<Flex align="center" wrap="wrap" gap="1">@@ -146,13 +155,13 @@ function WorkloadItemCard({ workload }: { workload: Workload }) {</Text></Flex>)}- {ranOnNodeText && (+ {executionNodeText && (<Flex align="center" wrap="wrap" gap="1"><Text kind="body/regular/sm" className="text-subtle-color">- {ranOnLabel}+ {workloadNodeLabel(workload)}</Text><Text kind="body/regular/sm" className="text-subtle-color">- {ranOnNodeText}+ {executionNodeText}</Text></Flex>)}diff --git a/desktop/src/ui/constants/colors.ts b/desktop/src/ui/constants/colors.tsindex 3391a5e..6efc89f 100644--- a/desktop/src/ui/constants/colors.ts+++ b/desktop/src/ui/constants/colors.ts@@ -3,9 +3,13 @@import type { BadgeColor } from '@/ui/types/types'-// Color mapping for CSS-export const WORKLOAD_COLOR_MAP: Record<BadgeColor, string> = {- yellow: '#F5A623',+// The GPU chart's yellow, which in-flight jobs also use.+const GPU_YELLOW = '#f9b400'++// Color mapping for CSS. Values must stay six-digit hex: connection lines+// append a two-digit alpha.+export const WORKLOAD_COLOR_MAP: Record<BadgeColor, `#${string}`> = {+ yellow: GPU_YELLOW,blue: '#4A90E2',green: '#7ED321',gray: '#9B9B9B',@@ -44,7 +48,7 @@ export const CHART_COLORS = {*/export const GPU_COLOR_PALETTE = ['#0074df', // GPU3 - Dark Blue- '#f9b400', // GPU2 - Yellow+ GPU_YELLOW, // GPU2 - Yellow'#8689ff', // GPU1 - Blue'#ff8181' // GPU4 - Red] as constdiff --git a/desktop/src/ui/styles/sheen.css b/desktop/src/ui/styles/sheen.cssindex 1c6701e..101fa50 100644--- a/desktop/src/ui/styles/sheen.css+++ b/desktop/src/ui/styles/sheen.css@@ -144,11 +144,12 @@);}+/* WorkloadItemCard sets --workload-in-flight-color from WORKLOAD_COLOR_MAP. */.pair-paper.workload-card-queued {background-image: radial-gradient(143% 109% at 0% 73%,transparent 62%,- var(--color-yellow-500) 105%+ var(--workload-in-flight-color) 105%);}diff --git a/desktop/src/ui/utils/workload-labels.ts b/desktop/src/ui/utils/workload-labels.tsnew file mode 100644index 0000000..4ba496d--- /dev/null+++ b/desktop/src/ui/utils/workload-labels.ts@@ -0,0 +1,14 @@+// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.+// SPDX-License-Identifier: Apache-2.0++import type { Workload } from '@/shared/types/workloads'++/**+ * The verb before a job card's execution node. A job that ends before it+ * starts keeps the node it was sent to, so whether it ran is decided by+ * `startedAt`, not by its state.+ */+export function workloadNodeLabel(workload: Pick<Workload, 'state' | 'startedAt'>): string {+ if (workload.state === 'running') return 'Running on'+ return workload.startedAt === null ? 'Sent to' : 'Ran on'+}diff --git a/desktop/tests/modular/workload-card-labels.test.ts b/desktop/tests/modular/workload-card-labels.test.tsnew file mode 100644index 0000000..5452c74--- /dev/null+++ b/desktop/tests/modular/workload-card-labels.test.ts@@ -0,0 +1,53 @@+// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.+// SPDX-License-Identifier: Apache-2.0++import { describe, expect, it } from 'vitest'+import { GPU_COLOR_PALETTE, WORKLOAD_COLOR_MAP } from '@/ui/constants/colors'+import { workloadNodeLabel } from '@/ui/utils/workload-labels'++const STARTED_AT = 1_700_000_000_000++describe('workloadNodeLabel', () => {+ it('says Sent to for an in-flight job', () => {+ expect(workloadNodeLabel({ state: 'queued', startedAt: null })).toBe('Sent to')+ })++ it('says Running on for a running job', () => {+ expect(workloadNodeLabel({ state: 'running', startedAt: STARTED_AT })).toBe('Running on')+ })++ it('says Ran on for a completed job', () => {+ expect(workloadNodeLabel({ state: 'completed', startedAt: STARTED_AT })).toBe('Ran on')+ })++ // The proxy keeps scheduledOn on the terminal event, so a job that ends+ // before it starts still names the node it was sent to.+ it('says Sent to for a job that failed before it started', () => {+ expect(workloadNodeLabel({ state: 'failed', startedAt: null })).toBe('Sent to')+ })++ it('says Sent to for a job that was cancelled before it started', () => {+ expect(workloadNodeLabel({ state: 'cancelled', startedAt: null })).toBe('Sent to')+ })++ it('says Ran on for a job that failed after it started', () => {+ expect(workloadNodeLabel({ state: 'failed', startedAt: STARTED_AT })).toBe('Ran on')+ })++ it('says Ran on for a job that was cancelled after it started', () => {+ expect(workloadNodeLabel({ state: 'cancelled', startedAt: STARTED_AT })).toBe('Ran on')+ })+})++describe('WORKLOAD_COLOR_MAP', () => {+ // Connection lines append a two-digit alpha to these values.+ it('holds only six-digit hex colors', () => {+ for (const [name, color] of Object.entries(WORKLOAD_COLOR_MAP)) {+ expect(color, name).toMatch(/^#[0-9a-f]{6}$/i)+ }+ })++ it('colors in-flight jobs with the GPU chart yellow', () => {+ expect(GPU_COLOR_PALETTE).toContain(WORKLOAD_COLOR_MAP.yellow)+ })+})diff --git a/docs/getting-started.mdx b/docs/getting-started.mdxindex 56cd1f5..57c03ff 100644--- a/docs/getting-started.mdx+++ b/docs/getting-started.mdx@@ -265,8 +265,9 @@ curl -N <PAIR_BASE_URL>/api/chat \```Then confirm the request was routed: open **Overview**, use the **Jobs** filter in-the left column, and read **Ran on** or **Running on** on the job card to identify-the serving node.+the left column, and read **Running on** or **Ran on** on the job card to identify+the serving node. Once a job has been sent to a node, its card shows **Sent to**+until the job starts, and keeps it if the job ends without starting.@@ -487,7 +488,8 @@ A reply alone does not prove routing. To identify the serving node:1. Open **Overview**.2. Use the **Jobs** filter in the left column.-3. Read **Ran on** or **Running on** on the job card.+3. Read **Running on** or **Ran on** on the job card. Once a job has been sent+ to a node, its card shows **Sent to** until the job starts.### 5. Verify Cluster Routingdiff --git a/docs/troubleshooting.mdx b/docs/troubleshooting.mdxindex e4d8822..b3a22c8 100644--- a/docs/troubleshooting.mdx+++ b/docs/troubleshooting.mdx@@ -144,8 +144,10 @@ Routing confirmation happens on **Overview**:1. Use the **Jobs** filter in the left column to show active, completed, orfailed requests.-2. Open a job card and read **Ran on** or **Running on** to see which node- served the request.+2. Open a job card and read **Running on** or **Ran on** to see which node+ served the request. Once a job has been sent to a node, its card shows+ **Sent to** until the job starts, and keeps it if the job ends without+ starting.Send several independent requests to observe multi-node routing. One requestruns on one selected node.