@milabench/bujang 0.1.14 → 0.1.16
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 +1 -0
- package/dist/index.js +7828 -7044
- package/dist/index.js.map +1 -1
- package/dist/theme.css +26 -0
- package/dist/types.d.ts +63 -10
- package/dist/views/AgentActivityView.d.ts +2 -1
- package/dist/views/JobArtifacts.d.ts +1 -0
- package/dist/views/JobDataOverview.d.ts +4 -3
- package/dist/views/JobSubmit.d.ts +1 -0
- package/dist/views/JobsTable.d.ts +57 -0
- package/dist/views/OverviewPanels.d.ts +38 -9
- package/dist/views/SettingsView.d.ts +4 -0
- package/dist/views/dataCharts.d.ts +11 -7
- package/package.json +1 -1
- package/src/api.ts +9 -2
- package/src/components/SshConnectDialog.tsx +1 -1
- package/src/theme.css +26 -0
- package/src/types.ts +48 -6
- package/src/views/AgentActivityView.tsx +14 -5
- package/src/views/JobArtifacts.tsx +1 -1
- package/src/views/JobDataOverview.tsx +125 -138
- package/src/views/JobLogs.tsx +18 -8
- package/src/views/JobMarks.tsx +1 -1
- package/src/views/JobSubmit.tsx +27 -21
- package/src/views/JobsTable.tsx +746 -0
- package/src/views/JobsView.tsx +83 -518
- package/src/views/OverviewPanels.tsx +940 -88
- package/src/views/PipelineEditor.tsx +1 -1
- package/src/views/PipelinesView.tsx +3 -0
- package/src/views/ScheduleDialog.tsx +1 -1
- package/src/views/ScheduledJobsView.tsx +2 -2
- package/src/views/SettingsView.tsx +80 -18
- package/src/views/SweepDialog.tsx +1 -1
- package/src/views/dataCharts.tsx +21 -11
package/dist/theme.css
CHANGED
|
@@ -70,3 +70,29 @@
|
|
|
70
70
|
--color-pipeline-par-bg: #1a202c;
|
|
71
71
|
--color-pipeline-par-border: #4a5568;
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Dialogs (Dialog.Content className="bujang-dialog"): Chakra paints them with its own
|
|
76
|
+
* neutral palette (bg.panel, border, fg...). Inside a bujang dialog, those Chakra
|
|
77
|
+
* tokens point at the bujang colours above, so the panel, its inputs, selects,
|
|
78
|
+
* tables and buttons match the cards of the pages. Only bujang dialogs change:
|
|
79
|
+
* a host's own dialogs keep its Chakra theme.
|
|
80
|
+
*/
|
|
81
|
+
:where(.bujang-dialog) {
|
|
82
|
+
--chakra-colors-bg: var(--color-bg-card);
|
|
83
|
+
--chakra-colors-bg-panel: var(--color-bg-card);
|
|
84
|
+
--chakra-colors-bg-subtle: var(--color-bg-header);
|
|
85
|
+
--chakra-colors-bg-muted: var(--color-bg-hover);
|
|
86
|
+
--chakra-colors-bg-emphasized: var(--color-bg-hover);
|
|
87
|
+
--chakra-colors-fg: var(--color-text);
|
|
88
|
+
--chakra-colors-fg-muted: var(--color-text-muted);
|
|
89
|
+
--chakra-colors-fg-subtle: var(--color-text-muted);
|
|
90
|
+
--chakra-colors-border: var(--color-input-border);
|
|
91
|
+
--chakra-colors-border-subtle: var(--color-border);
|
|
92
|
+
--chakra-colors-border-muted: var(--color-border);
|
|
93
|
+
--chakra-colors-border-emphasized: var(--color-input-border);
|
|
94
|
+
--chakra-colors-gray-subtle: var(--color-bg-hover);
|
|
95
|
+
--chakra-colors-gray-muted: var(--color-bg-hover);
|
|
96
|
+
color: var(--color-text);
|
|
97
|
+
border: 1px solid var(--color-border);
|
|
98
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export interface ApiError {
|
|
|
5
5
|
export interface SlurmJob {
|
|
6
6
|
job_id: string | null;
|
|
7
7
|
jr_job_id?: string | null;
|
|
8
|
+
/** The cluster whose squeue listed the job (GET /jobs) */
|
|
9
|
+
cluster?: string;
|
|
8
10
|
/** Submitted by an agent through the MCP server */
|
|
9
11
|
agent?: AgentTag | null;
|
|
10
12
|
created_at?: string;
|
|
@@ -240,6 +242,11 @@ export interface PersitedJobInfo {
|
|
|
240
242
|
important?: boolean;
|
|
241
243
|
/** The manual groups of the job (groups/<group>/<job id>) */
|
|
242
244
|
groups?: string[];
|
|
245
|
+
/** A step of a pipeline run: the run, and the saved pipeline it was started from (else the run's name) */
|
|
246
|
+
pipeline?: {
|
|
247
|
+
run_id: string;
|
|
248
|
+
name: string;
|
|
249
|
+
} | null;
|
|
243
250
|
}
|
|
244
251
|
/** GET/POST /jobs/<jr>/marks: whether a job is important, its groups, every group, git */
|
|
245
252
|
export interface JobMarks {
|
|
@@ -344,6 +351,8 @@ export interface PipelineRunSummary {
|
|
|
344
351
|
state?: PipelineRunState | null;
|
|
345
352
|
/** when `state` was read (epoch seconds) */
|
|
346
353
|
checked?: number | null;
|
|
354
|
+
/** Started by an agent through the MCP server */
|
|
355
|
+
agent?: AgentTag | null;
|
|
347
356
|
}
|
|
348
357
|
/** A step of a run with its current state (sacct/squeue state, HELD, or the ssh step state) */
|
|
349
358
|
export interface PipelineRunStep extends PipelineJob {
|
|
@@ -367,6 +376,8 @@ export interface PipelineRunStatus {
|
|
|
367
376
|
log?: string;
|
|
368
377
|
/** the definition the run was started with (the saved pipeline may have changed since) */
|
|
369
378
|
definition?: PipelineNode | null;
|
|
379
|
+
/** Started by an agent through the MCP server */
|
|
380
|
+
agent?: AgentTag | null;
|
|
370
381
|
}
|
|
371
382
|
export interface PipelineSequential {
|
|
372
383
|
type: 'sequential';
|
|
@@ -553,6 +564,8 @@ export interface SettingsField<T = string> {
|
|
|
553
564
|
export type SettingsFieldName = 'local_cache' | 'workdir' | 'database_url';
|
|
554
565
|
export type SettingsFields = Record<SettingsFieldName, SettingsField> & {
|
|
555
566
|
show_examples: SettingsField<boolean>;
|
|
567
|
+
/** Jobs page: the active and the persisted jobs in one table (false: one table each). */
|
|
568
|
+
jobs_merged: SettingsField<boolean>;
|
|
556
569
|
/** What the MCP server tells the agents when they connect (null: general.mcp.default_instructions). */
|
|
557
570
|
mcp_instructions: SettingsField;
|
|
558
571
|
/** The default layout of the Overview tab (null: the built-in one). */
|
|
@@ -701,12 +714,18 @@ export interface SshPluginStatus {
|
|
|
701
714
|
values: Record<string, string>;
|
|
702
715
|
line: number | null;
|
|
703
716
|
duplicates: number;
|
|
704
|
-
/**
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
717
|
+
/** Placeholder values read in the user's own entries. */
|
|
718
|
+
inferred: Record<string, string>;
|
|
719
|
+
/** How each host merges with the user's entries. */
|
|
720
|
+
hosts: SshHostMerge[];
|
|
721
|
+
}
|
|
722
|
+
/** Where the options of a host come from: the user's own entries win */
|
|
723
|
+
export interface SshHostMerge {
|
|
724
|
+
alias: string;
|
|
725
|
+
/** the alias of the user it is merged with (the same, or another one of the same machine), null: none */
|
|
726
|
+
source: string | null;
|
|
727
|
+
yours: Record<string, string>;
|
|
728
|
+
plugin: Record<string, string>;
|
|
710
729
|
}
|
|
711
730
|
export interface SshSettings {
|
|
712
731
|
file: string;
|
|
@@ -736,6 +755,7 @@ export interface SshPlan {
|
|
|
736
755
|
messages: string[];
|
|
737
756
|
warnings: string[];
|
|
738
757
|
aliases: string[];
|
|
758
|
+
hosts: SshHostMerge[];
|
|
739
759
|
base: string;
|
|
740
760
|
backup?: string | null;
|
|
741
761
|
written?: boolean;
|
|
@@ -861,8 +881,25 @@ export interface JobDataField {
|
|
|
861
881
|
/** distinct values of a string field, null when there are too many */
|
|
862
882
|
values?: string[] | null;
|
|
863
883
|
}
|
|
864
|
-
/** A
|
|
865
|
-
export
|
|
884
|
+
/** A row of a stats block: a number field of an event */
|
|
885
|
+
export interface StatsMetric {
|
|
886
|
+
event: string;
|
|
887
|
+
field: string;
|
|
888
|
+
title?: string;
|
|
889
|
+
}
|
|
890
|
+
/** A block of the Overview tab: the log view, the media of the artifact folders, or a chart (Vega-Lite) of one or several events */
|
|
891
|
+
export type OverviewBlock = {
|
|
892
|
+
kind: 'artifacts';
|
|
893
|
+
title?: string;
|
|
894
|
+
files?: string;
|
|
895
|
+
} | {
|
|
896
|
+
kind: 'files';
|
|
897
|
+
title?: string;
|
|
898
|
+
} | {
|
|
899
|
+
kind: 'stats';
|
|
900
|
+
title?: string;
|
|
901
|
+
metrics?: StatsMetric[];
|
|
902
|
+
} | {
|
|
866
903
|
kind: 'logs';
|
|
867
904
|
title?: string;
|
|
868
905
|
levels?: string[];
|
|
@@ -870,6 +907,7 @@ export type OverviewPanel = {
|
|
|
870
907
|
} | {
|
|
871
908
|
kind: 'chart';
|
|
872
909
|
title?: string;
|
|
910
|
+
/** comma separated events; the rows have theirs as `type` */
|
|
873
911
|
event?: string;
|
|
874
912
|
/** comma separated paths or globs, relative to the job folder */
|
|
875
913
|
files?: string;
|
|
@@ -886,6 +924,11 @@ export type OverviewPanel = {
|
|
|
886
924
|
log_y?: boolean;
|
|
887
925
|
zero?: boolean;
|
|
888
926
|
};
|
|
927
|
+
/** A panel of the Overview tab: a block, or columns of blocks side by side */
|
|
928
|
+
export type OverviewPanel = OverviewBlock | {
|
|
929
|
+
kind: 'columns';
|
|
930
|
+
columns: OverviewBlock[][];
|
|
931
|
+
};
|
|
889
932
|
export interface OverviewLayout {
|
|
890
933
|
panels: OverviewPanel[];
|
|
891
934
|
}
|
|
@@ -893,11 +936,21 @@ export type OverviewScope = 'experiment' | 'script';
|
|
|
893
936
|
/** GET /jobs/<jr>/overview/layout */
|
|
894
937
|
export interface JobOverviewLayout {
|
|
895
938
|
layout: OverviewLayout;
|
|
896
|
-
/**
|
|
939
|
+
/** every layout the page can show, the one of the job first */
|
|
940
|
+
layouts: {
|
|
941
|
+
layout: OverviewLayout;
|
|
942
|
+
source: JobOverviewLayout['source'];
|
|
943
|
+
label: string | null;
|
|
944
|
+
}[];
|
|
945
|
+
/** the name its layout file gives it */
|
|
946
|
+
label: string | null;
|
|
947
|
+
/** where it comes from: saved for the experiment / script, a layout file, a plugin, the setting, the built-in one */
|
|
897
948
|
source: {
|
|
898
|
-
kind: OverviewScope | 'plugin' | 'setting' | 'default';
|
|
949
|
+
kind: OverviewScope | 'file' | 'plugin' | 'setting' | 'default';
|
|
899
950
|
name: string | null;
|
|
900
951
|
};
|
|
952
|
+
/** the charts of the built-in layout, to add to this one */
|
|
953
|
+
blocks: OverviewBlock[];
|
|
901
954
|
/** what a layout can be saved for */
|
|
902
955
|
keys: {
|
|
903
956
|
experiment: string | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { AgentTag } from '../types';
|
|
3
|
-
|
|
3
|
+
export declare const agentColor: (agent: string) => string;
|
|
4
|
+
/** Robot icon of what an agent submitted or started, colored per agent; its name and reason on hover */
|
|
4
5
|
export declare const AgentBadge: React.FC<{
|
|
5
6
|
tag?: AgentTag | null;
|
|
6
7
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export declare const formatSize: (bytes: number) => string;
|
|
2
3
|
/**
|
|
3
4
|
* The reports and other files of a job's results/ and output/ folders, delivered by the server:
|
|
4
5
|
* an HTML report opens in a new tab (its images and scripts load next to it), the rest downloads.
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* The Overview tab of a job: the panels of its layout (the log view, charts: GET
|
|
4
|
-
* /jobs/<jr>/overview/layout),
|
|
5
|
-
* runs/, results/) plotted with
|
|
6
|
-
* is shown with the rows URL as an Altair snippet, and can be added to the layout.
|
|
4
|
+
* /jobs/<jr>/overview/layout), or the "explore data" layout: the JSONL files of its artifact folders
|
|
5
|
+
* (output/, runs/, results/) plotted with a chart builder, whose charts can be added to the layout of the job.
|
|
7
6
|
*/
|
|
8
7
|
export declare const JobDataOverview: React.FC<{
|
|
9
8
|
jrJobId: string;
|
|
9
|
+
/** the job is running (or waiting): its data is followed */
|
|
10
|
+
live?: boolean;
|
|
10
11
|
}>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Card } from '@chakra-ui/react';
|
|
3
|
+
import type { AgentTag, PersitedJobInfo, SlurmJob } from '../types';
|
|
4
|
+
/** One row of the jobs table: a job in squeue, a job folder, or both (same jr job id) */
|
|
5
|
+
export interface JobRow {
|
|
6
|
+
key: string;
|
|
7
|
+
/** in squeue now: its state is live */
|
|
8
|
+
active: boolean;
|
|
9
|
+
/** has a job folder in the local cache (marks, groups, rerun) */
|
|
10
|
+
persisted: boolean;
|
|
11
|
+
jobId: string;
|
|
12
|
+
jrJobId: string | null;
|
|
13
|
+
name: string;
|
|
14
|
+
status: string;
|
|
15
|
+
cluster: string;
|
|
16
|
+
partition: string;
|
|
17
|
+
user: string;
|
|
18
|
+
timeLimit: string;
|
|
19
|
+
/** minutes, for sorting */
|
|
20
|
+
timeLimitMin: number | null;
|
|
21
|
+
agent?: AgentTag | null;
|
|
22
|
+
important: boolean;
|
|
23
|
+
groups: string[];
|
|
24
|
+
pipeline?: {
|
|
25
|
+
run_id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
} | null;
|
|
28
|
+
/** seconds since the job folder last changed */
|
|
29
|
+
freshness: number | null;
|
|
30
|
+
}
|
|
31
|
+
export declare const fromActive: (job: SlurmJob) => JobRow;
|
|
32
|
+
export declare const fromPersisted: (p: PersitedJobInfo) => JobRow;
|
|
33
|
+
/** One row per job: the squeue state wins, the job folder brings its marks, groups and pipeline */
|
|
34
|
+
export declare const mergeRows: (active: SlurmJob[], persisted: PersitedJobInfo[]) => JobRow[];
|
|
35
|
+
interface JobsTableProps {
|
|
36
|
+
title: string;
|
|
37
|
+
rows: JobRow[];
|
|
38
|
+
/** before the organizer filters: "3 of 12 jobs" */
|
|
39
|
+
total: number;
|
|
40
|
+
loading: boolean;
|
|
41
|
+
error?: {
|
|
42
|
+
message?: string;
|
|
43
|
+
} | null;
|
|
44
|
+
empty: string;
|
|
45
|
+
emptyHint: string;
|
|
46
|
+
/** caps the rows' height; without it they fill the card (give the card a height, e.g. flex: 1) */
|
|
47
|
+
maxH?: string;
|
|
48
|
+
onCancel: (jobId: string) => void;
|
|
49
|
+
onRerun: (jrJobId: string) => void;
|
|
50
|
+
onGroup: (group: string) => void;
|
|
51
|
+
/** quick filters (important, organizers), in the header next to the title */
|
|
52
|
+
quickFilters?: React.ReactNode;
|
|
53
|
+
}
|
|
54
|
+
export declare const JobsTable: React.FC<JobsTableProps & {
|
|
55
|
+
cardProps?: React.ComponentProps<typeof Card.Root>;
|
|
56
|
+
}>;
|
|
57
|
+
export {};
|
|
@@ -1,23 +1,49 @@
|
|
|
1
1
|
/** The panels of a job's Overview layout: the log view and the charts, and the bar saying where the layout comes from. */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { JobData, JobOverviewLayout,
|
|
4
|
-
|
|
3
|
+
import type { JobData, JobOverviewLayout, OverviewBlock, OverviewLayout } from '../types';
|
|
4
|
+
/** What can be done with a block of the layout; the moves are absent where they lead nowhere */
|
|
5
|
+
interface BlockActions {
|
|
6
|
+
editing: boolean;
|
|
7
|
+
onMove: (by: number) => void;
|
|
8
|
+
onRemove: () => void;
|
|
9
|
+
/** to the column on the left / right */
|
|
10
|
+
onShift?: (by: number) => void;
|
|
11
|
+
/** put the block in the first of two columns */
|
|
12
|
+
onSplit?: () => void;
|
|
13
|
+
onChange: (block: OverviewBlock) => void;
|
|
14
|
+
/** an editor of the block opens or closes */
|
|
15
|
+
onEditor: (open: boolean) => void;
|
|
16
|
+
}
|
|
17
|
+
type PanelProps<K extends OverviewBlock['kind']> = {
|
|
5
18
|
jrJobId: string;
|
|
6
19
|
files: JobData['files'];
|
|
7
|
-
panel: Extract<
|
|
20
|
+
panel: Extract<OverviewBlock, {
|
|
8
21
|
kind: K;
|
|
9
22
|
}>;
|
|
10
|
-
|
|
11
|
-
onMove: (by: number) => void;
|
|
12
|
-
onRemove: () => void;
|
|
23
|
+
actions: BlockActions;
|
|
13
24
|
};
|
|
14
|
-
/** The log view: the rows of role `log` (the `logging` records of the job) */
|
|
25
|
+
/** The log view: the rows of role `log` (the `logging` records of the job), and its events when asked */
|
|
15
26
|
export declare const LogPanel: React.FC<PanelProps<'logs'>>;
|
|
16
|
-
/**
|
|
27
|
+
/** The images, sounds and videos of the artifact folders (output/, results/, ...) */
|
|
28
|
+
export declare const ArtifactPanel: React.FC<PanelProps<'artifacts'>>;
|
|
29
|
+
/** The tree of the artifact folders (output/, results/, ...), its files to download */
|
|
30
|
+
export declare const FilesPanel: React.FC<PanelProps<'files'>>;
|
|
31
|
+
/** A table of the statistics of number fields, picked with its gear */
|
|
32
|
+
export declare const StatsPanel: React.FC<PanelProps<'stats'>>;
|
|
33
|
+
/** A chart of one or several events */
|
|
17
34
|
export declare const ChartPanel: React.FC<PanelProps<'chart'>>;
|
|
18
|
-
/**
|
|
35
|
+
/** The layout shown: the one of the job, or the built-in explorer of its data */
|
|
36
|
+
export type OverviewView = 'job' | 'explore';
|
|
37
|
+
type LayoutSource = JobOverviewLayout['source'];
|
|
38
|
+
export declare const layoutKeyOf: (source: LayoutSource) => string;
|
|
39
|
+
/** The choice of the layout, where it comes from, and the buttons to edit, save and reset it */
|
|
19
40
|
export declare const LayoutBar: React.FC<{
|
|
20
41
|
found: JobOverviewLayout;
|
|
42
|
+
/** where the layout shown comes from */
|
|
43
|
+
source: LayoutSource;
|
|
44
|
+
view: OverviewView;
|
|
45
|
+
/** `layout`: the key of the layout to show */
|
|
46
|
+
onView: (view: OverviewView, layout?: string) => void;
|
|
21
47
|
dirty: boolean;
|
|
22
48
|
editing: boolean;
|
|
23
49
|
saving: boolean;
|
|
@@ -31,7 +57,10 @@ export declare const LayoutPanels: React.FC<{
|
|
|
31
57
|
jrJobId: string;
|
|
32
58
|
files: JobData['files'];
|
|
33
59
|
layout: OverviewLayout;
|
|
60
|
+
/** the charts of the built-in layout */
|
|
61
|
+
available: OverviewBlock[];
|
|
34
62
|
editing: boolean;
|
|
35
63
|
onChange: (layout: OverviewLayout) => void;
|
|
64
|
+
onEditor: (open: boolean) => void;
|
|
36
65
|
}>;
|
|
37
66
|
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SettingsInfo } from '../types';
|
|
3
3
|
export declare const SETTINGS_KEY: string[];
|
|
4
|
+
/** jobs_merged: one table for the active and the persisted jobs on the Jobs page; saved at once */
|
|
5
|
+
export declare const DisplayCard: React.FC<{
|
|
6
|
+
info: SettingsInfo;
|
|
7
|
+
}>;
|
|
4
8
|
export declare const FoldersCard: React.FC<{
|
|
5
9
|
info: SettingsInfo;
|
|
6
10
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Charts of the JSONL data of a job: the chart builder, its Vega-Lite spec, and the chart itself. */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { JobData, JobDataField, JobDataRole,
|
|
3
|
+
import type { JobData, JobDataField, JobDataRole, OverviewBlock } from '../types';
|
|
4
4
|
/** Rows fetched for a chart (the server caps at 500k) */
|
|
5
5
|
export declare const ROW_LIMIT = 50000;
|
|
6
6
|
/** Fields every row has: the file it comes from */
|
|
@@ -9,7 +9,7 @@ export declare const MARKS: readonly ["point", "line", "bar", "tick", "boxplot",
|
|
|
9
9
|
export declare const AGGREGATES: readonly ["", "mean", "median", "sum", "min", "max", "count"];
|
|
10
10
|
/** Events listed first: the plotted ones (the server gives each event its role) */
|
|
11
11
|
export declare const ROLE_ORDER: Record<JobDataRole, number>;
|
|
12
|
-
/** The keys of a `bujang.
|
|
12
|
+
/** The keys of a `bujang.instrumentation` line around its data: never a category of a chart */
|
|
13
13
|
export declare const ENVELOPE_FIELDS: Set<string>;
|
|
14
14
|
export interface Builder {
|
|
15
15
|
mark: (typeof MARKS)[number];
|
|
@@ -42,15 +42,19 @@ export declare const VegaChart: React.FC<{
|
|
|
42
42
|
spec: Record<string, unknown>;
|
|
43
43
|
rows: Record<string, unknown>[];
|
|
44
44
|
}>;
|
|
45
|
-
/** The
|
|
45
|
+
/** The events of a panel (`event`: comma separated, "" for the records without event) */
|
|
46
|
+
export declare const panelEvents: (event?: string) => string[];
|
|
47
|
+
/** The files that have rows of `event` (comma separated events) */
|
|
46
48
|
export declare const filesWithEvent: (files: JobData["files"], event: string) => JobData["files"];
|
|
47
|
-
/** The fields of `event` in `files`, merged (counts added, ranges widened, values joined) */
|
|
49
|
+
/** The fields of `event` (comma separated events) in `files`, merged (counts added, ranges widened, values joined) */
|
|
48
50
|
export declare const mergeFields: (files: JobData["files"], event: string) => JobDataField[];
|
|
49
51
|
/** The files a panel reads (`files`: comma separated paths or globs, all when empty) */
|
|
50
|
-
export declare const panelFiles:
|
|
52
|
+
export declare const panelFiles: <T extends {
|
|
53
|
+
path: string;
|
|
54
|
+
}>(files: T[], patterns?: string) => T[];
|
|
51
55
|
/** A chart panel of a layout from the builder (only what differs from the defaults) */
|
|
52
|
-
export declare const panelOfBuilder: (b: Builder, event: string, title?: string) =>
|
|
56
|
+
export declare const panelOfBuilder: (b: Builder, event: string, title?: string) => OverviewBlock;
|
|
53
57
|
/** The builder of a chart panel; null when the panel gives no field (the page guesses them) */
|
|
54
|
-
export declare const builderOfPanel: (p: Extract<
|
|
58
|
+
export declare const builderOfPanel: (p: Extract<OverviewBlock, {
|
|
55
59
|
kind: "chart";
|
|
56
60
|
}>) => Builder | null;
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -95,6 +95,12 @@ export function getBujangApiConfig(): { apiBase: string; axios: BujangHttpClient
|
|
|
95
95
|
return { apiBase: currentBase, axios: currentInstance };
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/** The prefix of a URL the browser opens itself (a link, an image): apiBase after the baseURL of the axios instance, as axios joins them. */
|
|
99
|
+
const urlBase = (): string => {
|
|
100
|
+
const baseURL = (currentInstance as { defaults?: { baseURL?: string } }).defaults?.baseURL;
|
|
101
|
+
return baseURL && !/^([a-z][a-z\d+.-]*:)?\/\//i.test(currentBase) ? `${trimSlash(baseURL)}/${currentBase.replace(/^\/+/, '')}` : currentBase;
|
|
102
|
+
};
|
|
103
|
+
|
|
98
104
|
const api = {
|
|
99
105
|
get: <T = any>(path: string, config?: AxiosRequestConfig) => currentInstance.get<T>(currentBase + path, config),
|
|
100
106
|
post: <T = any>(path: string, data?: unknown, config?: AxiosRequestConfig) => currentInstance.post<T>(currentBase + path, data, config),
|
|
@@ -514,6 +520,7 @@ export const updateSettings = async (
|
|
|
514
520
|
values: Partial<
|
|
515
521
|
Record<'local_cache' | 'workdir' | 'database_url' | 'mcp_instructions', string | null> & {
|
|
516
522
|
show_examples: boolean;
|
|
523
|
+
jobs_merged: boolean;
|
|
517
524
|
overview_layout: OverviewLayout | null;
|
|
518
525
|
}
|
|
519
526
|
>,
|
|
@@ -534,7 +541,7 @@ export const getJobArtifacts = async (jrJobId: string): Promise<JobArtifacts> =>
|
|
|
534
541
|
|
|
535
542
|
/** URL of an artifact, to open in a tab: its relative links (images, scripts) resolve next to it. */
|
|
536
543
|
export const jobArtifactUrl = (jrJobId: string, path: string): string =>
|
|
537
|
-
`${
|
|
544
|
+
`${urlBase()}/jobs/${encodeURIComponent(jrJobId)}/artifacts/${path.split('/').map(encodeURIComponent).join('/')}`;
|
|
538
545
|
|
|
539
546
|
/** The layout of a job's Overview tab and where it comes from. */
|
|
540
547
|
export const getJobOverviewLayout = async (jrJobId: string): Promise<JobOverviewLayout> => {
|
|
@@ -603,7 +610,7 @@ export const getJobDataRows = async (jrJobId: string, query: JobDataRowsQuery):
|
|
|
603
610
|
|
|
604
611
|
/** URL of the rows of a job: a Vega-Lite / Altair data url (relative to the page when apiBase is). */
|
|
605
612
|
export const jobDataRowsUrl = (jrJobId: string, query: JobDataRowsQuery): string =>
|
|
606
|
-
`${
|
|
613
|
+
`${urlBase()}/jobs/${encodeURIComponent(jrJobId)}/data/rows?${rowsParams(query)}`;
|
|
607
614
|
|
|
608
615
|
/** When the job index was last synced with the clusters. */
|
|
609
616
|
export const getSyncStatus = async (): Promise<SyncStatus> => {
|
|
@@ -247,7 +247,7 @@ export const SshConnectDialog: React.FC<SshConnectDialogProps> = ({ open, onClos
|
|
|
247
247
|
<Dialog.Root open={open} onOpenChange={(d) => { if (!d.open) close(); }} size="lg">
|
|
248
248
|
<Dialog.Backdrop />
|
|
249
249
|
<Dialog.Positioner>
|
|
250
|
-
<Dialog.Content>
|
|
250
|
+
<Dialog.Content className="bujang-dialog">
|
|
251
251
|
<Dialog.Header>
|
|
252
252
|
<Dialog.Title>{cluster ? `Connect to ${cluster}` : 'Connect to the clusters'}</Dialog.Title>
|
|
253
253
|
<Dialog.CloseTrigger />
|
package/src/theme.css
CHANGED
|
@@ -70,3 +70,29 @@
|
|
|
70
70
|
--color-pipeline-par-bg: #1a202c;
|
|
71
71
|
--color-pipeline-par-border: #4a5568;
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Dialogs (Dialog.Content className="bujang-dialog"): Chakra paints them with its own
|
|
76
|
+
* neutral palette (bg.panel, border, fg...). Inside a bujang dialog, those Chakra
|
|
77
|
+
* tokens point at the bujang colours above, so the panel, its inputs, selects,
|
|
78
|
+
* tables and buttons match the cards of the pages. Only bujang dialogs change:
|
|
79
|
+
* a host's own dialogs keep its Chakra theme.
|
|
80
|
+
*/
|
|
81
|
+
:where(.bujang-dialog) {
|
|
82
|
+
--chakra-colors-bg: var(--color-bg-card);
|
|
83
|
+
--chakra-colors-bg-panel: var(--color-bg-card);
|
|
84
|
+
--chakra-colors-bg-subtle: var(--color-bg-header);
|
|
85
|
+
--chakra-colors-bg-muted: var(--color-bg-hover);
|
|
86
|
+
--chakra-colors-bg-emphasized: var(--color-bg-hover);
|
|
87
|
+
--chakra-colors-fg: var(--color-text);
|
|
88
|
+
--chakra-colors-fg-muted: var(--color-text-muted);
|
|
89
|
+
--chakra-colors-fg-subtle: var(--color-text-muted);
|
|
90
|
+
--chakra-colors-border: var(--color-input-border);
|
|
91
|
+
--chakra-colors-border-subtle: var(--color-border);
|
|
92
|
+
--chakra-colors-border-muted: var(--color-border);
|
|
93
|
+
--chakra-colors-border-emphasized: var(--color-input-border);
|
|
94
|
+
--chakra-colors-gray-subtle: var(--color-bg-hover);
|
|
95
|
+
--chakra-colors-gray-muted: var(--color-bg-hover);
|
|
96
|
+
color: var(--color-text);
|
|
97
|
+
border: 1px solid var(--color-border);
|
|
98
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface ApiError {
|
|
|
10
10
|
export interface SlurmJob {
|
|
11
11
|
job_id: string | null;
|
|
12
12
|
jr_job_id?: string | null;
|
|
13
|
+
/** The cluster whose squeue listed the job (GET /jobs) */
|
|
14
|
+
cluster?: string;
|
|
13
15
|
/** Submitted by an agent through the MCP server */
|
|
14
16
|
agent?: AgentTag | null;
|
|
15
17
|
created_at?: string;
|
|
@@ -260,6 +262,8 @@ export interface PersitedJobInfo {
|
|
|
260
262
|
important?: boolean;
|
|
261
263
|
/** The manual groups of the job (groups/<group>/<job id>) */
|
|
262
264
|
groups?: string[];
|
|
265
|
+
/** A step of a pipeline run: the run, and the saved pipeline it was started from (else the run's name) */
|
|
266
|
+
pipeline?: { run_id: string; name: string } | null;
|
|
263
267
|
}
|
|
264
268
|
|
|
265
269
|
/** GET/POST /jobs/<jr>/marks: whether a job is important, its groups, every group, git */
|
|
@@ -384,6 +388,8 @@ export interface PipelineRunSummary {
|
|
|
384
388
|
state?: PipelineRunState | null;
|
|
385
389
|
/** when `state` was read (epoch seconds) */
|
|
386
390
|
checked?: number | null;
|
|
391
|
+
/** Started by an agent through the MCP server */
|
|
392
|
+
agent?: AgentTag | null;
|
|
387
393
|
}
|
|
388
394
|
|
|
389
395
|
/** A step of a run with its current state (sacct/squeue state, HELD, or the ssh step state) */
|
|
@@ -410,6 +416,8 @@ export interface PipelineRunStatus {
|
|
|
410
416
|
log?: string;
|
|
411
417
|
/** the definition the run was started with (the saved pipeline may have changed since) */
|
|
412
418
|
definition?: PipelineNode | null;
|
|
419
|
+
/** Started by an agent through the MCP server */
|
|
420
|
+
agent?: AgentTag | null;
|
|
413
421
|
}
|
|
414
422
|
|
|
415
423
|
export interface PipelineSequential {
|
|
@@ -630,6 +638,8 @@ export type SettingsFieldName = 'local_cache' | 'workdir' | 'database_url';
|
|
|
630
638
|
|
|
631
639
|
export type SettingsFields = Record<SettingsFieldName, SettingsField> & {
|
|
632
640
|
show_examples: SettingsField<boolean>;
|
|
641
|
+
/** Jobs page: the active and the persisted jobs in one table (false: one table each). */
|
|
642
|
+
jobs_merged: SettingsField<boolean>;
|
|
633
643
|
/** What the MCP server tells the agents when they connect (null: general.mcp.default_instructions). */
|
|
634
644
|
mcp_instructions: SettingsField;
|
|
635
645
|
/** The default layout of the Overview tab (null: the built-in one). */
|
|
@@ -760,8 +770,19 @@ export interface SshPluginStatus {
|
|
|
760
770
|
values: Record<string, string>;
|
|
761
771
|
line: number | null;
|
|
762
772
|
duplicates: number;
|
|
763
|
-
/**
|
|
764
|
-
|
|
773
|
+
/** Placeholder values read in the user's own entries. */
|
|
774
|
+
inferred: Record<string, string>;
|
|
775
|
+
/** How each host merges with the user's entries. */
|
|
776
|
+
hosts: SshHostMerge[];
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/** Where the options of a host come from: the user's own entries win */
|
|
780
|
+
export interface SshHostMerge {
|
|
781
|
+
alias: string;
|
|
782
|
+
/** the alias of the user it is merged with (the same, or another one of the same machine), null: none */
|
|
783
|
+
source: string | null;
|
|
784
|
+
yours: Record<string, string>;
|
|
785
|
+
plugin: Record<string, string>;
|
|
765
786
|
}
|
|
766
787
|
|
|
767
788
|
export interface SshSettings {
|
|
@@ -791,6 +812,7 @@ export interface SshPlan {
|
|
|
791
812
|
messages: string[];
|
|
792
813
|
warnings: string[];
|
|
793
814
|
aliases: string[];
|
|
815
|
+
hosts: SshHostMerge[];
|
|
794
816
|
base: string;
|
|
795
817
|
// install / remove only
|
|
796
818
|
backup?: string | null;
|
|
@@ -916,12 +938,23 @@ export interface JobDataField {
|
|
|
916
938
|
values?: string[] | null;
|
|
917
939
|
}
|
|
918
940
|
|
|
919
|
-
/** A
|
|
920
|
-
export
|
|
941
|
+
/** A row of a stats block: a number field of an event */
|
|
942
|
+
export interface StatsMetric {
|
|
943
|
+
event: string;
|
|
944
|
+
field: string;
|
|
945
|
+
title?: string;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/** A block of the Overview tab: the log view, the media of the artifact folders, or a chart (Vega-Lite) of one or several events */
|
|
949
|
+
export type OverviewBlock =
|
|
950
|
+
| { kind: 'artifacts'; title?: string; files?: string }
|
|
951
|
+
| { kind: 'files'; title?: string }
|
|
952
|
+
| { kind: 'stats'; title?: string; metrics?: StatsMetric[] }
|
|
921
953
|
| { kind: 'logs'; title?: string; levels?: string[]; files?: string }
|
|
922
954
|
| {
|
|
923
955
|
kind: 'chart';
|
|
924
956
|
title?: string;
|
|
957
|
+
/** comma separated events; the rows have theirs as `type` */
|
|
925
958
|
event?: string;
|
|
926
959
|
/** comma separated paths or globs, relative to the job folder */
|
|
927
960
|
files?: string;
|
|
@@ -939,6 +972,9 @@ export type OverviewPanel =
|
|
|
939
972
|
zero?: boolean;
|
|
940
973
|
};
|
|
941
974
|
|
|
975
|
+
/** A panel of the Overview tab: a block, or columns of blocks side by side */
|
|
976
|
+
export type OverviewPanel = OverviewBlock | { kind: 'columns'; columns: OverviewBlock[][] };
|
|
977
|
+
|
|
942
978
|
export interface OverviewLayout {
|
|
943
979
|
panels: OverviewPanel[];
|
|
944
980
|
}
|
|
@@ -948,8 +984,14 @@ export type OverviewScope = 'experiment' | 'script';
|
|
|
948
984
|
/** GET /jobs/<jr>/overview/layout */
|
|
949
985
|
export interface JobOverviewLayout {
|
|
950
986
|
layout: OverviewLayout;
|
|
951
|
-
/**
|
|
952
|
-
|
|
987
|
+
/** every layout the page can show, the one of the job first */
|
|
988
|
+
layouts: { layout: OverviewLayout; source: JobOverviewLayout['source']; label: string | null }[];
|
|
989
|
+
/** the name its layout file gives it */
|
|
990
|
+
label: string | null;
|
|
991
|
+
/** where it comes from: saved for the experiment / script, a layout file, a plugin, the setting, the built-in one */
|
|
992
|
+
source: { kind: OverviewScope | 'file' | 'plugin' | 'setting' | 'default'; name: string | null };
|
|
993
|
+
/** the charts of the built-in layout, to add to this one */
|
|
994
|
+
blocks: OverviewBlock[];
|
|
953
995
|
/** what a layout can be saved for */
|
|
954
996
|
keys: { experiment: string | null; script: string };
|
|
955
997
|
}
|
|
@@ -49,16 +49,25 @@ function jobLink(paths: BujangPaths, jrJobId: string, jobId?: unknown) {
|
|
|
49
49
|
return paths.jobDetails(String(jobId || 0), jrJobId);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
// one color per agent name, the same on every page
|
|
53
|
+
const AGENT_COLORS = ['purple', 'blue', 'teal', 'orange', 'pink', 'cyan', 'green', 'red', 'yellow'];
|
|
54
|
+
|
|
55
|
+
export const agentColor = (agent: string): string => {
|
|
56
|
+
let hash = 0;
|
|
57
|
+
for (const c of agent) hash = (hash * 31 + c.charCodeAt(0)) | 0;
|
|
58
|
+
return `${AGENT_COLORS[Math.abs(hash) % AGENT_COLORS.length]}.500`;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/** Robot icon of what an agent submitted or started, colored per agent; its name and reason on hover */
|
|
53
62
|
export const AgentBadge: React.FC<{ tag?: AgentTag | null }> = ({ tag }) => {
|
|
54
63
|
const paths = useBujangPaths();
|
|
55
64
|
if (!tag) return null;
|
|
56
65
|
return (
|
|
57
66
|
<Tooltip content={tag.reason ? `${tag.agent}: ${tag.reason}` : tag.agent} showArrow>
|
|
58
|
-
<RouterLink to={paths.agent(tag.session)}>
|
|
59
|
-
<
|
|
60
|
-
<LuBot />
|
|
61
|
-
</
|
|
67
|
+
<RouterLink to={paths.agent(tag.session)} aria-label={`Started by ${tag.agent}`} onClick={(e) => e.stopPropagation()}>
|
|
68
|
+
<Box as="span" display="inline-flex" verticalAlign="middle" color={agentColor(tag.agent)}>
|
|
69
|
+
<LuBot />
|
|
70
|
+
</Box>
|
|
62
71
|
</RouterLink>
|
|
63
72
|
</Tooltip>
|
|
64
73
|
);
|