@milabench/bujang 0.1.13 → 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/constants.d.ts +6 -0
- package/dist/index.js +3119 -3061
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/src/constants.ts +3 -0
- package/src/types.ts +2 -0
- package/src/views/JobDataOverview.tsx +9 -9
- package/src/views/JobLogs.tsx +13 -6
- package/src/views/JobsView.tsx +7 -7
- package/src/views/LogDisplay.tsx +2 -2
- package/src/views/PipelinesView.tsx +171 -68
package/dist/types.d.ts
CHANGED
|
@@ -335,6 +335,8 @@ export interface PipelineRunSummary {
|
|
|
335
335
|
name: string;
|
|
336
336
|
/** the saved pipeline it was started from; runs older than this field have none */
|
|
337
337
|
template?: string | null;
|
|
338
|
+
/** the clusters its steps ran on */
|
|
339
|
+
clusters?: string[];
|
|
338
340
|
started: number;
|
|
339
341
|
status: PipelineSubmissionStatus;
|
|
340
342
|
error?: string | null;
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export const NO_JOB_ID = "-";
|
|
2
2
|
export const NO_JOB_STATE = "-";
|
|
3
3
|
export const NO_JR_JOB_ID = "-";
|
|
4
|
+
|
|
5
|
+
/** `css` of a dense table: less vertical padding in the body cells than Chakra's `sm` (8px) */
|
|
6
|
+
export const COMPACT_ROWS = { '& tbody td': { paddingBlock: '4px' } } as const;
|
package/src/types.ts
CHANGED
|
@@ -375,6 +375,8 @@ export interface PipelineRunSummary {
|
|
|
375
375
|
name: string;
|
|
376
376
|
/** the saved pipeline it was started from; runs older than this field have none */
|
|
377
377
|
template?: string | null;
|
|
378
|
+
/** the clusters its steps ran on */
|
|
379
|
+
clusters?: string[];
|
|
378
380
|
started: number;
|
|
379
381
|
status: PipelineSubmissionStatus;
|
|
380
382
|
error?: string | null;
|
|
@@ -255,7 +255,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
|
|
|
255
255
|
if (!files.length) {
|
|
256
256
|
return (
|
|
257
257
|
<Card.Root bg="var(--color-bg-card)" border="1px solid" borderColor="var(--color-border)">
|
|
258
|
-
<Card.Body>
|
|
258
|
+
<Card.Body p={3}>
|
|
259
259
|
<Text color="var(--color-text-muted)">
|
|
260
260
|
No JSONL data (*.jsonl, *.ndjson, *.data) in {(data?.folders || ['output']).map((f) => `${f}/`).join(', ')} of this job.
|
|
261
261
|
A job writes its results in <Code>output/</Code>.
|
|
@@ -303,7 +303,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
|
|
|
303
303
|
<Text fontSize="sm" fontWeight="semibold" pt={2}>Explore the data</Text>
|
|
304
304
|
{/* Files and event */}
|
|
305
305
|
<Card.Root {...cardProps}>
|
|
306
|
-
<Card.Body
|
|
306
|
+
<Card.Body px={3} py={2}>
|
|
307
307
|
<Flex gap={6} wrap="wrap" align="start">
|
|
308
308
|
<VStack align="stretch" gap={1} flex="1" minW="300px">
|
|
309
309
|
<HStack justify="space-between">
|
|
@@ -361,7 +361,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
|
|
|
361
361
|
|
|
362
362
|
{/* Chart builder + chart */}
|
|
363
363
|
<Card.Root {...cardProps}>
|
|
364
|
-
<Card.Body
|
|
364
|
+
<Card.Body px={3} py={2}>
|
|
365
365
|
<Wrap gap={3} align="end" mb={3}>
|
|
366
366
|
<VStack align="stretch" gap={0}>
|
|
367
367
|
<Text fontSize="xs" color="var(--color-text-muted)">mark</Text>
|
|
@@ -423,7 +423,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
|
|
|
423
423
|
{/* Spec + Altair */}
|
|
424
424
|
<Flex gap={4} direction={{ base: 'column', xl: 'row' }}>
|
|
425
425
|
<Card.Root {...cardProps} flex="1" minW={0}>
|
|
426
|
-
<Card.Header py={2}>
|
|
426
|
+
<Card.Header px={3} py={2}>
|
|
427
427
|
<HStack justify="space-between">
|
|
428
428
|
<Text fontSize="sm" fontWeight="semibold">Vega-Lite spec (data: the dataset "rows")</Text>
|
|
429
429
|
<HStack gap={1}>
|
|
@@ -439,7 +439,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
|
|
|
439
439
|
</HStack>
|
|
440
440
|
{specError && <Text fontSize="xs" color="red.500">{specError}</Text>}
|
|
441
441
|
</Card.Header>
|
|
442
|
-
<Card.Body pt={0}>
|
|
442
|
+
<Card.Body px={3} pt={0} pb={3}>
|
|
443
443
|
<MonacoEditor
|
|
444
444
|
value={specText ?? JSON.stringify(builtSpec, null, 2)}
|
|
445
445
|
onChange={(value) => setSpecText(value)}
|
|
@@ -449,7 +449,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
|
|
|
449
449
|
</Card.Body>
|
|
450
450
|
</Card.Root>
|
|
451
451
|
<Card.Root {...cardProps} flex="1" minW={0}>
|
|
452
|
-
<Card.Header py={2}>
|
|
452
|
+
<Card.Header px={3} py={2}>
|
|
453
453
|
<HStack justify="space-between">
|
|
454
454
|
<Text fontSize="sm" fontWeight="semibold">Altair</Text>
|
|
455
455
|
<HStack gap={1}>
|
|
@@ -458,7 +458,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
|
|
|
458
458
|
</HStack>
|
|
459
459
|
</HStack>
|
|
460
460
|
</Card.Header>
|
|
461
|
-
<Card.Body pt={0}>
|
|
461
|
+
<Card.Body px={3} pt={0} pb={3}>
|
|
462
462
|
<Box as="pre" fontFamily="mono" fontSize="xs" overflow="auto" maxH="320px" p={2}
|
|
463
463
|
bg="var(--color-bg)" border="1px solid" borderColor="var(--color-border)" borderRadius="md">
|
|
464
464
|
{altair}
|
|
@@ -469,12 +469,12 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
|
|
|
469
469
|
|
|
470
470
|
{/* Fields */}
|
|
471
471
|
<Card.Root {...cardProps}>
|
|
472
|
-
<Card.Header py={2}>
|
|
472
|
+
<Card.Header px={3} py={2}>
|
|
473
473
|
<Text fontSize="sm" fontWeight="semibold">
|
|
474
474
|
Fields of {activeEvent ? <Code>{activeEvent}</Code> : 'the records'} · click to plot on y (number) or x
|
|
475
475
|
</Text>
|
|
476
476
|
</Card.Header>
|
|
477
|
-
<Card.Body pt={0} maxH="360px" overflowY="auto">
|
|
477
|
+
<Card.Body px={3} pt={0} pb={3} maxH="360px" overflowY="auto">
|
|
478
478
|
<Table.Root size="sm" variant="line">
|
|
479
479
|
<Table.Header>
|
|
480
480
|
<Table.Row>
|
package/src/views/JobLogs.tsx
CHANGED
|
@@ -579,21 +579,28 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
|
|
|
579
579
|
<HStack justify="space-between">
|
|
580
580
|
<HStack gap={3}>
|
|
581
581
|
<Heading size="lg" mb={2}>Job Logs</Heading>
|
|
582
|
+
{/* 40px high like the outline buttons of the header: 32px items, 3px padding, 1px border */}
|
|
582
583
|
<SegmentGroup.Root
|
|
583
|
-
size="
|
|
584
|
+
size="sm"
|
|
584
585
|
mb={2}
|
|
585
586
|
ml={3}
|
|
586
|
-
p=
|
|
587
|
+
p="3px"
|
|
587
588
|
gap={1}
|
|
588
589
|
value={activeTab}
|
|
589
590
|
onValueChange={(details) => details.value && setActiveTab(details.value)}
|
|
591
|
+
bg="var(--color-bg-page)"
|
|
592
|
+
border="1px solid"
|
|
593
|
+
borderColor="var(--color-border)"
|
|
590
594
|
>
|
|
591
|
-
<SegmentGroup.Indicator />
|
|
595
|
+
<SegmentGroup.Indicator bg="var(--color-primary)" boxShadow="none" />
|
|
592
596
|
<SegmentGroup.Items
|
|
593
|
-
items={[{ value: '
|
|
597
|
+
items={[{ value: 'overview', label: 'Overview' }, { value: 'logs', label: 'Logs' }]}
|
|
594
598
|
px={5}
|
|
595
599
|
minW="96px"
|
|
596
600
|
justifyContent="center"
|
|
601
|
+
color="var(--color-text-muted)"
|
|
602
|
+
_hover={{ color: 'var(--color-text)' }}
|
|
603
|
+
_checked={{ color: 'var(--color-primary-text)', fontWeight: 'semibold' }}
|
|
597
604
|
/>
|
|
598
605
|
</SegmentGroup.Root>
|
|
599
606
|
{clusterStatus?.status === 'offline' && (
|
|
@@ -692,7 +699,7 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
|
|
|
692
699
|
|
|
693
700
|
{/* Job Quick Info */}
|
|
694
701
|
<Card.Root bg="var(--color-bg-card)" padding="10px" border="1px solid" borderColor="var(--color-border)">
|
|
695
|
-
<Card.Body>
|
|
702
|
+
<Card.Body p={0}>
|
|
696
703
|
<Wrap gap={4} rowGap={2} align="center">
|
|
697
704
|
{jobClusterData?.cluster && (
|
|
698
705
|
<WrapItem>
|
|
@@ -818,7 +825,7 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
|
|
|
818
825
|
{/* Loading state for logs */}
|
|
819
826
|
{activeTab === 'logs' && !jobStatus && statusLoading && (
|
|
820
827
|
<Card.Root bg="var(--color-bg-card)" border="1px solid" borderColor="var(--color-border)" flex="1">
|
|
821
|
-
<Card.Body>
|
|
828
|
+
<Card.Body p={2}>
|
|
822
829
|
<VStack gap={4} justify="center" h="100%">
|
|
823
830
|
<Spinner size="xl" />
|
|
824
831
|
<Text>Loading job status...</Text>
|
package/src/views/JobsView.tsx
CHANGED
|
@@ -46,7 +46,7 @@ import type { SlurmJob, PersitedJobInfo, ApiError, OrganizerGroups, SyncStatus }
|
|
|
46
46
|
import { usePageTitle } from '../hooks/usePageTitle';
|
|
47
47
|
import { AgentBadge } from './AgentActivityView';
|
|
48
48
|
import { SshConnectButton } from '../components/SshConnectDialog';
|
|
49
|
-
import { NO_JOB_ID, NO_JOB_STATE, NO_JR_JOB_ID } from '../constants';
|
|
49
|
+
import { COMPACT_ROWS, NO_JOB_ID, NO_JOB_STATE, NO_JR_JOB_ID } from '../constants';
|
|
50
50
|
|
|
51
51
|
type JobsViewProps = Record<string, never>;
|
|
52
52
|
|
|
@@ -511,7 +511,7 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
511
511
|
</Box>
|
|
512
512
|
) : (
|
|
513
513
|
<Table.ScrollArea maxH="35vh" overflowY="auto">
|
|
514
|
-
<Table.Root variant="line" size="
|
|
514
|
+
<Table.Root variant="line" size="sm" stickyHeader css={COMPACT_ROWS}>
|
|
515
515
|
<Table.Header bg="var(--color-bg-header)">
|
|
516
516
|
<Table.Row>
|
|
517
517
|
<Table.ColumnHeader fontWeight="semibold" color="var(--color-text)" py={2} pl={6} pr={4} fontSize="sm">Job ID</Table.ColumnHeader>
|
|
@@ -583,7 +583,7 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
583
583
|
>
|
|
584
584
|
<IconButton
|
|
585
585
|
aria-label="View job logs"
|
|
586
|
-
size="
|
|
586
|
+
size="xs"
|
|
587
587
|
variant="ghost"
|
|
588
588
|
>
|
|
589
589
|
<LuEye />
|
|
@@ -598,7 +598,7 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
598
598
|
>
|
|
599
599
|
<IconButton
|
|
600
600
|
aria-label="Cancel job"
|
|
601
|
-
size="
|
|
601
|
+
size="xs"
|
|
602
602
|
variant="ghost"
|
|
603
603
|
colorScheme="red"
|
|
604
604
|
onClick={() => job.job_id && handleCancelJob(job.job_id)}
|
|
@@ -686,7 +686,7 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
686
686
|
</Text>
|
|
687
687
|
</Box>
|
|
688
688
|
) : (
|
|
689
|
-
<Table.Root variant="line" size="
|
|
689
|
+
<Table.Root variant="line" size="sm" stickyHeader css={COMPACT_ROWS}>
|
|
690
690
|
<Table.Header bg="var(--color-bg-header)">
|
|
691
691
|
<Table.Row>
|
|
692
692
|
<Table.ColumnHeader fontWeight="semibold" color="var(--color-text)" py={2} pl={6} pr={4} fontSize="sm">Job ID</Table.ColumnHeader>
|
|
@@ -839,7 +839,7 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
839
839
|
>
|
|
840
840
|
<IconButton
|
|
841
841
|
aria-label="View job logs"
|
|
842
|
-
size="
|
|
842
|
+
size="xs"
|
|
843
843
|
variant="ghost"
|
|
844
844
|
>
|
|
845
845
|
<LuEye />
|
|
@@ -852,7 +852,7 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
852
852
|
>
|
|
853
853
|
<IconButton
|
|
854
854
|
aria-label="Rerun job"
|
|
855
|
-
size="
|
|
855
|
+
size="xs"
|
|
856
856
|
variant="ghost"
|
|
857
857
|
colorScheme="blue"
|
|
858
858
|
onClick={() => handleRerunJob(jrJobId)}
|
package/src/views/LogDisplay.tsx
CHANGED
|
@@ -100,7 +100,7 @@ export const LogDisplay: React.FC<LogDisplayProps> = ({
|
|
|
100
100
|
|
|
101
101
|
return (
|
|
102
102
|
<Card.Root bg="var(--color-bg-card)" padding="10px" border="1px solid" borderColor="var(--color-border)" className="logview" flex={1} minH={0} display="flex" flexDirection="column">
|
|
103
|
-
<Card.Header paddingBottom="5px" flexShrink={0}>
|
|
103
|
+
<Card.Header p={0} paddingBottom="5px" flexShrink={0}>
|
|
104
104
|
<HStack justify="space-between">
|
|
105
105
|
<Heading size="md">{displayName}</Heading>
|
|
106
106
|
|
|
@@ -116,7 +116,7 @@ export const LogDisplay: React.FC<LogDisplayProps> = ({
|
|
|
116
116
|
</HStack>
|
|
117
117
|
</HStack>
|
|
118
118
|
</Card.Header>
|
|
119
|
-
<Card.Body flex="1" minH={0} display="flex" flexDirection="column">
|
|
119
|
+
<Card.Body p={0} flex="1" minH={0} display="flex" flexDirection="column">
|
|
120
120
|
{error ? (
|
|
121
121
|
<Alert.Root status="error">
|
|
122
122
|
<Alert.Indicator />
|
|
@@ -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,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from '@chakra-ui/react';
|
|
20
20
|
import { Link as RouterLink, useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
|
21
21
|
import { useBujangPaths } from '../context';
|
|
22
|
-
import { NO_JOB_ID } from '../constants';
|
|
22
|
+
import { COMPACT_ROWS, NO_JOB_ID } from '../constants';
|
|
23
23
|
import { toaster } from '../toast';
|
|
24
24
|
import { LuArrowLeft, LuPencil, LuPlay, LuPlus, LuSearch } from 'react-icons/lu';
|
|
25
25
|
import { useQuery, useQueries, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
@@ -39,9 +39,9 @@ import type {
|
|
|
39
39
|
PipelineRunResponse,
|
|
40
40
|
PipelineRunSummary,
|
|
41
41
|
PipelineRunStatus,
|
|
42
|
+
PipelineRunStep,
|
|
42
43
|
PipelineRunState
|
|
43
44
|
} from '../types';
|
|
44
|
-
import { PipelineGraph, graphIsDrawable } from './PipelineGraph';
|
|
45
45
|
import { PipelineBuilder } from './PipelineEditor';
|
|
46
46
|
import type { PipelineTemplateFileData } from './PipelineEditor';
|
|
47
47
|
import { usePageTitle } from '../hooks/usePageTitle';
|
|
@@ -86,6 +86,53 @@ const JobLogsLink: React.FC<{ jobId?: string | null; slurmJobId?: string | null;
|
|
|
86
86
|
const isRunOver = (run?: PipelineRunStatus): boolean =>
|
|
87
87
|
!!run && (run.status === 'failed' || run.state === 'completed' || run.state === 'failed');
|
|
88
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
|
+
|
|
89
136
|
// Progress of one run: steps with their state and the pipeline log, refreshed until it is over
|
|
90
137
|
const PipelineRunProgress: React.FC<{ runId: string }> = ({ runId }) => {
|
|
91
138
|
const { data: run, error, dataUpdatedAt, isFetching } = useQuery<PipelineRunStatus, ApiError>({
|
|
@@ -151,7 +198,7 @@ const PipelineRunProgress: React.FC<{ runId: string }> = ({ runId }) => {
|
|
|
151
198
|
)}
|
|
152
199
|
|
|
153
200
|
{run.steps && run.steps.length > 0 && (
|
|
154
|
-
<Table.Root size="sm" variant="outline">
|
|
201
|
+
<Table.Root size="sm" variant="outline" css={COMPACT_ROWS}>
|
|
155
202
|
<Table.Header>
|
|
156
203
|
<Table.Row>
|
|
157
204
|
<Table.ColumnHeader>Step</Table.ColumnHeader>
|
|
@@ -161,18 +208,42 @@ const PipelineRunProgress: React.FC<{ runId: string }> = ({ runId }) => {
|
|
|
161
208
|
</Table.ColumnHeader>
|
|
162
209
|
)}
|
|
163
210
|
<Table.ColumnHeader>Runs on</Table.ColumnHeader>
|
|
164
|
-
<Table.ColumnHeader>Waits on</Table.ColumnHeader>
|
|
165
211
|
<Table.ColumnHeader>State</Table.ColumnHeader>
|
|
166
212
|
<Table.ColumnHeader>Job folder</Table.ColumnHeader>
|
|
167
213
|
</Table.Row>
|
|
168
214
|
</Table.Header>
|
|
169
215
|
<Table.Body>
|
|
170
|
-
{run.steps.map((
|
|
171
|
-
const
|
|
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;
|
|
172
240
|
return (
|
|
173
|
-
<Table.Row key={step.job_id || step.step}>
|
|
174
|
-
<Table.Cell fontFamily="mono" fontSize="xs">
|
|
175
|
-
|
|
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>
|
|
176
247
|
</Table.Cell>
|
|
177
248
|
{sweepKeys.length > 0 && (
|
|
178
249
|
<Table.Cell fontFamily="mono" fontSize="xs">
|
|
@@ -185,14 +256,6 @@ const PipelineRunProgress: React.FC<{ runId: string }> = ({ runId }) => {
|
|
|
185
256
|
{step.executor === 'ssh' ? `ssh ${step.host}` : `slurm ${step.slurm_jobid ?? '-'}`}
|
|
186
257
|
<Text as="span" color="var(--color-text-muted)"> ({step.profile})</Text>
|
|
187
258
|
</Table.Cell>
|
|
188
|
-
{/* a step after a wide parallel group waits on many: clipped, all of them in the tooltip */}
|
|
189
|
-
<Table.Cell fontFamily="mono" fontSize="xs" color="var(--color-text-muted)" maxW="200px">
|
|
190
|
-
{after ? (
|
|
191
|
-
<Tooltip content={<Text fontFamily="mono" fontSize="xs" whiteSpace="pre-wrap">{step.after!.join('\n')}</Text>}>
|
|
192
|
-
<Text truncate cursor="default">{after}</Text>
|
|
193
|
-
</Tooltip>
|
|
194
|
-
) : '-'}
|
|
195
|
-
</Table.Cell>
|
|
196
259
|
<Table.Cell>
|
|
197
260
|
<Badge colorPalette={stepStateColor(step.state)}>{step.state || 'UNKNOWN'}</Badge>
|
|
198
261
|
</Table.Cell>
|
|
@@ -247,9 +310,13 @@ const usePipelineRuns = () => useQuery<PipelineRunSummary[], ApiError>({
|
|
|
247
310
|
|
|
248
311
|
const OVER_STATES: (PipelineRunState | null | undefined)[] = ['completed', 'failed'];
|
|
249
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
|
+
|
|
250
316
|
/** What a run shows: the submission when it is not submitted, else the state of its jobs */
|
|
251
317
|
const runLabel = (run: PipelineRunSummary, state?: PipelineRunState | null): string =>
|
|
252
|
-
run.status !== 'submitted' ? run.status
|
|
318
|
+
run.status !== 'submitted' ? run.status
|
|
319
|
+
: (state || (Date.now() / 1000 - run.started < JUST_SUBMITTED_S ? 'submitted' : 'unknown'));
|
|
253
320
|
|
|
254
321
|
// runs older than this are not polled: their jobs may be gone from sacct, they would look running forever
|
|
255
322
|
const LIVE_RUN_MAX_AGE_S = 3 * 24 * 3600;
|
|
@@ -370,7 +437,19 @@ const RunButton: React.FC<{ name: string; onStarted: (run: PipelineRunResponse)
|
|
|
370
437
|
};
|
|
371
438
|
|
|
372
439
|
// the list shows the pipelines run most recently, the search finds the others
|
|
373
|
-
const PIPELINES_SHOWN =
|
|
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
|
+
};
|
|
374
453
|
|
|
375
454
|
/** /pipelines: the saved pipelines, most recently run first */
|
|
376
455
|
export const PipelinesView: React.FC = () => {
|
|
@@ -395,7 +474,8 @@ export const PipelinesView: React.FC = () => {
|
|
|
395
474
|
|
|
396
475
|
const rows = names.map((name, index) => {
|
|
397
476
|
const data = definitions[index]?.data;
|
|
398
|
-
|
|
477
|
+
const own = runsOf(runs, name, data?.name);
|
|
478
|
+
return { name, data, last: own[0] as PipelineRunSummary | undefined, count: own.length };
|
|
399
479
|
});
|
|
400
480
|
// most recently run first, then the ones never run by name
|
|
401
481
|
rows.sort((a, b) => (b.last?.started ?? -1) - (a.last?.started ?? -1) || a.name.localeCompare(b.name));
|
|
@@ -467,18 +547,23 @@ export const PipelinesView: React.FC = () => {
|
|
|
467
547
|
{shown.length === 0 ? (
|
|
468
548
|
<Text fontSize="sm" color="var(--color-text-muted)">No pipeline matches {search}.</Text>
|
|
469
549
|
) : (
|
|
470
|
-
<Table.Root size="sm" variant="outline">
|
|
550
|
+
<Table.Root size="sm" variant="outline" css={COMPACT_ROWS}>
|
|
471
551
|
<Table.Header>
|
|
472
552
|
<Table.Row>
|
|
473
553
|
<Table.ColumnHeader>Name</Table.ColumnHeader>
|
|
474
|
-
<Table.ColumnHeader>
|
|
475
|
-
<Table.ColumnHeader textAlign="end">
|
|
476
|
-
<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>
|
|
477
560
|
<Table.ColumnHeader />
|
|
478
561
|
</Table.Row>
|
|
479
562
|
</Table.Header>
|
|
480
563
|
<Table.Body>
|
|
481
|
-
{shown.map(({ name, data, last }) =>
|
|
564
|
+
{shown.map(({ name, data, last, count }) => {
|
|
565
|
+
const clusters = last?.clusters?.length ? last.clusters : definitionClusters(data?.definition);
|
|
566
|
+
return (
|
|
482
567
|
<Table.Row
|
|
483
568
|
key={name}
|
|
484
569
|
cursor="pointer"
|
|
@@ -490,29 +575,41 @@ export const PipelinesView: React.FC = () => {
|
|
|
490
575
|
<RouterLink to={paths.pipelineDetails(name)} onClick={(e) => e.stopPropagation()}>{name}</RouterLink>
|
|
491
576
|
</Link>
|
|
492
577
|
</Table.Cell>
|
|
493
|
-
<Table.Cell
|
|
494
|
-
<Text lineClamp={2}>{data?.description || '-'}</Text>
|
|
495
|
-
</Table.Cell>
|
|
496
|
-
<Table.Cell textAlign="end">
|
|
578
|
+
<Table.Cell textAlign="end" px={4}>
|
|
497
579
|
{data?.definition ? countSteps(data.definition) : '-'}
|
|
498
580
|
</Table.Cell>
|
|
499
|
-
<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">
|
|
500
591
|
{last ? (
|
|
501
|
-
<
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
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>
|
|
509
602
|
) : <Text color="var(--color-text-muted)">never</Text>}
|
|
510
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>
|
|
511
607
|
<Table.Cell textAlign="end">
|
|
512
608
|
<RunButton name={name} size="xs" onStarted={(run) => navigate(paths.pipelineDetails(name, run.run_id))} />
|
|
513
609
|
</Table.Cell>
|
|
514
610
|
</Table.Row>
|
|
515
|
-
|
|
611
|
+
);
|
|
612
|
+
})}
|
|
516
613
|
</Table.Body>
|
|
517
614
|
</Table.Root>
|
|
518
615
|
)}
|
|
@@ -543,7 +640,7 @@ export const PipelineDetailsView: React.FC = () => {
|
|
|
543
640
|
const [params, setParams] = useSearchParams();
|
|
544
641
|
const [isEditOpen, setIsEditOpen] = useState(false);
|
|
545
642
|
|
|
546
|
-
const { data: pipeline, error
|
|
643
|
+
const { data: pipeline, error } = usePipelineDefinition(pipelineName);
|
|
547
644
|
const { data: allRuns = [] } = usePipelineRuns();
|
|
548
645
|
const runs = runsOf(allRuns, pipelineName, pipeline?.name);
|
|
549
646
|
const shownRunId = params.get('run') ?? runs[0]?.run_id ?? null;
|
|
@@ -554,15 +651,6 @@ export const PipelineDetailsView: React.FC = () => {
|
|
|
554
651
|
queryFn: () => getPipelineRunStatus(shownRunId as string),
|
|
555
652
|
enabled: !!shownRunId,
|
|
556
653
|
});
|
|
557
|
-
const states = useMemo(() => {
|
|
558
|
-
const out: Record<string, string> = {};
|
|
559
|
-
for (const step of shownRun?.steps ?? []) if (step.step && step.state) out[step.step] = step.state;
|
|
560
|
-
return out;
|
|
561
|
-
}, [shownRun]);
|
|
562
|
-
|
|
563
|
-
// the graph of the run shown is the definition it was started with (the pipeline may have changed since)
|
|
564
|
-
const graphDefinition = shownRun?.definition ?? pipeline?.definition;
|
|
565
|
-
|
|
566
654
|
const selectRun = (runId: string) => setParams({ run: runId });
|
|
567
655
|
const runStates = useLiveRunStates(runs);
|
|
568
656
|
|
|
@@ -669,31 +757,46 @@ export const PipelineDetailsView: React.FC = () => {
|
|
|
669
757
|
</Card.Root>
|
|
670
758
|
|
|
671
759
|
<VStack gap={6} align="stretch" flex={1} minW={0}>
|
|
672
|
-
{
|
|
760
|
+
{shownRunId && (
|
|
673
761
|
<Card.Root bg="var(--color-bg-card)" borderColor="var(--color-border)" borderRadius="lg" boxShadow="sm">
|
|
674
|
-
<Card.Header pb={0}>
|
|
675
|
-
<HStack>
|
|
676
|
-
<Heading size="md" color="var(--color-text)">Graph</Heading>
|
|
677
|
-
<Spacer />
|
|
678
|
-
{shownRunId && Object.keys(states).length > 0 && (
|
|
679
|
-
<Text fontSize="xs" color="var(--color-text-muted)">
|
|
680
|
-
{shownRun?.definition ? 'definition and step states' : 'step states'} of run {shownRunId}
|
|
681
|
-
</Text>
|
|
682
|
-
)}
|
|
683
|
-
</HStack>
|
|
684
|
-
</Card.Header>
|
|
685
762
|
<Card.Body>
|
|
686
|
-
{
|
|
687
|
-
? <PipelineGraph definition={graphDefinition} states={states} />
|
|
688
|
-
: <Text color="var(--color-text-muted)">Loading...</Text>}
|
|
763
|
+
<PipelineRunProgress key={shownRunId} runId={shownRunId} />
|
|
689
764
|
</Card.Body>
|
|
690
765
|
</Card.Root>
|
|
691
766
|
)}
|
|
692
|
-
|
|
693
|
-
{shownRunId && (
|
|
767
|
+
{/* never run: the steps it would submit */}
|
|
768
|
+
{!shownRunId && pipeline?.definition && (
|
|
694
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>
|
|
695
773
|
<Card.Body>
|
|
696
|
-
<
|
|
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>
|
|
697
800
|
</Card.Body>
|
|
698
801
|
</Card.Root>
|
|
699
802
|
)}
|