@milabench/bujang 0.1.18 → 0.1.20

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.
Files changed (41) hide show
  1. package/README.md +16 -0
  2. package/dist/api.d.ts +46 -4
  3. package/dist/components/OrganizerNav.d.ts +28 -0
  4. package/dist/components/ProjectsNav.d.ts +15 -0
  5. package/dist/index.d.ts +11 -2
  6. package/dist/index.js +6344 -4777
  7. package/dist/index.js.map +1 -1
  8. package/dist/paths.d.ts +27 -3
  9. package/dist/routes.d.ts +7 -2
  10. package/dist/types.d.ts +118 -4
  11. package/dist/views/CollectionView.d.ts +22 -0
  12. package/dist/views/JobDataOverview.d.ts +1 -1
  13. package/dist/views/JobsTable.d.ts +1 -0
  14. package/dist/views/JobsView.d.ts +12 -1
  15. package/dist/views/OrganizerValuesView.d.ts +13 -0
  16. package/dist/views/OverviewPanels.d.ts +13 -2
  17. package/dist/views/ProjectDetailsView.d.ts +3 -0
  18. package/dist/views/ProjectsView.d.ts +20 -0
  19. package/dist/views/dataCharts.d.ts +1 -1
  20. package/package.json +1 -1
  21. package/src/api.ts +90 -8
  22. package/src/components/OrganizerNav.tsx +121 -0
  23. package/src/components/ProjectsNav.tsx +101 -0
  24. package/src/index.ts +11 -2
  25. package/src/paths.ts +50 -3
  26. package/src/routes.tsx +21 -4
  27. package/src/types.ts +117 -5
  28. package/src/views/CollectionView.tsx +68 -0
  29. package/src/views/JanitorView.tsx +2 -1
  30. package/src/views/JobDataOverview.tsx +23 -6
  31. package/src/views/JobLogs.tsx +47 -2
  32. package/src/views/JobSubmit.tsx +25 -0
  33. package/src/views/JobsTable.tsx +81 -21
  34. package/src/views/JobsView.tsx +49 -9
  35. package/src/views/OrganizerValuesView.tsx +207 -0
  36. package/src/views/OverviewPanels.tsx +531 -7
  37. package/src/views/PipelineEditor.tsx +69 -2
  38. package/src/views/PipelinesView.tsx +145 -4
  39. package/src/views/ProjectDetailsView.tsx +112 -0
  40. package/src/views/ProjectsView.tsx +355 -0
  41. package/src/views/dataCharts.tsx +1 -1
package/dist/paths.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { IconType } from 'react-icons';
2
2
  /** Names of the bujang views. */
3
- export type BujangView = 'jobs' | 'submitJob' | 'jobDetails' | 'jobLogs' | 'pipelines' | 'pipelineDetails' | 'scheduled' | 'agent' | 'janitor' | 'setup' | 'settings';
3
+ export type BujangView = 'jobs' | 'submitJob' | 'jobDetails' | 'jobLogs' | 'pipelines' | 'pipelineDetails' | 'scheduled' | 'projects' | 'projectDetails' | 'experiments' | 'experimentDetails' | 'groups' | 'groupDetails' | 'agent' | 'janitor' | 'setup' | 'settings';
4
4
  /** URL builders the views use to link to each other. */
