@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/types.d.ts CHANGED
@@ -113,6 +113,8 @@ export interface SlurmJobsResponse {
113
113
  export interface SlurmJobSubmitRequest {
114
114
  script: string;
115
115
  job_name?: string;
116
+ /** the template the script came from (meta/template.txt: the script of the Overview layouts) */
117
+ template?: string;
116
118
  sbatch_args?: string[];
117
119
  script_args?: Record<string, string>;
118
120
  partition?: string;
@@ -128,7 +130,7 @@ export interface SlurmJobSubmitRequest {
128
130
  nodelist?: string;
129
131
  dependency?: [string, string][];
130
132
  }
131
- /** A file attached to a submission: lands in <job folder>/input/<name> ($JR_INPUT_DIR). */
133
+ /** A file attached to a submission: lands in <job folder>/input/<name> ($BUJANG_INPUT_DIR). */
132
134
  export interface JobAttachment {
133
135
  /** Relative path, sub folders allowed (data/train.csv). */
134
136
  name: string;
@@ -223,7 +225,7 @@ export interface SlurmJobAccounting {
223
225
  }
224
226
  export interface PersitedJobInfo {
225
227
  name: string;
226
- /** JR_JOB_LABEL of the script (or the label given at submission), resolved: meta/label.txt */
228
+ /** BUJANG_JOB_LABEL of the script (or the label given at submission), resolved: meta/label.txt */
227
229
  label?: string | null;
228
230
  cluster?: string;
229
231
  creation_time: string;
@@ -307,7 +309,7 @@ export interface PipelineJob {
307
309
  profile: string;
308
310
  env?: Record<string, string>;
309
311
  proxy?: boolean;
310
- /** label template ("train lr={LR}"): names the job, wins over its group's and the script's JR_JOB_LABEL */
312
+ /** label template ("train lr={LR}"): names the job, wins over its group's and the script's BUJANG_JOB_LABEL */
311
313
  label?: string;
312
314
  job_id?: string;
313
315
  slurm_jobid?: string;
@@ -325,15 +327,23 @@ export interface PipelineRunResponse {
325
327
  }
326
328
  /** submitting: the jobs are being submitted; failed: the submission failed (nothing runs) */
327
329
  export type PipelineSubmissionStatus = 'submitting' | 'submitted' | 'failed';
330
+ /** State of the jobs of a submitted run */
331
+ export type PipelineRunState = 'running' | 'failing' | 'failed' | 'completed' | 'unknown';
328
332
  /** A pipeline run in the list of runs */
329
333
  export interface PipelineRunSummary {
330
334
  run_id: string;
331
335
  name: string;
332
336
  /** the saved pipeline it was started from; runs older than this field have none */
333
337
  template?: string | null;
338
+ /** the clusters its steps ran on */
339
+ clusters?: string[];
334
340
  started: number;
335
341
  status: PipelineSubmissionStatus;
336
342
  error?: string | null;
343
+ /** last known state of its jobs (saved each time its progress is read), null when never read */
344
+ state?: PipelineRunState | null;
345
+ /** when `state` was read (epoch seconds) */
346
+ checked?: number | null;
337
347
  }
338
348
  /** A step of a run with its current state (sacct/squeue state, HELD, or the ssh step state) */
339
349
  export interface PipelineRunStep extends PipelineJob {
@@ -352,7 +362,7 @@ export interface PipelineRunStatus {
352
362
  name?: string | null;
353
363
  status: PipelineSubmissionStatus;
354
364
  error?: string | null;
355
- state?: 'running' | 'failing' | 'failed' | 'completed' | 'unknown';
365
+ state?: PipelineRunState;
356
366
  steps?: PipelineRunStep[];
357
367
  log?: string;
358
368
  /** the definition the run was started with (the saved pipeline may have changed since) */
@@ -522,12 +532,12 @@ export interface SettingsOrigin {
522
532
  name: string;
523
533
  path: string | null;
524
534
  }
525
- /** One editable field of the user file (local_cache, workdir, database_url). */
526
- export interface SettingsField {
535
+ /** One editable field of the user file (local_cache, workdir, database_url, show_examples). */
536
+ export interface SettingsField<T = string> {
527
537
  /** Value the running server uses (database_url: password masked). */
528
- value: string | null;
538
+ value: T | null;
529
539
  /** Value in the user file, null when absent. */
530
- file: string | null;
540
+ file: T | null;
531
541
  origin: SettingsOrigin;
532
542
  /** Name of the BUJANG_* variable when it is set (it wins over the file). */
533
543
  env: string | null;
@@ -541,6 +551,13 @@ export interface SettingsField {
541
551
  reason: string | null;
542
552
  }
543
553
  export type SettingsFieldName = 'local_cache' | 'workdir' | 'database_url';
554
+ export type SettingsFields = Record<SettingsFieldName, SettingsField> & {
555
+ show_examples: SettingsField<boolean>;
556
+ /** What the MCP server tells the agents when they connect (null: general.mcp.default_instructions). */
557
+ mcp_instructions: SettingsField;
558
+ /** The default layout of the Overview tab (null: the built-in one). */
559
+ overview_layout: SettingsField<OverviewLayout>;
560
+ };
544
561
  export interface SettingsCluster {
545
562
  name: string;
546
563
  ssh: string;
@@ -589,6 +606,8 @@ export interface SettingsMcp {
589
606
  url: string | null;
590
607
  /** Turned off (--no-mcp). */
591
608
  disabled: boolean;
609
+ /** The instructions sent to the agents when mcp_instructions is empty. */
610
+ default_instructions: string;
592
611
  }
593
612
  export interface SettingsGeneral {
594
613
  version: string;
@@ -620,7 +639,7 @@ export interface SettingsInfo {
620
639
  user_config_dir: string | null;
621
640
  error: string | null;
622
641
  };
623
- fields: Record<SettingsFieldName, SettingsField>;
642
+ fields: SettingsFields;
624
643
  secrets_file: string;
625
644
  clusters: SettingsCluster[];
626
645
  sources: {
@@ -842,6 +861,58 @@ export interface JobDataField {
842
861
  /** distinct values of a string field, null when there are too many */
843
862
  values?: string[] | null;
844
863
  }
864
+ /** A panel of the Overview tab: the log view, or a chart of an event */
865
+ export type OverviewPanel = {
866
+ kind: 'logs';
867
+ title?: string;
868
+ levels?: string[];
869
+ files?: string;
870
+ } | {
871
+ kind: 'chart';
872
+ title?: string;
873
+ event?: string;
874
+ /** comma separated paths or globs, relative to the job folder */
875
+ files?: string;
876
+ /** Vega-Lite, its data the named dataset "rows"; else the builder fields below; neither: guessed */
877
+ spec?: Record<string, unknown>;
878
+ mark?: string;
879
+ x?: string;
880
+ y?: string;
881
+ aggregate?: string;
882
+ color?: string;
883
+ column?: string;
884
+ row?: string;
885
+ log_x?: boolean;
886
+ log_y?: boolean;
887
+ zero?: boolean;
888
+ };
889
+ export interface OverviewLayout {
890
+ panels: OverviewPanel[];
891
+ }
892
+ export type OverviewScope = 'experiment' | 'script';
893
+ /** GET /jobs/<jr>/overview/layout */
894
+ export interface JobOverviewLayout {
895
+ layout: OverviewLayout;
896
+ /** where it comes from: saved for the experiment / script, a plugin, the setting, the built-in one */
897
+ source: {
898
+ kind: OverviewScope | 'plugin' | 'setting' | 'default';
899
+ name: string | null;
900
+ };
901
+ /** what a layout can be saved for */
902
+ keys: {
903
+ experiment: string | null;
904
+ script: string;
905
+ };
906
+ }
907
+ /** GET /overview/layouts */
908
+ export interface SavedOverviewLayout {
909
+ scope: OverviewScope;
910
+ key: string;
911
+ layout: OverviewLayout;
912
+ updated: number | null;
913
+ }
914
+ /** What an event of a JSONL file is for: plotted, shown in the log view, or neither */
915
+ export type JobDataRole = 'metric' | 'log' | 'other';
845
916
  /** GET /jobs/<jr>/data: the JSONL files of the artifact folders of a job and their schema */
846
917
  export interface JobData {
847
918
  jr_job_id: string;
@@ -851,9 +922,12 @@ export interface JobData {
851
922
  size?: number;
852
923
  mtime?: number;
853
924
  rows?: number;
854
- /** per event ("" for the records without an event envelope), its row count and fields */
925
+ /** the JSONL processor that read the file ("generic", or one of a plugin) */
926
+ processor?: string;
927
+ /** per event ("" for the records without an event envelope), its role, row count and fields */
855
928
  events?: {
856
929
  event: string;
930
+ role: JobDataRole;
857
931
  count: number;
858
932
  truncated: boolean;
859
933
  fields: JobDataField[];
@@ -862,6 +936,23 @@ export interface JobData {
862
936
  }[];
863
937
  truncated: boolean;
864
938
  }
939
+ /** GET /job/environment: what a job of a cluster finds in its environment */
940
+ export interface JobEnvironment {
941
+ cluster: string;
942
+ /** an example job id: the prefix is the job name, the suffix is drawn at submission */
943
+ job_id: string;
944
+ remote_folder: string;
945
+ variables: {
946
+ name: string;
947
+ /** resolved for this cluster and name; null when it does not apply (no label, not a pipeline step) */
948
+ value: string | null;
949
+ /** when the value is known: at submission, when the job runs, or for pipeline steps only */
950
+ known: 'submission' | 'run' | 'pipeline';
951
+ description: string;
952
+ }[];
953
+ /** the job folder, one line each (a text tree) */
954
+ tree: string[];
955
+ }
865
956
  /** GET /sync: when the job index was last synced with the clusters (POST /sync adds `synced`) */
866
957
  export interface SyncStatus {
867
958
  /** unix time of the last background sync, null before the first one */
@@ -871,6 +962,10 @@ export interface SyncStatus {
871
962
  /** seconds between two background syncs, null when the server does not run them */
872
963
  interval: number | null;
873
964
  jobs: number;
965
+ /** unix time of the soonest next round of the background sync (a cluster), null when none is planned */
966
+ next?: number | null;
967
+ /** the clusters being synced now */
968
+ running?: string[];
874
969
  /** per cluster: true synced, false failed, 'recent': not asked, a full rsync ran less than min_refresh_interval ago */
875
970
  synced?: Record<string, boolean | 'recent'>;
876
971
  skipped?: string;
@@ -933,12 +1028,18 @@ export interface JanitorQueueTicket {
933
1028
  started: number | null;
934
1029
  expires: number;
935
1030
  }
1031
+ /** A periodic task (state.db `periodic`): sync:<cluster>, book_keeping:<cluster>, reindex, ... */
936
1032
  export interface JanitorPeriodic {
937
- /** APScheduler job id, null when only its history is known */
938
- id: string | null;
1033
+ id: string;
939
1034
  name: string;
1035
+ cluster: string | null;
1036
+ /** seconds between two runs, null: runs when asked (the scheduled-job checker) */
940
1037
  interval: number | null;
1038
+ /** unix time of the next run (a request makes it sooner), null when none is planned */
941
1039
  next_run: number | null;
1040
+ /** a run was asked for (Refresh, a slow rsync) and has not started yet */
1041
+ requested: number | null;
1042
+ running: boolean;
942
1043
  last: JanitorRun | null;
943
1044
  }
944
1045
  export interface JanitorOverview {
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  /**
3
- * The Overview tab of a job: the JSONL files of its artifact folders (output/, runs/, results/)
4
- * plotted with Vega-Lite. A builder writes the spec; the spec can be edited by hand, and is shown
5
- * with the rows URL as an Altair snippet.
3
+ * The Overview tab of a job: the panels of its layout (the log view, charts: GET
4
+ * /jobs/<jr>/overview/layout), then an explorer of the JSONL files of its artifact folders (output/,
5
+ * runs/, results/) plotted with Vega-Lite. Its builder writes the spec; the spec can be edited by hand,
6
+ * is shown with the rows URL as an Altair snippet, and can be added to the layout.
6
7
  */
7
8
  export declare const JobDataOverview: React.FC<{
8
9
  jrJobId: string;
@@ -0,0 +1,37 @@
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
+ import React from 'react';
3
+ import type { JobData, JobOverviewLayout, OverviewLayout, OverviewPanel } from '../types';
4
+ type PanelProps<K extends OverviewPanel['kind']> = {
5
+ jrJobId: string;
6
+ files: JobData['files'];
7
+ panel: Extract<OverviewPanel, {
8
+ kind: K;
9
+ }>;
10
+ editing: boolean;
11
+ onMove: (by: number) => void;
12
+ onRemove: () => void;
13
+ };
14
+ /** The log view: the rows of role `log` (the `logging` records of the job) */
15
+ export declare const LogPanel: React.FC<PanelProps<'logs'>>;
16
+ /** A chart of an event: the panel's Vega-Lite spec, else its builder fields, else guessed ones */
17
+ export declare const ChartPanel: React.FC<PanelProps<'chart'>>;
18
+ /** Where the layout comes from, and the buttons to edit, save and reset it */
19
+ export declare const LayoutBar: React.FC<{
20
+ found: JobOverviewLayout;
21
+ dirty: boolean;
22
+ editing: boolean;
23
+ saving: boolean;
24
+ onEdit: (on: boolean) => void;
25
+ onSave: (target: 'experiment' | 'script' | 'default') => void;
26
+ onDiscard: () => void;
27
+ onReset: () => void;
28
+ }>;
29
+ /** The panels of a layout */
30
+ export declare const LayoutPanels: React.FC<{
31
+ jrJobId: string;
32
+ files: JobData['files'];
33
+ layout: OverviewLayout;
34
+ editing: boolean;
35
+ onChange: (layout: OverviewLayout) => void;
36
+ }>;
37
+ export {};
@@ -13,6 +13,10 @@ export interface PipelineTemplateFileData {
13
13
  pipelineName?: string;
14
14
  rootNode?: unknown;
15
15
  }
16
+ export declare const profileKey: (profile?: SlurmProfile) => string;
17
+ export declare const profileLabel: (p: SlurmProfile) => string;
18
+ type NodeType = PipelineNode['type'];
19
+ export declare const TYPE_COLOR: Record<NodeType, string>;
16
20
  /** The pipeline editor: a compact tree on the left, the selected step on the right */
17
21
  export declare const PipelineBuilder: React.FC<{
18
22
  isOpen: boolean;
@@ -22,3 +26,4 @@ export declare const PipelineBuilder: React.FC<{
22
26
  loadedTemplateData?: PipelineTemplateFileData | null;
23
27
  onSaveTemplate: (data: PipelineTemplatePayload) => void;
24
28
  }>;
29
+ export {};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- /** /pipelines: the saved pipelines */
2
+ /** /pipelines: the saved pipelines, most recently run first */
3
3
  export declare const PipelinesView: React.FC;
4
4
  /** /pipelines/:pipelineName: the graph of a pipeline, Run, the run shown (?run=, else the latest) and its runs */
5
5
  export declare const PipelineDetailsView: React.FC;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Schedule: the job of the submit page as a scheduled job (a name and a cron expression). The
3
+ * submit page builds the request (script, Slurm settings) and closes the dialog once it is saved.
4
+ */
5
+ import React from 'react';
6
+ interface ScheduleDialogProps {
7
+ onClose: () => void;
8
+ onSave: (name: string, cron: string) => void;
9
+ isSaving: boolean;
10
+ /** default name: the template or job name */
11
+ baseName: string;
12
+ }
13
+ declare const ScheduleDialog: React.FC<ScheduleDialogProps>;
14
+ export default ScheduleDialog;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Sweep: turn the job of the submit page into a pipeline, one step per combination of argument values.
3
+ *
4
+ * Saving writes three files, all named after the sweep: the script as a template (`<name>.sh`, in the
5
+ * cluster's folder), the Slurm settings of the form as a profile (`<cluster>/<name>`), and the pipeline
6
+ * (`<name>`): jobs that run that script with that profile, the swept values in their `env`. The
7
+ * arguments are in numbered steps (1 by default) that run in that order (step 0 PREPARE=1, then step 1
8
+ * sweeping LR and BATCH_SIZE), each step's jobs in parallel or in sequence. Each job can take another profile of
9
+ * the cluster (the pipeline, on the left of the form). "Save & run" also starts it and opens the run.
10
+ */
11
+ import React from 'react';
12
+ import type { SlurmProfile } from '../types';
13
+ export type SweepMode = 'grid' | 'zip';
14
+ /** "0.1, 0.01 ,0.001" -> ["0.1", "0.01", "0.001"] */
15
+ export declare function parseValues(text: string): string[];
16
+ /**
17
+ * The env of every job. grid: every combination; zip: the i-th value of each argument together (an
18
+ * argument with one value goes with all of them). The arguments with one value are in every env too.
19
+ */
20
+ export declare function sweepEnvs(values: Record<string, string[]>, mode: SweepMode): Record<string, string>[] | string;
21
+ /** A step of the sweep: the jobs of its arguments, run side by side or one after the other */
22
+ export interface SweepStep {
23
+ /** its number: the steps run in the order of their numbers */
24
+ step: number;
25
+ /** the arguments put in this step */
26
+ own: string[];
27
+ /** the arguments with several values in this step: they name its jobs */
28
+ swept: string[];
29
+ envs: Record<string, string>[];
30
+ }
31
+ export declare function sweepSteps(values: Record<string, string[]>, stepOf: Record<string, number>, elsewhere: Record<string, string>, mode: SweepMode): SweepStep[] | string;
32
+ interface SweepDialogProps {
33
+ isOpen: boolean;
34
+ onClose: () => void;
35
+ cluster: string;
36
+ /** what the submit page would submit, read when the sweep is saved */
37
+ getScript: () => string;
38
+ getSbatchArgs: () => string[];
39
+ /** the profile picked on the submit page, if any: the jobs use it when the form still has its settings */
40
+ profile?: SlurmProfile;
41
+ /** the arguments as the form shows them now (name -> value) */
42
+ args: Record<string, string>;
43
+ /** default name: the template or job name */
44
+ baseName: string;
45
+ /** files attached on the submit page: a pipeline does not carry them */
46
+ attachmentCount: number;
47
+ /** runs `go` once the cluster has an ssh connection (the login dialog of the submit page, MFA) */
48
+ ensureConnected: (cluster: string, go: () => void) => Promise<void>;
49
+ }
50
+ declare const SweepDialog: React.FC<SweepDialogProps>;
51
+ export default SweepDialog;
@@ -0,0 +1,56 @@
1
+ /** Charts of the JSONL data of a job: the chart builder, its Vega-Lite spec, and the chart itself. */
2
+ import React from 'react';
3
+ import type { JobData, JobDataField, JobDataRole, OverviewPanel } from '../types';
4
+ /** Rows fetched for a chart (the server caps at 500k) */
5
+ export declare const ROW_LIMIT = 50000;
6
+ /** Fields every row has: the file it comes from */
7
+ export declare const FILE_FIELDS: JobDataField[];
8
+ export declare const MARKS: readonly ["point", "line", "bar", "tick", "boxplot", "area", "rect"];
9
+ export declare const AGGREGATES: readonly ["", "mean", "median", "sum", "min", "max", "count"];
10
+ /** Events listed first: the plotted ones (the server gives each event its role) */
11
+ export declare const ROLE_ORDER: Record<JobDataRole, number>;
12
+ /** The keys of a `bujang.logs` line around its data: never a category of a chart */
13
+ export declare const ENVELOPE_FIELDS: Set<string>;
14
+ export interface Builder {
15
+ mark: (typeof MARKS)[number];
16
+ x: string;
17
+ y: string;
18
+ yAggregate: (typeof AGGREGATES)[number];
19
+ color: string;
20
+ column: string;
21
+ row: string;
22
+ logX: boolean;
23
+ logY: boolean;
24
+ /** the number scales start at 0 (always for bar / area, whose length means something) */
25
+ zero: boolean;
26
+ }
27
+ export declare const EMPTY_BUILDER: Builder;
28
+ export declare const vlType: (field?: JobDataField) => "quantitative" | "nominal";
29
+ /** A number field holding unix seconds (time, timestamp): shown as dates */
30
+ export declare const isUnixSeconds: (field?: JobDataField) => boolean;
31
+ /** datum["a"]["b"] of a dotted field, for a Vega expression */
32
+ export declare const datumOf: (name: string) => string;
33
+ /** Vega-Lite spec of the builder; the rows are the named dataset "rows" */
34
+ export declare const buildSpec: (b: Builder, fields: Map<string, JobDataField>) => Record<string, unknown>;
35
+ /** Defaults for a set of fields: a category (else a step / epoch, else time) on x, a measure on y, the file as color */
36
+ export declare const guessBuilder: (fields: JobDataField[], multipleFiles: boolean) => Builder;
37
+ /** The fields a spec reads (to fetch only those): every `field` of it */
38
+ export declare const specFields: (spec: unknown, out?: Set<string>) => Set<string>;
39
+ export declare const isDarkPage: () => boolean;
40
+ /** A Vega-Lite spec rendered with vega-embed (loaded on first use), `rows` as the dataset "rows" */
41
+ export declare const VegaChart: React.FC<{
42
+ spec: Record<string, unknown>;
43
+ rows: Record<string, unknown>[];
44
+ }>;
45
+ /** The files that have rows of `event` */
46
+ 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) */
48
+ export declare const mergeFields: (files: JobData["files"], event: string) => JobDataField[];
49
+ /** The files a panel reads (`files`: comma separated paths or globs, all when empty) */
50
+ export declare const panelFiles: (files: JobData["files"], patterns?: string) => JobData["files"];
51
+ /** 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) => OverviewPanel;
53
+ /** The builder of a chart panel; null when the panel gives no field (the page guesses them) */
54
+ export declare const builderOfPanel: (p: Extract<OverviewPanel, {
55
+ kind: "chart";
56
+ }>) => Builder | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milabench/bujang",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/api.ts CHANGED
@@ -32,8 +32,14 @@ import type {
32
32
  UpdateCheck,
33
33
  OrganizerGroups,
34
34
  SyncStatus,
35
+ JobEnvironment,
35
36
  JobArtifacts,
36
37
  JobData,
38
+ JobDataRole,
39
+ JobOverviewLayout,
40
+ OverviewLayout,
41
+ OverviewScope,
42
+ SavedOverviewLayout,
37
43
  JobMarks,
38
44
  UpdateResult,
39
45
  SettingsSecrets,
@@ -333,6 +339,14 @@ export interface SlurmCluster {
333
339
  proxy?: boolean;
334
340
  }
335
341
 
342
+ /** The variables bujang sets in a job of `cluster`, resolved for a job named `name` (label or job name). */
343
+ export const getJobEnvironment = async (cluster: string, name?: string): Promise<JobEnvironment> => {
344
+ try {
345
+ const response = await api.get('/job/environment', { params: { cluster, name: name || undefined } });
346
+ return response.data;
347
+ } catch (error) { return handleError(error); }
348
+ };
349
+
336
350
  export const getSlurmClusters = async (): Promise<SlurmCluster[]> => {
337
351
  try {
338
352
  const response = await api.get('/clusters');
@@ -361,7 +375,7 @@ export const saveSlurmProfile = async (request: {
361
375
  export const submitSlurmJob = async (request: {
362
376
  script: string;
363
377
  job_name?: string;
364
- /** label template ("train lr={LR}"), else the script's JR_JOB_LABEL */
378
+ /** label template ("train lr={LR}"), else the script's BUJANG_JOB_LABEL */
365
379
  label?: string;
366
380
  cluster?: string;
367
381
  sbatch_args?: string[];
@@ -379,7 +393,7 @@ export const submitSlurmJob = async (request: {
379
393
  export?: string;
380
394
  nodelist?: string;
381
395
  dependency?: [string, string][];
382
- /** Files for the job: <job folder>/input/<name> on the cluster before it starts ($JR_INPUT_DIR). */
396
+ /** Files for the job: <job folder>/input/<name> on the cluster before it starts ($BUJANG_INPUT_DIR). */
383
397
  files?: JobAttachment[];
384
398
  }): Promise<SlurmJobSubmitResponse> => {
385
399
  try {
@@ -495,9 +509,14 @@ export const getSettings = async (): Promise<SettingsInfo> => {
495
509
  } catch (error) { return handleError(error); }
496
510
  };
497
511
 
498
- /** Write local_cache / workdir / database_url (null: remove it) to the user file. */
512
+ /** Write local_cache / workdir / database_url / show_examples (null: remove it) to the user file. */
499
513
  export const updateSettings = async (
500
- values: Partial<Record<'local_cache' | 'workdir' | 'database_url', string | null>>,
514
+ values: Partial<
515
+ Record<'local_cache' | 'workdir' | 'database_url' | 'mcp_instructions', string | null> & {
516
+ show_examples: boolean;
517
+ overview_layout: OverviewLayout | null;
518
+ }
519
+ >,
501
520
  ): Promise<SettingsUpdateResponse> => {
502
521
  try {
503
522
  const response = await api.put('/settings', values);
@@ -517,6 +536,32 @@ export const getJobArtifacts = async (jrJobId: string): Promise<JobArtifacts> =>
517
536
  export const jobArtifactUrl = (jrJobId: string, path: string): string =>
518
537
  `${currentBase}/jobs/${encodeURIComponent(jrJobId)}/artifacts/${path.split('/').map(encodeURIComponent).join('/')}`;
519
538
 
539
+ /** The layout of a job's Overview tab and where it comes from. */
540
+ export const getJobOverviewLayout = async (jrJobId: string): Promise<JobOverviewLayout> => {
541
+ try {
542
+ const response = await api.get(`/jobs/${encodeURIComponent(jrJobId)}/overview/layout`, { timeout: 60000 });
543
+ return response.data;
544
+ } catch (error) { return handleError(error); }
545
+ };
546
+
547
+ /** The Overview layouts saved for an experiment or a script. */
548
+ export const getOverviewLayouts = async (): Promise<SavedOverviewLayout[]> => {
549
+ try {
550
+ const response = await api.get('/overview/layouts');
551
+ return response.data;
552
+ } catch (error) { return handleError(error); }
553
+ };
554
+
555
+ /** Save the Overview layout of an experiment or a script; null removes it. */
556
+ export const saveOverviewLayout = async (
557
+ scope: OverviewScope, key: string, layout: OverviewLayout | null,
558
+ ): Promise<{ success: boolean; scope: OverviewScope; key: string; removed: boolean }> => {
559
+ try {
560
+ const response = await api.post('/overview/layouts', { scope, key, layout });
561
+ return response.data;
562
+ } catch (error) { return handleError(error); }
563
+ };
564
+
520
565
  /** The JSONL files of the artifact folders of a job, with their events and fields (cached server side). */
521
566
  export const getJobData = async (jrJobId: string): Promise<JobData> => {
522
567
  try {
@@ -529,6 +574,8 @@ export const getJobData = async (jrJobId: string): Promise<JobData> => {
529
574
  export interface JobDataRowsQuery {
530
575
  files?: string[];
531
576
  events?: string[];
577
+ /** only the rows of these roles ('log': the log view) */
578
+ roles?: JobDataRole[];
532
579
  fields?: string[];
533
580
  /** only the rows having these fields */
534
581
  require?: string[];
@@ -539,6 +586,7 @@ const rowsParams = (query: JobDataRowsQuery): URLSearchParams => {
539
586
  const params = new URLSearchParams();
540
587
  if (query.files?.length) params.set('files', query.files.join(','));
541
588
  if (query.events?.length) params.set('event', query.events.join(','));
589
+ if (query.roles?.length) params.set('role', query.roles.join(','));
542
590
  if (query.fields?.length) params.set('fields', query.fields.join(','));
543
591
  if (query.require?.length) params.set('require', query.require.join(','));
544
592
  if (query.limit) params.set('limit', String(query.limit));
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;