@milabench/bujang 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +23 -5
- package/dist/constants.d.ts +6 -0
- package/dist/index.js +6231 -5068
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +113 -12
- package/dist/views/JobDataOverview.d.ts +4 -3
- package/dist/views/OverviewPanels.d.ts +37 -0
- package/dist/views/PipelineEditor.d.ts +5 -0
- package/dist/views/PipelinesView.d.ts +1 -1
- package/dist/views/ScheduleDialog.d.ts +14 -0
- package/dist/views/SweepDialog.d.ts +51 -0
- package/dist/views/dataCharts.d.ts +56 -0
- package/package.json +1 -1
- package/src/api.ts +52 -4
- package/src/constants.ts +3 -0
- package/src/types.ts +113 -13
- package/src/views/JanitorView.tsx +101 -32
- package/src/views/JobDataOverview.tsx +126 -213
- package/src/views/JobLogs.tsx +13 -6
- package/src/views/JobSubmit.tsx +377 -318
- package/src/views/JobsView.tsx +34 -21
- package/src/views/LogDisplay.tsx +2 -2
- package/src/views/OverviewPanels.tsx +341 -0
- package/src/views/PipelineEditor.tsx +3 -3
- package/src/views/PipelinesView.tsx +387 -164
- package/src/views/ScheduleDialog.tsx +98 -0
- package/src/views/SettingsView.tsx +131 -1
- package/src/views/SweepDialog.tsx +520 -0
- package/src/views/dataCharts.tsx +261 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { Tooltip } from '../components/tooltip'
|
|
3
3
|
import {
|
|
4
4
|
Box,
|
|
@@ -13,13 +13,15 @@ import {
|
|
|
13
13
|
Card,
|
|
14
14
|
Flex,
|
|
15
15
|
Spacer,
|
|
16
|
-
Link
|
|
16
|
+
Link,
|
|
17
|
+
Input,
|
|
18
|
+
InputGroup
|
|
17
19
|
} from '@chakra-ui/react';
|
|
18
20
|
import { Link as RouterLink, useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
|
19
21
|
import { useBujangPaths } from '../context';
|
|
20
|
-
import { NO_JOB_ID } from '../constants';
|
|
22
|
+
import { COMPACT_ROWS, NO_JOB_ID } from '../constants';
|
|
21
23
|
import { toaster } from '../toast';
|
|
22
|
-
import { LuArrowLeft, LuPencil, LuPlay, LuPlus } from 'react-icons/lu';
|
|
24
|
+
import { LuArrowLeft, LuPencil, LuPlay, LuPlus, LuSearch } from 'react-icons/lu';
|
|
23
25
|
import { useQuery, useQueries, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
24
26
|
import {
|
|
25
27
|
getSlurmProfiles,
|
|
@@ -36,9 +38,10 @@ import type {
|
|
|
36
38
|
ApiError,
|
|
37
39
|
PipelineRunResponse,
|
|
38
40
|
PipelineRunSummary,
|
|
39
|
-
PipelineRunStatus
|
|
41
|
+
PipelineRunStatus,
|
|
42
|
+
PipelineRunStep,
|
|
43
|
+
PipelineRunState
|
|
40
44
|
} from '../types';
|
|
41
|
-
import { PipelineGraph, graphIsDrawable } from './PipelineGraph';
|
|
42
45
|
import { PipelineBuilder } from './PipelineEditor';
|
|
43
46
|
import type { PipelineTemplateFileData } from './PipelineEditor';
|
|
44
47
|
import { usePageTitle } from '../hooks/usePageTitle';
|
|
@@ -83,6 +86,53 @@ const JobLogsLink: React.FC<{ jobId?: string | null; slurmJobId?: string | null;
|
|
|
83
86
|
const isRunOver = (run?: PipelineRunStatus): boolean =>
|
|
84
87
|
!!run && (run.status === 'failed' || run.state === 'completed' || run.state === 'failed');
|
|
85
88
|
|
|
89
|
+
/** A row of the steps table: a group of the definition, or one of its jobs with the step it became */
|
|
90
|
+
type StepRow =
|
|
91
|
+
| { kind: 'group'; node: Exclude<PipelineNode, { type: 'job' }>; depth: number; marker: string; steps: PipelineRunStep[] }
|
|
92
|
+
| { kind: 'job'; node?: PipelineNode; step?: PipelineRunStep; depth: number; marker: string };
|
|
93
|
+
|
|
94
|
+
const countJobs = (node: PipelineNode): number =>
|
|
95
|
+
node.type === 'job' ? 1 : (node.jobs || []).reduce((n, child) => n + countJobs(child), 0);
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The definition as indented rows, its jobs paired with the steps of the run (the server lists the steps
|
|
99
|
+
* in the order of the definition). Without a definition that matches the steps: the steps, flat.
|
|
100
|
+
*/
|
|
101
|
+
const stepRows = (definition: PipelineNode | null | undefined, steps: PipelineRunStep[]): StepRow[] => {
|
|
102
|
+
if (!definition || (steps.length > 0 && countJobs(definition) !== steps.length)) {
|
|
103
|
+
return steps.map((step) => ({ kind: 'job', step, depth: 0, marker: '' }));
|
|
104
|
+
}
|
|
105
|
+
const out: StepRow[] = [];
|
|
106
|
+
let next = 0;
|
|
107
|
+
const walk = (node: PipelineNode, depth: number, marker: string) => {
|
|
108
|
+
if (node.type === 'job') {
|
|
109
|
+
out.push({ kind: 'job', node, step: steps[next++], depth, marker });
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const first = next;
|
|
113
|
+
const row: StepRow = { kind: 'group', node, depth, marker, steps: [] };
|
|
114
|
+
out.push(row);
|
|
115
|
+
(node.jobs || []).forEach((child, i) => walk(child, depth + 1, node.type === 'sequential' ? `${i + 1}.` : '•'));
|
|
116
|
+
row.steps = steps.slice(first, next);
|
|
117
|
+
};
|
|
118
|
+
walk(definition, 0, '');
|
|
119
|
+
return out;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/** The last part of a step id without its position: "1.Sizing/0.lynx_sizing" -> "lynx_sizing" */
|
|
123
|
+
const stepName = (step?: string): string => (step ?? '').split('/').pop()!.replace(/^\d+\./, '');
|
|
124
|
+
|
|
125
|
+
/** "12/20 COMPLETED, 3 RUNNING": the states of the steps of a group, most frequent first */
|
|
126
|
+
const groupSummary = (steps: PipelineRunStep[]): string => {
|
|
127
|
+
if (steps.length === 0) return '';
|
|
128
|
+
const counts: Record<string, number> = {};
|
|
129
|
+
for (const step of steps) counts[step.state || 'UNKNOWN'] = (counts[step.state || 'UNKNOWN'] || 0) + 1;
|
|
130
|
+
return Object.entries(counts)
|
|
131
|
+
.sort((a, b) => b[1] - a[1])
|
|
132
|
+
.map(([state, n], i) => (i === 0 ? `${n}/${steps.length} ${state}` : `${n} ${state}`))
|
|
133
|
+
.join(', ');
|
|
134
|
+
};
|
|
135
|
+
|
|
86
136
|
// Progress of one run: steps with their state and the pipeline log, refreshed until it is over
|
|
87
137
|
const PipelineRunProgress: React.FC<{ runId: string }> = ({ runId }) => {
|
|
88
138
|
const { data: run, error, dataUpdatedAt, isFetching } = useQuery<PipelineRunStatus, ApiError>({
|
|
@@ -148,49 +198,73 @@ const PipelineRunProgress: React.FC<{ runId: string }> = ({ runId }) => {
|
|
|
148
198
|
)}
|
|
149
199
|
|
|
150
200
|
{run.steps && run.steps.length > 0 && (
|
|
151
|
-
<Table.Root size="sm" variant="
|
|
152
|
-
<Table.Header
|
|
201
|
+
<Table.Root size="sm" variant="outline" css={COMPACT_ROWS}>
|
|
202
|
+
<Table.Header>
|
|
153
203
|
<Table.Row>
|
|
154
|
-
<Table.ColumnHeader
|
|
204
|
+
<Table.ColumnHeader>Step</Table.ColumnHeader>
|
|
155
205
|
{sweepKeys.length > 0 && (
|
|
156
|
-
<Table.ColumnHeader
|
|
206
|
+
<Table.ColumnHeader fontFamily="mono">
|
|
157
207
|
{sweepKeys.length === 1 ? sweepKeys[0] : 'Sweep'}
|
|
158
208
|
</Table.ColumnHeader>
|
|
159
209
|
)}
|
|
160
|
-
<Table.ColumnHeader
|
|
161
|
-
<Table.ColumnHeader
|
|
162
|
-
<Table.ColumnHeader
|
|
163
|
-
<Table.ColumnHeader color="var(--color-text)" borderColor="var(--color-border)">Job folder</Table.ColumnHeader>
|
|
210
|
+
<Table.ColumnHeader>Runs on</Table.ColumnHeader>
|
|
211
|
+
<Table.ColumnHeader>State</Table.ColumnHeader>
|
|
212
|
+
<Table.ColumnHeader>Job folder</Table.ColumnHeader>
|
|
164
213
|
</Table.Row>
|
|
165
214
|
</Table.Header>
|
|
166
215
|
<Table.Body>
|
|
167
|
-
{run.steps.map((
|
|
168
|
-
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
</
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
216
|
+
{stepRows(run.definition, run.steps).map((row, index) => {
|
|
217
|
+
const indent = (
|
|
218
|
+
<Text as="span" display="inline-block" minW="1.6em" color="var(--color-text-muted)" fontFamily="mono" fontSize="xs">
|
|
219
|
+
{row.marker}
|
|
220
|
+
</Text>
|
|
221
|
+
);
|
|
222
|
+
if (row.kind === 'group') {
|
|
223
|
+
return (
|
|
224
|
+
<Table.Row key={`group-${index}`} bg="var(--color-bg-page)">
|
|
225
|
+
<Table.Cell pl={`${12 + row.depth * 20}px`} whiteSpace="nowrap">
|
|
226
|
+
{indent}
|
|
227
|
+
<Badge size="sm" variant="outline" mr={2} textTransform="capitalize">{row.node.type}</Badge>
|
|
228
|
+
<Text as="span" fontWeight="semibold" fontSize="sm">{row.node.name}</Text>
|
|
229
|
+
</Table.Cell>
|
|
230
|
+
<Table.Cell colSpan={sweepKeys.length > 0 ? 4 : 3} fontSize="xs" color="var(--color-text-muted)">
|
|
231
|
+
{groupSummary(row.steps)}
|
|
232
|
+
</Table.Cell>
|
|
233
|
+
</Table.Row>
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
const step = row.step;
|
|
237
|
+
if (!step) return null;
|
|
238
|
+
// in the tree the parents are the rows above: "1.Sizing/0.lynx_sizing" -> "lynx_sizing"
|
|
239
|
+
const name = row.node ? stepName(step.step) : step.step;
|
|
240
|
+
return (
|
|
241
|
+
<Table.Row key={step.job_id || step.step || index}>
|
|
242
|
+
<Table.Cell fontFamily="mono" fontSize="xs" pl={`${12 + row.depth * 20}px`} whiteSpace="nowrap">
|
|
243
|
+
{indent}
|
|
244
|
+
<Tooltip content={step.step} disabled={name === step.step}>
|
|
245
|
+
<JobLogsLink jobId={step.job_id} slurmJobId={step.executor === 'ssh' ? null : step.slurm_jobid}>{name}</JobLogsLink>
|
|
246
|
+
</Tooltip>
|
|
177
247
|
</Table.Cell>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
248
|
+
{sweepKeys.length > 0 && (
|
|
249
|
+
<Table.Cell fontFamily="mono" fontSize="xs">
|
|
250
|
+
{step.sweep
|
|
251
|
+
? <>{step.sweep}{sweepKeys.length > 1 && <Text as="span" color="var(--color-text-muted)"> ({step.sweep_key})</Text>}</>
|
|
252
|
+
: <Text as="span" color="var(--color-text-muted)">-</Text>}
|
|
253
|
+
</Table.Cell>
|
|
254
|
+
)}
|
|
255
|
+
<Table.Cell fontSize="xs" whiteSpace="nowrap">
|
|
256
|
+
{step.executor === 'ssh' ? `ssh ${step.host}` : `slurm ${step.slurm_jobid ?? '-'}`}
|
|
257
|
+
<Text as="span" color="var(--color-text-muted)"> ({step.profile})</Text>
|
|
258
|
+
</Table.Cell>
|
|
259
|
+
<Table.Cell>
|
|
260
|
+
<Badge colorPalette={stepStateColor(step.state)}>{step.state || 'UNKNOWN'}</Badge>
|
|
261
|
+
</Table.Cell>
|
|
262
|
+
<Table.Cell fontFamily="mono" fontSize="xs" color="var(--color-text-muted)">
|
|
263
|
+
<JobLogsLink jobId={step.job_id} slurmJobId={step.executor === 'ssh' ? null : step.slurm_jobid}>{step.job_id}</JobLogsLink>
|
|
264
|
+
</Table.Cell>
|
|
265
|
+
</Table.Row>
|
|
266
|
+
);
|
|
267
|
+
})}
|
|
194
268
|
</Table.Body>
|
|
195
269
|
</Table.Root>
|
|
196
270
|
)}
|
|
@@ -234,6 +308,55 @@ const usePipelineRuns = () => useQuery<PipelineRunSummary[], ApiError>({
|
|
|
234
308
|
refetchInterval: 15000,
|
|
235
309
|
});
|
|
236
310
|
|
|
311
|
+
const OVER_STATES: (PipelineRunState | null | undefined)[] = ['completed', 'failed'];
|
|
312
|
+
|
|
313
|
+
// the server reads the state of a run from the local job index: none yet is "submitted" only for a new run
|
|
314
|
+
const JUST_SUBMITTED_S = 15 * 60;
|
|
315
|
+
|
|
316
|
+
/** What a run shows: the submission when it is not submitted, else the state of its jobs */
|
|
317
|
+
const runLabel = (run: PipelineRunSummary, state?: PipelineRunState | null): string =>
|
|
318
|
+
run.status !== 'submitted' ? run.status
|
|
319
|
+
: (state || (Date.now() / 1000 - run.started < JUST_SUBMITTED_S ? 'submitted' : 'unknown'));
|
|
320
|
+
|
|
321
|
+
// runs older than this are not polled: their jobs may be gone from sacct, they would look running forever
|
|
322
|
+
const LIVE_RUN_MAX_AGE_S = 3 * 24 * 3600;
|
|
323
|
+
const LIVE_RUN_MAX = 5;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* The state of the jobs of the listed runs. The runs list only has the state saved the last time a run's
|
|
327
|
+
* progress was read: the recent runs that are not over are read here (same query, so same cache, as the
|
|
328
|
+
* progress of the run shown) until they are.
|
|
329
|
+
*/
|
|
330
|
+
const useLiveRunStates = (runs: PipelineRunSummary[]): Record<string, PipelineRunState | null | undefined> => {
|
|
331
|
+
const now = Date.now() / 1000;
|
|
332
|
+
const live = runs
|
|
333
|
+
.filter((run) => run.status !== 'failed' && !OVER_STATES.includes(run.state) && now - run.started < LIVE_RUN_MAX_AGE_S)
|
|
334
|
+
.slice(0, LIVE_RUN_MAX);
|
|
335
|
+
const results = useQueries({
|
|
336
|
+
queries: live.map((run) => ({
|
|
337
|
+
queryKey: ['pipeline-run', run.run_id],
|
|
338
|
+
queryFn: () => getPipelineRunStatus(run.run_id),
|
|
339
|
+
refetchInterval: (query: { state: { data?: PipelineRunStatus } }) => (isRunOver(query.state.data) ? false : 15000),
|
|
340
|
+
})),
|
|
341
|
+
});
|
|
342
|
+
const out: Record<string, PipelineRunState | null | undefined> = {};
|
|
343
|
+
for (const run of runs) out[run.run_id] = run.state;
|
|
344
|
+
live.forEach((run, index) => {
|
|
345
|
+
const data = results[index]?.data;
|
|
346
|
+
if (data?.state && data.state !== 'unknown') out[run.run_id] = data.state;
|
|
347
|
+
});
|
|
348
|
+
return out;
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
const formatAgo = (epoch: number): string => {
|
|
352
|
+
const s = Math.max(0, Date.now() / 1000 - epoch);
|
|
353
|
+
if (s < 60) return 'just now';
|
|
354
|
+
if (s < 3600) return `${Math.floor(s / 60)} min ago`;
|
|
355
|
+
if (s < 86400) return `${Math.floor(s / 3600)} h ago`;
|
|
356
|
+
if (s < 30 * 86400) return `${Math.floor(s / 86400)} d ago`;
|
|
357
|
+
return new Date(epoch * 1000).toLocaleDateString();
|
|
358
|
+
};
|
|
359
|
+
|
|
237
360
|
const usePipelineDefinition = (name: string) => useQuery<PipelineTemplateFileData, ApiError>({
|
|
238
361
|
queryKey: ['pipeline-definition', name],
|
|
239
362
|
queryFn: async () => (await loadPipelineFromFile(name)) as PipelineTemplateFileData,
|
|
@@ -313,12 +436,28 @@ const RunButton: React.FC<{ name: string; onStarted: (run: PipelineRunResponse)
|
|
|
313
436
|
);
|
|
314
437
|
};
|
|
315
438
|
|
|
316
|
-
|
|
439
|
+
// the list shows the pipelines run most recently, the search finds the others
|
|
440
|
+
const PIPELINES_SHOWN = 25;
|
|
441
|
+
|
|
442
|
+
/** The clusters of the steps of a definition ("<cluster>/<profile>"): for the pipelines never run */
|
|
443
|
+
const definitionClusters = (node?: PipelineNode, out: string[] = []): string[] => {
|
|
444
|
+
if (!node) return out;
|
|
445
|
+
if (node.type === 'job') {
|
|
446
|
+
const cluster = node.cluster || (node.profile || '').split('/')[0];
|
|
447
|
+
if (cluster && !out.includes(cluster)) out.push(cluster);
|
|
448
|
+
return out;
|
|
449
|
+
}
|
|
450
|
+
for (const child of node.jobs || []) definitionClusters(child, out);
|
|
451
|
+
return out;
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
/** /pipelines: the saved pipelines, most recently run first */
|
|
317
455
|
export const PipelinesView: React.FC = () => {
|
|
318
456
|
usePageTitle('Pipelines');
|
|
319
457
|
const paths = useBujangPaths();
|
|
320
458
|
const navigate = useNavigate();
|
|
321
459
|
const [isCreateOpen, setIsCreateOpen] = useState(false);
|
|
460
|
+
const [search, setSearch] = useState('');
|
|
322
461
|
|
|
323
462
|
const { data: names = [], isLoading, error } = useQuery<string[], ApiError>({
|
|
324
463
|
queryKey: ['pipeline-template-files'],
|
|
@@ -333,6 +472,20 @@ export const PipelinesView: React.FC = () => {
|
|
|
333
472
|
});
|
|
334
473
|
const { data: runs = [] } = usePipelineRuns();
|
|
335
474
|
|
|
475
|
+
const rows = names.map((name, index) => {
|
|
476
|
+
const data = definitions[index]?.data;
|
|
477
|
+
const own = runsOf(runs, name, data?.name);
|
|
478
|
+
return { name, data, last: own[0] as PipelineRunSummary | undefined, count: own.length };
|
|
479
|
+
});
|
|
480
|
+
// most recently run first, then the ones never run by name
|
|
481
|
+
rows.sort((a, b) => (b.last?.started ?? -1) - (a.last?.started ?? -1) || a.name.localeCompare(b.name));
|
|
482
|
+
const needle = search.trim().toLowerCase();
|
|
483
|
+
const matching = needle
|
|
484
|
+
? rows.filter((row) => row.name.toLowerCase().includes(needle) || (row.data?.description || '').toLowerCase().includes(needle))
|
|
485
|
+
: rows;
|
|
486
|
+
const shown = matching.slice(0, PIPELINES_SHOWN);
|
|
487
|
+
const states = useLiveRunStates(shown.map((row) => row.last).filter(Boolean) as PipelineRunSummary[]);
|
|
488
|
+
|
|
336
489
|
return (
|
|
337
490
|
<Box p={6} bg="var(--color-bg-page)" minH="100vh">
|
|
338
491
|
<VStack gap={6} align="stretch">
|
|
@@ -370,56 +523,97 @@ export const PipelinesView: React.FC = () => {
|
|
|
370
523
|
|
|
371
524
|
{names.length > 0 && (
|
|
372
525
|
<Card.Root bg="var(--color-bg-card)" borderColor="var(--color-border)" borderRadius="lg" boxShadow="sm">
|
|
373
|
-
<Card.Body
|
|
374
|
-
<
|
|
375
|
-
<
|
|
376
|
-
<
|
|
377
|
-
<
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
</Table.
|
|
401
|
-
<Table.
|
|
402
|
-
|
|
403
|
-
</Table.
|
|
404
|
-
<Table.
|
|
405
|
-
|
|
406
|
-
</Table.
|
|
407
|
-
<Table.
|
|
408
|
-
{last ? (
|
|
409
|
-
<HStack gap={2}>
|
|
410
|
-
<Text>{formatStarted(last.started)}</Text>
|
|
411
|
-
{last.status !== 'submitted' && <Badge colorPalette={runStateColor(last.status)}>{last.status}</Badge>}
|
|
412
|
-
</HStack>
|
|
413
|
-
) : <Text color="var(--color-text-muted)">never</Text>}
|
|
414
|
-
</Table.Cell>
|
|
415
|
-
<Table.Cell borderColor="var(--color-border)" pr={4} textAlign="end">
|
|
416
|
-
<RunButton name={name} size="xs" onStarted={(run) => navigate(paths.pipelineDetails(name, run.run_id))} />
|
|
417
|
-
</Table.Cell>
|
|
526
|
+
<Card.Body>
|
|
527
|
+
<VStack align="stretch" gap={3}>
|
|
528
|
+
<HStack gap={3} flexWrap="wrap">
|
|
529
|
+
<InputGroup startElement={<LuSearch />} maxW="360px">
|
|
530
|
+
<Input
|
|
531
|
+
size="sm"
|
|
532
|
+
placeholder="Search the pipelines"
|
|
533
|
+
value={search}
|
|
534
|
+
onChange={(e) => setSearch(e.target.value)}
|
|
535
|
+
bg="var(--color-input-bg)"
|
|
536
|
+
borderColor="var(--color-input-border)"
|
|
537
|
+
color="var(--color-text)"
|
|
538
|
+
/>
|
|
539
|
+
</InputGroup>
|
|
540
|
+
<Spacer />
|
|
541
|
+
<Text fontSize="xs" color="var(--color-text-muted)">
|
|
542
|
+
{matching.length > shown.length
|
|
543
|
+
? `${shown.length} of ${matching.length} shown, most recently run first: search to find the others`
|
|
544
|
+
: `${matching.length} ${matching.length === 1 ? 'pipeline' : 'pipelines'}, most recently run first`}
|
|
545
|
+
</Text>
|
|
546
|
+
</HStack>
|
|
547
|
+
{shown.length === 0 ? (
|
|
548
|
+
<Text fontSize="sm" color="var(--color-text-muted)">No pipeline matches {search}.</Text>
|
|
549
|
+
) : (
|
|
550
|
+
<Table.Root size="sm" variant="outline" css={COMPACT_ROWS}>
|
|
551
|
+
<Table.Header>
|
|
552
|
+
<Table.Row>
|
|
553
|
+
<Table.ColumnHeader>Name</Table.ColumnHeader>
|
|
554
|
+
<Table.ColumnHeader textAlign="end" px={4}>Steps</Table.ColumnHeader>
|
|
555
|
+
<Table.ColumnHeader textAlign="end" px={4}>Runs</Table.ColumnHeader>
|
|
556
|
+
<Table.ColumnHeader px={4}>Cluster</Table.ColumnHeader>
|
|
557
|
+
<Table.ColumnHeader px={4}>Status</Table.ColumnHeader>
|
|
558
|
+
<Table.ColumnHeader px={4}>Last run</Table.ColumnHeader>
|
|
559
|
+
<Table.ColumnHeader px={4}>Description</Table.ColumnHeader>
|
|
560
|
+
<Table.ColumnHeader />
|
|
418
561
|
</Table.Row>
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
562
|
+
</Table.Header>
|
|
563
|
+
<Table.Body>
|
|
564
|
+
{shown.map(({ name, data, last, count }) => {
|
|
565
|
+
const clusters = last?.clusters?.length ? last.clusters : definitionClusters(data?.definition);
|
|
566
|
+
return (
|
|
567
|
+
<Table.Row
|
|
568
|
+
key={name}
|
|
569
|
+
cursor="pointer"
|
|
570
|
+
onClick={() => navigate(paths.pipelineDetails(name))}
|
|
571
|
+
_hover={{ bg: 'var(--color-bg-hover)' }}
|
|
572
|
+
>
|
|
573
|
+
<Table.Cell fontWeight="semibold">
|
|
574
|
+
<Link asChild color="var(--color-text)">
|
|
575
|
+
<RouterLink to={paths.pipelineDetails(name)} onClick={(e) => e.stopPropagation()}>{name}</RouterLink>
|
|
576
|
+
</Link>
|
|
577
|
+
</Table.Cell>
|
|
578
|
+
<Table.Cell textAlign="end" px={4}>
|
|
579
|
+
{data?.definition ? countSteps(data.definition) : '-'}
|
|
580
|
+
</Table.Cell>
|
|
581
|
+
<Table.Cell textAlign="end" px={4}>
|
|
582
|
+
{count || <Text as="span" color="var(--color-text-muted)">0</Text>}
|
|
583
|
+
</Table.Cell>
|
|
584
|
+
<Table.Cell px={4} fontSize="xs" fontFamily="mono">
|
|
585
|
+
{/* 12 characters at most, the full list in the tooltip */}
|
|
586
|
+
<Tooltip content={clusters.join(', ')} disabled={clusters.join(', ').length <= 12}>
|
|
587
|
+
<Text truncate maxW="12ch">{clusters.length ? clusters.join(', ') : '-'}</Text>
|
|
588
|
+
</Tooltip>
|
|
589
|
+
</Table.Cell>
|
|
590
|
+
<Table.Cell px={4} whiteSpace="nowrap">
|
|
591
|
+
{last ? (
|
|
592
|
+
<Badge colorPalette={runStateColor(last.status, states[last.run_id] ?? undefined)}>
|
|
593
|
+
{runLabel(last, states[last.run_id])}
|
|
594
|
+
</Badge>
|
|
595
|
+
) : <Text fontSize="xs" color="var(--color-text-muted)">-</Text>}
|
|
596
|
+
</Table.Cell>
|
|
597
|
+
<Table.Cell px={4} fontSize="xs" whiteSpace="nowrap">
|
|
598
|
+
{last ? (
|
|
599
|
+
<Tooltip content={formatStarted(last.started)}>
|
|
600
|
+
<Text>{formatAgo(last.started)}</Text>
|
|
601
|
+
</Tooltip>
|
|
602
|
+
) : <Text color="var(--color-text-muted)">never</Text>}
|
|
603
|
+
</Table.Cell>
|
|
604
|
+
<Table.Cell px={4} fontSize="xs" color="var(--color-text-muted)" maxW="520px">
|
|
605
|
+
<Text lineClamp={2}>{data?.description || '-'}</Text>
|
|
606
|
+
</Table.Cell>
|
|
607
|
+
<Table.Cell textAlign="end">
|
|
608
|
+
<RunButton name={name} size="xs" onStarted={(run) => navigate(paths.pipelineDetails(name, run.run_id))} />
|
|
609
|
+
</Table.Cell>
|
|
610
|
+
</Table.Row>
|
|
611
|
+
);
|
|
612
|
+
})}
|
|
613
|
+
</Table.Body>
|
|
614
|
+
</Table.Root>
|
|
615
|
+
)}
|
|
616
|
+
</VStack>
|
|
423
617
|
</Card.Body>
|
|
424
618
|
</Card.Root>
|
|
425
619
|
)}
|
|
@@ -446,7 +640,7 @@ export const PipelineDetailsView: React.FC = () => {
|
|
|
446
640
|
const [params, setParams] = useSearchParams();
|
|
447
641
|
const [isEditOpen, setIsEditOpen] = useState(false);
|
|
448
642
|
|
|
449
|
-
const { data: pipeline, error
|
|
643
|
+
const { data: pipeline, error } = usePipelineDefinition(pipelineName);
|
|
450
644
|
const { data: allRuns = [] } = usePipelineRuns();
|
|
451
645
|
const runs = runsOf(allRuns, pipelineName, pipeline?.name);
|
|
452
646
|
const shownRunId = params.get('run') ?? runs[0]?.run_id ?? null;
|
|
@@ -457,16 +651,8 @@ export const PipelineDetailsView: React.FC = () => {
|
|
|
457
651
|
queryFn: () => getPipelineRunStatus(shownRunId as string),
|
|
458
652
|
enabled: !!shownRunId,
|
|
459
653
|
});
|
|
460
|
-
const states = useMemo(() => {
|
|
461
|
-
const out: Record<string, string> = {};
|
|
462
|
-
for (const step of shownRun?.steps ?? []) if (step.step && step.state) out[step.step] = step.state;
|
|
463
|
-
return out;
|
|
464
|
-
}, [shownRun]);
|
|
465
|
-
|
|
466
|
-
// the graph of the run shown is the definition it was started with (the pipeline may have changed since)
|
|
467
|
-
const graphDefinition = shownRun?.definition ?? pipeline?.definition;
|
|
468
|
-
|
|
469
654
|
const selectRun = (runId: string) => setParams({ run: runId });
|
|
655
|
+
const runStates = useLiveRunStates(runs);
|
|
470
656
|
|
|
471
657
|
return (
|
|
472
658
|
<Box p={6} bg="var(--color-bg-page)" minH="100vh">
|
|
@@ -501,84 +687,121 @@ export const PipelineDetailsView: React.FC = () => {
|
|
|
501
687
|
<Alert.Content>
|
|
502
688
|
<Alert.Description>
|
|
503
689
|
{error.status === 404
|
|
504
|
-
? `No saved pipeline named ${pipelineName}${runs.length ? ': its runs are
|
|
690
|
+
? `No saved pipeline named ${pipelineName}${runs.length ? ': its runs are on the left' : ''}.`
|
|
505
691
|
: `Failed to load the pipeline: ${error.message}`}
|
|
506
692
|
</Alert.Description>
|
|
507
693
|
</Alert.Content>
|
|
508
694
|
</Alert.Root>
|
|
509
695
|
)}
|
|
510
696
|
|
|
511
|
-
{
|
|
512
|
-
|
|
513
|
-
|
|
697
|
+
{/* the runs on the left choose what the rest of the page shows */}
|
|
698
|
+
<Flex gap={6} align={{ base: 'stretch', lg: 'flex-start' }} direction={{ base: 'column', lg: 'row' }}>
|
|
699
|
+
<Card.Root
|
|
700
|
+
bg="var(--color-bg-card)"
|
|
701
|
+
borderColor="var(--color-border)"
|
|
702
|
+
borderRadius="lg"
|
|
703
|
+
boxShadow="sm"
|
|
704
|
+
w={{ base: '100%', lg: '280px' }}
|
|
705
|
+
flexShrink={0}
|
|
706
|
+
position={{ lg: 'sticky' }}
|
|
707
|
+
top={4}
|
|
708
|
+
overflow="hidden"
|
|
709
|
+
>
|
|
710
|
+
<Card.Header py={3} borderBottom="1px solid" borderColor="var(--color-border)">
|
|
514
711
|
<HStack>
|
|
515
|
-
<Heading size="
|
|
712
|
+
<Heading size="sm" color="var(--color-text)">Runs</Heading>
|
|
516
713
|
<Spacer />
|
|
517
|
-
|
|
518
|
-
<Text fontSize="xs" color="var(--color-text-muted)">
|
|
519
|
-
{shownRun?.definition ? 'definition and step states' : 'step states'} of run {shownRunId}
|
|
520
|
-
</Text>
|
|
521
|
-
)}
|
|
714
|
+
<Text fontSize="xs" color="var(--color-text-muted)">{runs.length}</Text>
|
|
522
715
|
</HStack>
|
|
523
716
|
</Card.Header>
|
|
524
|
-
<Card.Body>
|
|
525
|
-
{
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
717
|
+
<Card.Body p={0} maxH={{ lg: 'calc(100vh - 140px)' }} overflowY="auto">
|
|
718
|
+
{runs.length === 0 ? (
|
|
719
|
+
<Text p={4} fontSize="sm" color="var(--color-text-muted)">No run yet: use Run.</Text>
|
|
720
|
+
) : (
|
|
721
|
+
<VStack gap={0} align="stretch">
|
|
722
|
+
{runs.map((run) => {
|
|
723
|
+
const selected = run.run_id === shownRunId;
|
|
724
|
+
const state = selected && shownRun?.state && shownRun.state !== 'unknown' ? shownRun.state : runStates[run.run_id];
|
|
725
|
+
return (
|
|
726
|
+
<Box
|
|
727
|
+
key={run.run_id}
|
|
728
|
+
as="button"
|
|
729
|
+
textAlign="start"
|
|
730
|
+
px={4}
|
|
731
|
+
py={2}
|
|
732
|
+
cursor="pointer"
|
|
733
|
+
onClick={() => selectRun(run.run_id)}
|
|
734
|
+
bg={selected ? 'var(--color-bg-hover)' : undefined}
|
|
735
|
+
_hover={{ bg: 'var(--color-bg-hover)' }}
|
|
736
|
+
borderLeft="3px solid"
|
|
737
|
+
borderLeftColor={selected ? 'var(--color-primary)' : 'transparent'}
|
|
738
|
+
borderBottom="1px solid"
|
|
739
|
+
borderBottomColor="var(--color-border)"
|
|
740
|
+
aria-current={selected ? 'true' : undefined}
|
|
741
|
+
>
|
|
742
|
+
<HStack gap={2}>
|
|
743
|
+
<Badge size="sm" colorPalette={runStateColor(run.status, state ?? undefined)}>{runLabel(run, state)}</Badge>
|
|
744
|
+
<Spacer />
|
|
745
|
+
<Text fontSize="xs" color="var(--color-text-muted)" title={formatStarted(run.started)}>
|
|
746
|
+
{formatAgo(run.started)}
|
|
747
|
+
</Text>
|
|
748
|
+
</HStack>
|
|
749
|
+
<Text mt={1} fontFamily="mono" fontSize="xs" color="var(--color-text)" truncate>{run.run_id}</Text>
|
|
750
|
+
{run.error && <Text fontSize="xs" color="var(--color-text-muted)" lineClamp={2}>{run.error}</Text>}
|
|
751
|
+
</Box>
|
|
752
|
+
);
|
|
753
|
+
})}
|
|
754
|
+
</VStack>
|
|
755
|
+
)}
|
|
536
756
|
</Card.Body>
|
|
537
757
|
</Card.Root>
|
|
538
|
-
)}
|
|
539
758
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
) : (
|
|
548
|
-
<Table.Root size="sm" variant="line">
|
|
549
|
-
<Table.Header bg="var(--color-bg-header)">
|
|
550
|
-
<Table.Row>
|
|
551
|
-
<Table.ColumnHeader color="var(--color-text)" borderColor="var(--color-border)">Run</Table.ColumnHeader>
|
|
552
|
-
<Table.ColumnHeader color="var(--color-text)" borderColor="var(--color-border)">Started</Table.ColumnHeader>
|
|
553
|
-
<Table.ColumnHeader color="var(--color-text)" borderColor="var(--color-border)">Submission</Table.ColumnHeader>
|
|
554
|
-
</Table.Row>
|
|
555
|
-
</Table.Header>
|
|
556
|
-
<Table.Body>
|
|
557
|
-
{runs.map((run) => (
|
|
558
|
-
<Table.Row
|
|
559
|
-
key={run.run_id}
|
|
560
|
-
cursor="pointer"
|
|
561
|
-
onClick={() => selectRun(run.run_id)}
|
|
562
|
-
bg={run.run_id === shownRunId ? 'var(--color-bg-hover)' : undefined}
|
|
563
|
-
_hover={{ bg: 'var(--color-bg-hover)' }}
|
|
564
|
-
borderColor="var(--color-border)"
|
|
565
|
-
>
|
|
566
|
-
<Table.Cell fontFamily="mono" fontSize="sm" color="var(--color-text)" borderColor="var(--color-border)">
|
|
567
|
-
{run.run_id}
|
|
568
|
-
{run.run_id === shownRunId && <Badge ml={2} size="sm" variant="outline">shown</Badge>}
|
|
569
|
-
</Table.Cell>
|
|
570
|
-
<Table.Cell fontSize="sm" color="var(--color-text)" borderColor="var(--color-border)">{formatStarted(run.started)}</Table.Cell>
|
|
571
|
-
<Table.Cell borderColor="var(--color-border)">
|
|
572
|
-
<Badge colorPalette={runStateColor(run.status)}>{run.status}</Badge>
|
|
573
|
-
{run.error && <Text as="span" fontSize="xs" color="var(--color-text-muted)" ml={2}>{run.error}</Text>}
|
|
574
|
-
</Table.Cell>
|
|
575
|
-
</Table.Row>
|
|
576
|
-
))}
|
|
577
|
-
</Table.Body>
|
|
578
|
-
</Table.Root>
|
|
759
|
+
<VStack gap={6} align="stretch" flex={1} minW={0}>
|
|
760
|
+
{shownRunId && (
|
|
761
|
+
<Card.Root bg="var(--color-bg-card)" borderColor="var(--color-border)" borderRadius="lg" boxShadow="sm">
|
|
762
|
+
<Card.Body>
|
|
763
|
+
<PipelineRunProgress key={shownRunId} runId={shownRunId} />
|
|
764
|
+
</Card.Body>
|
|
765
|
+
</Card.Root>
|
|
579
766
|
)}
|
|
580
|
-
|
|
581
|
-
|
|
767
|
+
{/* never run: the steps it would submit */}
|
|
768
|
+
{!shownRunId && pipeline?.definition && (
|
|
769
|
+
<Card.Root bg="var(--color-bg-card)" borderColor="var(--color-border)" borderRadius="lg" boxShadow="sm">
|
|
770
|
+
<Card.Header pb={0}>
|
|
771
|
+
<Heading size="md" color="var(--color-text)">Steps</Heading>
|
|
772
|
+
</Card.Header>
|
|
773
|
+
<Card.Body>
|
|
774
|
+
<Table.Root size="sm" variant="outline" css={COMPACT_ROWS}>
|
|
775
|
+
<Table.Header>
|
|
776
|
+
<Table.Row>
|
|
777
|
+
<Table.ColumnHeader>Step</Table.ColumnHeader>
|
|
778
|
+
<Table.ColumnHeader>Profile</Table.ColumnHeader>
|
|
779
|
+
</Table.Row>
|
|
780
|
+
</Table.Header>
|
|
781
|
+
<Table.Body>
|
|
782
|
+
{stepRows(pipeline.definition, []).map((row, index) => {
|
|
783
|
+
const node = row.node;
|
|
784
|
+
return (
|
|
785
|
+
<Table.Row key={index} bg={row.kind === 'group' ? 'var(--color-bg-page)' : undefined}>
|
|
786
|
+
<Table.Cell pl={`${12 + row.depth * 20}px`} whiteSpace="nowrap" fontSize={row.kind === 'group' ? 'sm' : 'xs'} fontFamily={row.kind === 'group' ? undefined : 'mono'}>
|
|
787
|
+
<Text as="span" display="inline-block" minW="1.6em" color="var(--color-text-muted)" fontFamily="mono" fontSize="xs">{row.marker}</Text>
|
|
788
|
+
{node?.type === 'job'
|
|
789
|
+
? (node.label || node.script)
|
|
790
|
+
: <><Badge size="sm" variant="outline" mr={2} textTransform="capitalize">{node?.type}</Badge><Text as="span" fontWeight="semibold">{node?.name}</Text></>}
|
|
791
|
+
</Table.Cell>
|
|
792
|
+
<Table.Cell fontFamily="mono" fontSize="xs" color="var(--color-text-muted)">
|
|
793
|
+
{node?.type === 'job' ? node.profile : `${countJobs(node!)} steps`}
|
|
794
|
+
</Table.Cell>
|
|
795
|
+
</Table.Row>
|
|
796
|
+
);
|
|
797
|
+
})}
|
|
798
|
+
</Table.Body>
|
|
799
|
+
</Table.Root>
|
|
800
|
+
</Card.Body>
|
|
801
|
+
</Card.Root>
|
|
802
|
+
)}
|
|
803
|
+
</VStack>
|
|
804
|
+
</Flex>
|
|
582
805
|
</VStack>
|
|
583
806
|
|
|
584
807
|
{isEditOpen && (
|