5
5
  export interface BujangPaths {
6
6
  jobs: () => string;
@@ -11,6 +11,18 @@ export interface BujangPaths {
11
11
  /** One saved pipeline: its graph and its runs, `runId` shows that run. */
12
12
  pipelineDetails: (name: string, runId?: string) => string;
13
13
  scheduled: () => string;
14
+ /** Registered code repositories and the jobs linked into them. `name` links to one project's card. */
15
+ projects: (name?: string) => string;
16
+ /** One project: its repository and its jobs. */
17
+ projectDetails: (name: string) => string;
18
+ /** Every experiment: a searchable, paginated table. */
19
+ experiments: () => string;
20
+ /** The jobs of one experiment. */
21
+ experimentDetails: (value: string) => string;
22
+ /** Every group: a searchable, paginated table. */
23
+ groups: () => string;
24
+ /** The jobs of one group. */
25
+ groupDetails: (value: string) => string;
14
26
  /** Agent activity, optionally filtered on one session. */
15
27
  agent: (session?: string) => string;
16
28
  /** Janitor: background tasks (running, periodic, history), sync queue, cleanups. `section`: a card id. */
@@ -36,5 +48,17 @@ export interface BujangNavItem {
36
48
  /** Icon of the entry (a react-icons component); optional, hosts can ignore it. */
37
49
  icon?: IconType;
38
50
  }
39
- /** Sidebar entries for the top-level bujang views. */
40
- export declare function bujangNavItems(paths?: BujangPaths): BujangNavItem[];
51
+ /**
52
+ * Views a host opts into (bujangRoutes({ projects: true }), BujangProjectsNav): the Projects section links
53
+ * the jobs into local code repositories, which only makes sense where the server runs on the user's machine.
54
+ */
55
+ export declare const PROJECT_VIEWS: BujangView[];
56
+ /** The experiments / groups pages (BujangOrganizerNav): opt-in too, bujangRoutes({ organizers: true }). */
57
+ export declare const ORGANIZER_VIEWS: BujangView[];
58
+ export declare const OPTIONAL_VIEWS: BujangView[];
59
+ /** Sidebar entries for the top-level bujang views (the projects have their own section: BujangProjectsNav). */
60
+ export interface BujangNavOptions {
61
+ /** the Setup Guide entry (default true): a host that sets bujang up itself leaves it out */
62
+ setup?: boolean;
63
+ }
64
+ export declare function bujangNavItems(paths?: BujangPaths, options?: BujangNavOptions): BujangNavItem[];
package/dist/routes.d.ts CHANGED
@@ -3,8 +3,12 @@ import type { BujangView } from './paths';
3
3
  export interface BujangRoutesOptions {
4
4
  /** Prefix the routes are mounted under, e.g. "/slurm". Must match BujangProvider's basePath. Default "". */
5
5
  basePath?: string;
6
- /** Only mount these views (default: all). */
6
+ /** Only mount these views (default: all but the optional ones). */
7
7
  views?: BujangView[];
8
+ /** Mount the Projects views too (/projects, /projects/:projectName), see BujangProjectsNav. Default false. */
9
+ projects?: boolean;
10
+ /** Mount the experiments and groups pages too (/experiments[/:value], /groups[/:value]), see BujangOrganizerNav. */
11
+ organizers?: boolean;
8
12
  }
9
13
  /** A plain route object, usable with <Route>, useRoutes() or createBrowserRouter(). */
10
14
  export interface BujangRouteObject {
@@ -15,7 +19,8 @@ export interface BujangRouteObject {
15
19
  /**
16
20
  * Route objects for the default bujang URL layout under `basePath`:
17
21
  * /jobs, /jobs/submit, /jobrunner/:slurmJobId/:jrJobId, /joblogs/:slurmJobId/:jrJobId,
18
- * /pipelines, /pipelines/:pipelineName, /scheduled, /agent, /janitor, /setup, /settings.
22
+ * /pipelines, /pipelines/:pipelineName, /scheduled, /agent, /janitor, /setup, /settings; with `projects`,
23
+ * /projects and /projects/:projectName.
19
24
  */
20
25
  export declare function bujangRoutes(options?: BujangRoutesOptions): BujangRouteObject[];
21
26
  /** The same routes as <Route> elements, to drop inside a host's <Routes>. */
package/dist/types.d.ts CHANGED
@@ -166,6 +166,10 @@ export interface SlurmClusterStatus {
166
166
  }
167
167
  export interface SlurmJobStatusResponse {
168
168
  status: string;
169
+ /** pending jobs: the squeue reason (JobHeldUser, Dependency, Resources, ...) */
170
+ reason?: string;
171
+ /** pending and held (--hold): waits for `scontrol release` */
172
+ held?: boolean;
169
173
  }
170
174
  export interface SlurmJobAccounting {
171
175
  job_id: number;
@@ -357,6 +361,8 @@ export interface PipelineRunSummary {
357
361
  /** A step of a run with its current state (sacct/squeue state, HELD, or the ssh step state) */
358
362
  export interface PipelineRunStep extends PipelineJob {
359
363
  step?: string;
364
+ /** the resolved label of the job (`label` is the template) */
365
+ job_label?: string;
360
366
  /** the value of the sweep variable of its parallel group (what tells it apart from its siblings) */
361
367
  sweep?: string;
362
368
  /** the env variable `sweep` is the value of */
@@ -856,6 +862,66 @@ export interface OrganizerGroups {
856
862
  jobs: string[];
857
863
  }[];
858
864
  }
865
+ /** One value of an organizer (an experiment, a group): its jobs and when they ran */
866
+ export interface OrganizerValue {
867
+ value: string;
868
+ /** how many jobs (pipeline runs and their steps count) */
869
+ jobs: number;
870
+ /** the oldest job folder (seconds) */
871
+ first: number | null;
872
+ /** the last change of one of its job folders (seconds) */
873
+ last: number | null;
874
+ }
875
+ /** GET /organizers/<name>/values: a page of the values */
876
+ export interface OrganizerValuesPage {
877
+ organizer: string;
878
+ total: number;
879
+ offset: number;
880
+ limit: number;
881
+ values: OrganizerValue[];
882
+ }
883
+ /** A code repository registered as a project: its jobs are linked into `target` (GET /projects) */
884
+ export interface Project {
885
+ name: string;
886
+ /** the repository on the machine of the bujang server */
887
+ path: string;
888
+ /** folder inside the repository, relative ("bujang") */
889
+ folder: string;
890
+ /** path/folder: the bujang folder of the project (its config, jobs/) */
891
+ target: string;
892
+ /** target/jobs: where the job links are */
893
+ jobs_dir: string;
894
+ /** its own scripts, pipelines and profiles, named "<project>:<name>" */
895
+ templates: string[];
896
+ pipelines: string[];
897
+ profiles: string[];
898
+ created: number | null;
899
+ /** the repository folder exists */
900
+ exists: boolean;
901
+ /** it is a git repository */
902
+ git: boolean;
903
+ /** jobs tagged for the project (runs and their steps) */
904
+ jobs: number;
905
+ /** links in the repository folder */
906
+ links: number;
907
+ }
908
+ export interface ProjectsInfo {
909
+ projects: Project[];
910
+ /** folder used when a registration gives none (the `project_folder` setting) */
911
+ default_folder: string;
912
+ /** false: the `projects` organizer is not loaded (the `organizers` setting), nothing is linked */
913
+ enabled: boolean;
914
+ /** registering and removing need a server that allows edits (settings_writable) */
915
+ writable: boolean;
916
+ /** script argument that tags a job too (export BUJANG_PROJECT=<name>) */
917
+ argument: string;
918
+ }
919
+ /** POST /projects/sync: per project, the links added and removed (or the error) */
920
+ export type ProjectsSyncReport = Record<string, {
921
+ added?: string[];
922
+ removed?: string[];
923
+ error?: string;
924
+ }>;
859
925
  /** GET /jobs/<jr>/artifacts: the files of the artifact folders of a job (output/, runs/, results/) */
860
926
  export interface JobArtifacts {
861
927
  jr_job_id: string;
@@ -904,6 +970,13 @@ export type OverviewBlock = {
904
970
  title?: string;
905
971
  metrics?: StatsMetric[];
906
972
  show?: StatName[];
973
+ }
974
+ /** a row per job: its arguments (`args`: their names; absent: the ones that differ), its state, the `metrics` */
975
+ | {
976
+ kind: 'compare';
977
+ title?: string;
978
+ metrics?: CompareMetric[];
979
+ args?: string[];
907
980
  } | {
908
981
  kind: 'logs';
909
982
  title?: string;
@@ -942,7 +1015,42 @@ export type OverviewPanel = OverviewBlock | ColumnsPanel;
942
1015
  export interface OverviewLayout {
943
1016
  panels: OverviewPanel[];
944
1017
  }
945
- export type OverviewScope = 'experiment' | 'script';
1018
+ /** A collection of jobs with an Overview of its own (the jobs compared): its organizer */
1019
+ export type CollectionScope = 'experiments' | 'groups' | 'projects';
1020
+ export type OverviewScope = 'experiment' | 'script' | CollectionScope;
1021
+ /** A job of a collection (GET /collections/<organizer>/<value>/data) */
1022
+ export interface CollectionJob {
1023
+ jr_job_id: string;
1024
+ label: string | null;
1025
+ state: string;
1026
+ settled: boolean;
1027
+ cluster: string | null;
1028
+ created: number | null;
1029
+ /** the arguments of its script (arguments.json) */
1030
+ args: Record<string, unknown>;
1031
+ }
1032
+ /** What a compare block shows of a field, per job */
1033
+ export type CompareStat = 'last' | 'first' | 'min' | 'max' | 'mean' | 'count';
1034
+ /** A column of a compare block: a statistic of a number field of an event */
1035
+ export interface CompareMetric {
1036
+ event: string;
1037
+ field: string;
1038
+ stat?: CompareStat;
1039
+ title?: string;
1040
+ /** conditional formatting: a color scale over the column, its better end green */
1041
+ scale?: CompareScale;
1042
+ /** conditional formatting: the first rule a value matches colors its cell (before the scale) */
1043
+ rules?: CompareRule[];
1044
+ }
1045
+ export type CompareScale = 'higher' | 'lower';
1046
+ export type CompareRuleOp = '<' | '<=' | '>' | '>=' | '==' | '!=';
1047
+ export type CompareRuleColor = 'good' | 'bad' | 'warn' | 'info';
1048
+ /** A conditional format of a compare column: `value <op> <value>` colors the cell */
1049
+ export interface CompareRule {
1050
+ op: CompareRuleOp;
1051
+ value: number;
1052
+ color: CompareRuleColor;
1053
+ }
946
1054
  /** GET /jobs/<jr>/overview/layout */
947
1055
  export interface JobOverviewLayout {
948
1056
  layout: OverviewLayout;
@@ -961,10 +1069,14 @@ export interface JobOverviewLayout {
961
1069
  };
962
1070
  /** the charts of the built-in layout, to add to this one */
963
1071
  blocks: OverviewBlock[];
964
- /** what a layout can be saved for */
1072
+ /** what a layout can be saved for; `collection`: the Overview of an experiment / group / project */
965
1073
  keys: {
966
1074
  experiment: string | null;
967
1075
  script: string;
1076
+ collection?: {
1077
+ scope: CollectionScope;
1078
+ key: string;
1079
+ };
968
1080
  };
969
1081
  }
970
1082
  /** GET /overview/layouts */
@@ -976,16 +1088,18 @@ export interface SavedOverviewLayout {
976
1088
  }
977
1089
  /** What an event of a JSONL file is for: plotted, shown in the log view, or neither */
978
1090
  export type JobDataRole = 'metric' | 'log' | 'other';
979
- /** GET /jobs/<jr>/data: the JSONL files of the artifact folders of a job and their schema */
1091
+ /** GET /jobs/<jr>/data: the data files of the artifact folders of a job and their schema */
980
1092
  export interface JobData {
981
1093
  jr_job_id: string;
982
1094
  folders: string[];
1095
+ /** the Overview of a collection: its jobs (their files are under "<job id>/") */
1096
+ jobs?: CollectionJob[];
983
1097
  files: {
984
1098
  path: string;
985
1099
  size?: number;
986
1100
  mtime?: number;
987
1101
  rows?: number;
988
- /** the JSONL processor that read the file ("generic", or one of a plugin) */
1102
+ /** the data processor that read the file ("jsonl", or one of a plugin: "csv", ...) */
989
1103
  processor?: string;
990
1104
  /** per event ("" for the records without an event envelope), its role, row count and fields */
991
1105
  events?: {
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import type { CollectionScope } from '../types';
3
+ export type CollectionTab = 'jobs' | 'overview';
4
+ /** The tab of a collection page (experiment, group, project), in the URL: the Overview, else ?view=jobs */
5
+ export declare function useCollectionTab(): [CollectionTab, (tab: CollectionTab) => void];
6
+ /** Overview | Jobs */
7
+ export declare const CollectionTabs: React.FC<{
8
+ tab: CollectionTab;
9
+ onTab: (tab: CollectionTab) => void;
10
+ }>;
11
+ /**
12
+ * The Overview of a collection: the panels of a job's Overview over the data of all its jobs (a line per
13
+ * job, the jobs compared in a table), with a layout of its own (a project's in its repository).
14
+ */
15
+ export declare const CollectionOverview: React.FC<{
16
+ organizer: CollectionScope;
17
+ value: string;
18
+ title: React.ReactNode;
19
+ pageTitle: string;
20
+ /** under the heading: the tabs, links */
21
+ header?: React.ReactNode;
22
+ }>;
@@ -1,7 +1,7 @@
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), or the "explore data" layout: the JSONL files of its artifact folders
4
+ * /jobs/<jr>/overview/layout), or the "explore data" layout: the data files of its artifact folders
5
5
  * (output/, runs/, results/) plotted with a chart builder, whose charts can be added to the layout of the job.
6
6
  */
7
7
  export declare const JobDataOverview: React.FC<{
@@ -46,6 +46,7 @@ interface JobsTableProps {
46
46
  /** caps the rows' height; without it they fill the card (give the card a height, e.g. flex: 1) */
47
47
  maxH?: string;
48
48
  onCancel: (jobId: string) => void;
49
+ onRelease: (jobId: string) => void;
49
50
  onRerun: (jrJobId: string) => void;
50
51
  onGroup: (group: string) => void;
51
52
  /** quick filters (important, organizers), in the header next to the title */
@@ -1,4 +1,15 @@
1
1
  import React from 'react';
2
- type JobsViewProps = Record<string, never>;
2
+ interface JobsViewProps {
3
+ /** organizer filters always applied, not shown in the filter bar ({ projects: 'my-repo' }) */
4
+ filters?: Record<string, string>;
5
+ /** the heading (default "Jobs") */
6
+ title?: React.ReactNode;
7
+ /** the browser tab title (default "Jobs") */
8
+ pageTitle?: string;
9
+ /** shown under the heading */
10
+ header?: React.ReactNode;
11
+ /** where "Submit New Job" goes (default the Submit page) */
12
+ submitPath?: string;
13
+ }
3
14
  export declare const JobsView: React.FC<JobsViewProps>;
4
15
  export {};
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { ORGANIZER_PAGES } from '../components/OrganizerNav';
3
+ /**
4
+ * Every experiment (or group): a table with their job count and last activity, searched by name and
5
+ * paginated on the server. The search, sort, page and page size are in the URL.
6
+ */
7
+ export declare const OrganizerValuesView: React.FC<{
8
+ organizer: keyof typeof ORGANIZER_PAGES;
9
+ }>;
10
+ /** One experiment (or group): its jobs (the jobs page filtered on it), or their Overview (compared) */
11
+ export declare const OrganizerValueView: React.FC<{
12
+ organizer: keyof typeof ORGANIZER_PAGES;
13
+ }>;
@@ -1,6 +1,6 @@
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, OverviewBlock, OverviewLayout } from '../types';
3
+ import type { CollectionJob, CompareRuleColor, CompareRuleOp, CompareStat, JobData, JobOverviewLayout, OverviewBlock, OverviewLayout } from '../types';
4
4
  /** What can be done with a block of the layout; the moves are absent where they lead nowhere */
5
5
  interface BlockActions {
6
6
  editing: boolean;
@@ -48,7 +48,7 @@ export declare const LayoutBar: React.FC<{
48
48
  editing: boolean;
49
49
  saving: boolean;
50
50
  onEdit: (on: boolean) => void;
51
- onSave: (target: 'experiment' | 'script' | 'default') => void;
51
+ onSave: (target: 'experiment' | 'script' | 'default' | 'collection') => void;
52
52
  onDiscard: () => void;
53
53
  onReset: () => void;
54
54
  }>;
@@ -65,4 +65,15 @@ export declare const LayoutPanels: React.FC<{
65
65
  onChange: (layout: OverviewLayout) => void;
66
66
  onEditor: (open: boolean) => void;
67
67
  }>;
68
+ /** The jobs of a collection Overview (experiment, group, project), given by its page to the compare blocks */
69
+ export declare const CollectionJobs: React.Context<CollectionJob[] | null>;
70
+ export declare const COMPARE_STATS: CompareStat[];
71
+ export declare const COMPARE_OPS: CompareRuleOp[];
72
+ export declare const COMPARE_COLORS: CompareRuleColor[];
73
+ /**
74
+ * A row per job (`_job` of the rows; per file in a job's Overview): its short id, label, state and pipeline
75
+ * step, the arguments of its script, then a statistic of each metric (the last loss, the best one, ...)
76
+ * with its conditional formatting. Sorted by a click on a column, filtered by the inputs under the header.
77
+ */
78
+ export declare const ComparePanel: React.FC<PanelProps<'compare'>>;
68
79
  export {};
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ /** One project: its repository, then the jobs page filtered on it */
3
+ export declare const ProjectDetailsView: React.FC;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import type { Project } from '../types';
3
+ export declare const PROJECTS_KEY: string[];
4
+ export declare const ProjectCard: React.FC<{
5
+ project: Project;
6
+ writable: boolean;
7
+ onRemoved?: () => void;
8
+ }>;
9
+ /**
10
+ * Archive the jobs of a project: their folders move out of the local cache into the project's jobs/,
11
+ * where their links were (a preview first). Jobs not over or still on their cluster stay.
12
+ */
13
+ export declare const ProjectArchive: React.FC<{
14
+ project: Project;
15
+ }>;
16
+ /** The scripts, pipelines and profiles of a project (files of its bujang folder) */
17
+ export declare const ProjectConfig: React.FC<{
18
+ project: Project;
19
+ }>;
20
+ export declare const ProjectsView: React.FC;
@@ -1,4 +1,4 @@
1
- /** Charts of the JSONL data of a job: the chart builder, its Vega-Lite spec, and the chart itself. */
1
+ /** Charts of the data files of a job: the chart builder, its Vega-Lite spec, and the chart itself. */
2
2
  import React from 'react';
3
3
  import type { JobData, JobDataField, JobDataRole, OverviewBlock } from '../types';
4
4
  /** Rows fetched for a chart (the server caps at 500k) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milabench/bujang",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/api.ts CHANGED
@@ -31,6 +31,10 @@ import type {
31
31
  SettingsUpdateResponse,
32
32
  UpdateCheck,
33
33
  OrganizerGroups,
34
+ OrganizerValuesPage,
35
+ Project,
36
+ ProjectsInfo,
37
+ ProjectsSyncReport,
34
38
  SyncStatus,
35
39
  JobEnvironment,
36
40
  JobArtifacts,
@@ -166,6 +170,16 @@ export const cancelSlurmJob = async (jobId: string): Promise<{ success: boolean;
166
170
  }
167
171
  };
168
172
 
173
+ /** scontrol release of a held job (a pipeline step submitted with --hold) */
174
+ export const releaseSlurmJob = async (jobId: string): Promise<{ success: boolean; message?: string; error?: string }> => {
175
+ try {
176
+ const response = await api.post(`/release/${jobId}`);
177
+ return response.data;
178
+ } catch (error) {
179
+ return handleError(error);
180
+ }
181
+ };
182
+
169
183
  export const getSlurmJobInfo = async (jrJobId: string, jobId?: string): Promise<SlurmJobDetail> => {
170
184
  try {
171
185
  const url = jobId
@@ -401,6 +415,8 @@ export const submitSlurmJob = async (request: {
401
415
  dependency?: [string, string][];
402
416
  /** Files for the job: <job folder>/input/<name> on the cluster before it starts ($BUJANG_INPUT_DIR). */
403
417
  files?: JobAttachment[];
418
+ /** A registered project: the job folder is linked into its repository (see getProjects). */
419
+ project?: string;
404
420
  }): Promise<SlurmJobSubmitResponse> => {
405
421
  try {
406
422
  const response = await api.post('/submit', request);
@@ -546,11 +562,27 @@ export const jobArtifactUrl = (jrJobId: string, path: string): string =>
546
562
  /** The layout of a job's Overview tab and where it comes from. */
547
563
  export const getJobOverviewLayout = async (jrJobId: string): Promise<JobOverviewLayout> => {
548
564
  try {
549
- const response = await api.get(`/jobs/${encodeURIComponent(jrJobId)}/overview/layout`, { timeout: 60000 });
565
+ const response = await api.get(`${dataBase(jrJobId)}/overview/layout`, { timeout: 60000 });
550
566
  return response.data;
551
567
  } catch (error) { return handleError(error); }
552
568
  };
553
569
 
570
+ /**
571
+ * The id the Overview of a collection goes by: "@<organizer>/<value>" ("@experiments/lr-sweep"). The data and
572
+ * layout calls below take it in place of a job id: the panels of a job's Overview work on the jobs of the
573
+ * collection (each file under "<job id>/", each row with `_job`, `_label`, `args`).
574
+ */
575
+ export const collectionId = (organizer: string, value: string): string => `@${organizer}/${value}`;
576
+
577
+ /** /jobs/<id>, or /collections/<organizer>/<value> for a collection id */
578
+ const dataBase = (id: string): string => {
579
+ if (id.startsWith('@')) {
580
+ const [organizer, ...rest] = id.slice(1).split('/');
581
+ return `/collections/${encodeURIComponent(organizer)}/${encodeURIComponent(rest.join('/'))}`;
582
+ }
583
+ return `/jobs/${encodeURIComponent(id)}`;
584
+ };
585
+
554
586
  /** The Overview layouts saved for an experiment or a script. */
555
587
  export const getOverviewLayouts = async (): Promise<SavedOverviewLayout[]> => {
556
588
  try {
@@ -569,10 +601,10 @@ export const saveOverviewLayout = async (
569
601
  } catch (error) { return handleError(error); }
570
602
  };
571
603
 
572
- /** The JSONL files of the artifact folders of a job, with their events and fields (cached server side). */
604
+ /** The data files of the artifact folders of a job, with their events and fields (cached server side). */
573
605
  export const getJobData = async (jrJobId: string): Promise<JobData> => {
574
606
  try {
575
- const response = await api.get(`/jobs/${encodeURIComponent(jrJobId)}/data`, { timeout: 60000 });
607
+ const response = await api.get(`${dataBase(jrJobId)}/data`, { timeout: 60000 });
576
608
  return response.data;
577
609
  } catch (error) { return handleError(error); }
578
610
  };
@@ -600,17 +632,17 @@ const rowsParams = (query: JobDataRowsQuery): URLSearchParams => {
600
632
  return params;
601
633
  };
602
634
 
603
- /** The rows of the JSONL files of a job (each with `_file` and `_name`), for plots. */
635
+ /** The rows of the data files of a job (each with `_file` and `_name`), for plots. */
604
636
  export const getJobDataRows = async (jrJobId: string, query: JobDataRowsQuery): Promise<Record<string, unknown>[]> => {
605
637
  try {
606
- const response = await api.get(`/jobs/${encodeURIComponent(jrJobId)}/data/rows?${rowsParams(query)}`, { timeout: 120000 });
638
+ const response = await api.get(`${dataBase(jrJobId)}/data/rows?${rowsParams(query)}`, { timeout: 120000 });
607
639
  return response.data;
608
640
  } catch (error) { return handleError(error); }
609
641
  };
610
642
 
611
643
  /** URL of the rows of a job: a Vega-Lite / Altair data url (relative to the page when apiBase is). */
612
644
  export const jobDataRowsUrl = (jrJobId: string, query: JobDataRowsQuery): string =>
613
- `${urlBase()}/jobs/${encodeURIComponent(jrJobId)}/data/rows?${rowsParams(query)}`;
645
+ `${urlBase()}${dataBase(jrJobId)}/data/rows?${rowsParams(query)}`;
614
646
 
615
647
  /** When the job index was last synced with the clusters. */
616
648
  export const getSyncStatus = async (): Promise<SyncStatus> => {
@@ -636,6 +668,53 @@ export const getOrganizers = async (): Promise<OrganizerGroups[]> => {
636
668
  } catch (error) { return handleError(error); }
637
669
  };
638
670
 
671
+ /** A page of the values of an organizer (experiments, groups): job count, last activity; `search` in the name. */
672
+ export const getOrganizerValues = async (
673
+ name: string,
674
+ params: { search?: string; sort?: 'last' | 'name' | 'jobs'; offset?: number; limit?: number } = {},
675
+ ): Promise<OrganizerValuesPage> => {
676
+ try {
677
+ const response = await api.get(`/organizers/${encodeURIComponent(name)}/values`, {
678
+ params: { ...params, search: params.search || undefined },
679
+ });
680
+ return response.data;
681
+ } catch (error) { return handleError(error); }
682
+ };
683
+
684
+ /** The registered projects: code repositories the jobs tagged for them are linked into. */
685
+ export const getProjects = async (): Promise<ProjectsInfo> => {
686
+ try {
687
+ const response = await api.get('/projects');
688
+ return response.data;
689
+ } catch (error) { return handleError(error); }
690
+ };
691
+
692
+ /** Register a repository (or change its folder): makes <path>/<folder> and links the jobs already tagged. */
693
+ export const registerProject = async (
694
+ body: { name: string; path: string; folder?: string },
695
+ ): Promise<{ project: Project; sync?: ProjectsSyncReport[string] }> => {
696
+ try {
697
+ const response = await api.post('/projects', body);
698
+ return response.data;
699
+ } catch (error) { return handleError(error); }
700
+ };
701
+
702
+ /** Forget a project: its links leave the repository, the other files of the folder stay. */
703
+ export const removeProject = async (name: string): Promise<{ name: string; removed: string[] }> => {
704
+ try {
705
+ const response = await api.delete(`/projects/${encodeURIComponent(name)}`);
706
+ return response.data;
707
+ } catch (error) { return handleError(error); }
708
+ };
709
+
710
+ /** Relink the jobs into the repositories now (one project, or all). */
711
+ export const syncProjects = async (name?: string): Promise<ProjectsSyncReport> => {
712
+ try {
713
+ const response = await api.post('/projects/sync', name ? { name } : {});
714
+ return response.data;
715
+ } catch (error) { return handleError(error); }
716
+ };
717
+
639
718
  /** The running version against PyPI; the server asks PyPI once a day, `force` asks now. */
640
719
  export const getUpdateCheck = async (force = false): Promise<UpdateCheck> => {
641
720
  try {
@@ -758,10 +837,13 @@ export const savePipelineToFile = async (pipelineData: PipelineTemplatePayload):
758
837
  }
759
838
  };
760
839
 
761
- export const runPipelineTemplate = async (name: string): Promise<PipelineRunResponse> => {
840
+ export const runPipelineTemplate = async (
841
+ name: string,
842
+ options: { experiment?: string; project?: string } = {},
843
+ ): Promise<PipelineRunResponse> => {
762
844
  try {
763
845
  // Returns right away, the jobs are submitted in the background (see getPipelineRunStatus)
764
- const response = await api.post(`/pipeline/run/${encodeURIComponent(name)}`, { context: {} });
846
+ const response = await api.post(`/pipeline/run/${encodeURIComponent(name)}`, { context: {}, ...options });
765
847
  return response.data;
766
848
  } catch (error) {
767
849
  return handleError(error);