@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/README.md CHANGED
@@ -64,6 +64,22 @@ import '@milabench/bujang/theme.css'; // default colour tokens (optional, host t
64
64
 
65
65
  // sidebar entries
66
66
  bujangNavItems(createBujangPaths('/slurm')); // [{ view, label, path }, ...]
67
+ bujangNavItems(paths, { setup: false }); // without the Setup Guide entry (a host that sets bujang up itself)
68
+ ```
69
+
70
+ The **Projects** section (local code repositories the jobs are linked into) is opt-in: it only makes sense
71
+ when the bujang server runs on the user's machine. Mount its routes and put its own sidebar section
72
+ (a "Projects" header, a + to register a repository, a quick link per project) where you want it:
73
+
74
+ ```tsx
75
+ {bujangRouteElements({ basePath: '/slurm', projects: true })} // /projects, /projects/:projectName
76
+ <BujangProjectsNav collapsed={false} onNavigate={closeDrawer} />
77
+
78
+ // the experiments and groups: pages with a searchable, paginated table, a sidebar section each
79
+ // (the 5 most recent, hidden while there are none)
80
+ {bujangRouteElements({ basePath: '/slurm', organizers: true })} // /experiments[/:value], /groups[/:value]
81
+ <BujangOrganizerNav organizer="experiments" />
82
+ <BujangOrganizerNav organizer="groups" />
67
83
  ```
68
84
 
69
85
  `bujangRoutes(options)` returns the same routes as plain `{ id, path, element }` objects for
package/dist/api.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { SlurmJob, SlurmJobSubmitResponse, SlurmJobAccounting, SlurmJobDetail, SlurmClusterInfo, SlurmProfile, SlurmClusterStatus, PersitedJobInfo, SlurmJobStatusResponse, EarlySyncResponse, PipelineTemplatePayload, PipelineRunResponse, PipelineRunSummary, PipelineRunStatus, ScheduledJob, ScheduledJobRun, ScheduledJobTemplateDiff, AgentEvent, AgentSession, SettingsInfo, SettingsUpdateResponse, UpdateCheck, OrganizerGroups, SyncStatus, JobEnvironment, JobArtifacts, JobData, JobDataRole, JobOverviewLayout, OverviewLayout, OverviewScope, SavedOverviewLayout, JobMarks, UpdateResult, SettingsSecrets, SshSettings, SshPlan, SshPlanRequest, SshTestResponse, SshConnections, SshLogin, JobAttachment, JanitorOverview, JanitorRun, JanitorCleanupInfo, JanitorArchiveResult, JanitorStaleResult } from './types';
1
+ import type { SlurmJob, SlurmJobSubmitResponse, SlurmJobAccounting, SlurmJobDetail, SlurmClusterInfo, SlurmProfile, SlurmClusterStatus, PersitedJobInfo, SlurmJobStatusResponse, EarlySyncResponse, PipelineTemplatePayload, PipelineRunResponse, PipelineRunSummary, PipelineRunStatus, ScheduledJob, ScheduledJobRun, ScheduledJobTemplateDiff, AgentEvent, AgentSession, SettingsInfo, SettingsUpdateResponse, UpdateCheck, OrganizerGroups, OrganizerValuesPage, Project, ProjectsInfo, ProjectsSyncReport, SyncStatus, JobEnvironment, JobArtifacts, JobData, JobDataRole, JobOverviewLayout, OverviewLayout, OverviewScope, SavedOverviewLayout, JobMarks, UpdateResult, SettingsSecrets, SshSettings, SshPlan, SshPlanRequest, SshTestResponse, SshConnections, SshLogin, JobAttachment, JanitorOverview, JanitorRun, JanitorCleanupInfo, JanitorArchiveResult, JanitorStaleResult } from './types';
2
2
  export declare const DEFAULT_API_BASE = "/api/slurm";
3
3
  /**
4
4
  * What bujang needs from an axios instance. Typed structurally so the host's instance fits even
@@ -39,6 +39,12 @@ export declare const cancelSlurmJob: (jobId: string) => Promise<{
39
39
  message?: string;
40
40
  error?: string;
41
41
  }>;
42
+ /** scontrol release of a held job (a pipeline step submitted with --hold) */
43
+ export declare const releaseSlurmJob: (jobId: string) => Promise<{
44
+ success: boolean;
45
+ message?: string;
46
+ error?: string;
47
+ }>;
42
48
  export declare const getSlurmJobInfo: (jrJobId: string, jobId?: string) => Promise<SlurmJobDetail>;
43
49
  export declare const getSlurmJobStdout: (jrJobId: string) => Promise<string>;
44
50
  export declare const getSlurmJobStderr: (jrJobId: string) => Promise<string>;
@@ -101,6 +107,8 @@ export declare const submitSlurmJob: (request: {
101
107
  dependency?: [string, string][];
102
108
  /** Files for the job: <job folder>/input/<name> on the cluster before it starts ($BUJANG_INPUT_DIR). */
103
109
  files?: JobAttachment[];
110
+ /** A registered project: the job folder is linked into its repository (see getProjects). */
111
+ project?: string;
104
112
  }) => Promise<SlurmJobSubmitResponse>;
105
113
  export declare const getSlurmJobCluster: (jrJobId: string) => Promise<{
106
114
  cluster: string;
@@ -155,6 +163,12 @@ export declare const getJobArtifacts: (jrJobId: string) => Promise<JobArtifacts>
155
163
  export declare const jobArtifactUrl: (jrJobId: string, path: string) => string;
156
164
  /** The layout of a job's Overview tab and where it comes from. */
157
165
  export declare const getJobOverviewLayout: (jrJobId: string) => Promise<JobOverviewLayout>;
166
+ /**
167
+ * The id the Overview of a collection goes by: "@<organizer>/<value>" ("@experiments/lr-sweep"). The data and
168
+ * layout calls below take it in place of a job id: the panels of a job's Overview work on the jobs of the
169
+ * collection (each file under "<job id>/", each row with `_job`, `_label`, `args`).
170
+ */
171
+ export declare const collectionId: (organizer: string, value: string) => string;
158
172
  /** The Overview layouts saved for an experiment or a script. */
159
173
  export declare const getOverviewLayouts: () => Promise<SavedOverviewLayout[]>;
160
174
  /** Save the Overview layout of an experiment or a script; null removes it. */
@@ -164,7 +178,7 @@ export declare const saveOverviewLayout: (scope: OverviewScope, key: string, lay
164
178
  key: string;
165
179
  removed: boolean;
166
180
  }>;
167
- /** The JSONL files of the artifact folders of a job, with their events and fields (cached server side). */
181
+ /** The data files of the artifact folders of a job, with their events and fields (cached server side). */
168
182
  export declare const getJobData: (jrJobId: string) => Promise<JobData>;
169
183
  /** Query of GET /jobs/<jr>/data/rows: comma separated files (or globs), events, dotted fields. */
170
184
  export interface JobDataRowsQuery {
@@ -177,7 +191,7 @@ export interface JobDataRowsQuery {
177
191
  require?: string[];
178
192
  limit?: number;
179
193
  }
180
- /** The rows of the JSONL files of a job (each with `_file` and `_name`), for plots. */
194
+ /** The rows of the data files of a job (each with `_file` and `_name`), for plots. */
181
195
  export declare const getJobDataRows: (jrJobId: string, query: JobDataRowsQuery) => Promise<Record<string, unknown>[]>;
182
196
  /** URL of the rows of a job: a Vega-Lite / Altair data url (relative to the page when apiBase is). */
183
197
  export declare const jobDataRowsUrl: (jrJobId: string, query: JobDataRowsQuery) => string;
@@ -187,6 +201,31 @@ export declare const getSyncStatus: () => Promise<SyncStatus>;
187
201
  export declare const syncNow: () => Promise<SyncStatus>;
188
202
  /** The organizer folders (clusters/, experiments/, ...): their values and the job ids under each. */
189
203
  export declare const getOrganizers: () => Promise<OrganizerGroups[]>;
204
+ /** A page of the values of an organizer (experiments, groups): job count, last activity; `search` in the name. */
205
+ export declare const getOrganizerValues: (name: string, params?: {
206
+ search?: string;
207
+ sort?: "last" | "name" | "jobs";
208
+ offset?: number;
209
+ limit?: number;
210
+ }) => Promise<OrganizerValuesPage>;
211
+ /** The registered projects: code repositories the jobs tagged for them are linked into. */
212
+ export declare const getProjects: () => Promise<ProjectsInfo>;
213
+ /** Register a repository (or change its folder): makes <path>/<folder> and links the jobs already tagged. */
214
+ export declare const registerProject: (body: {
215
+ name: string;
216
+ path: string;
217
+ folder?: string;
218
+ }) => Promise<{
219
+ project: Project;
220
+ sync?: ProjectsSyncReport[string];
221
+ }>;
222
+ /** Forget a project: its links leave the repository, the other files of the folder stay. */
223
+ export declare const removeProject: (name: string) => Promise<{
224
+ name: string;
225
+ removed: string[];
226
+ }>;
227
+ /** Relink the jobs into the repositories now (one project, or all). */
228
+ export declare const syncProjects: (name?: string) => Promise<ProjectsSyncReport>;
190
229
  /** The running version against PyPI; the server asks PyPI once a day, `force` asks now. */
191
230
  export declare const getUpdateCheck: (force?: boolean) => Promise<UpdateCheck>;
192
231
  /** Upgrade bujang on the server, which then restarts (403 when read-only, 409 for a source checkout). */
@@ -222,7 +261,10 @@ export declare const savePipelineToFile: (pipelineData: PipelineTemplatePayload)
222
261
  success?: boolean;
223
262
  error?: string;
224
263
  }>;
225
- export declare const runPipelineTemplate: (name: string) => Promise<PipelineRunResponse>;
264
+ export declare const runPipelineTemplate: (name: string, options?: {
265
+ experiment?: string;
266
+ project?: string;
267
+ }) => Promise<PipelineRunResponse>;
226
268
  export declare const getPipelineRuns: () => Promise<PipelineRunSummary[]>;
227
269
  export declare const getPipelineRunStatus: (runId: string) => Promise<PipelineRunStatus>;
228
270
  export declare const loadPipelineFromFile: (name: string) => Promise<Record<string, unknown>>;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import type { IconType } from 'react-icons';
3
+ import type { BujangPaths } from '../paths';
4
+ /** The organizers with a page of their own: their labels, icons and links */
5
+ export interface OrganizerPage {
6
+ label: string;
7
+ /** one of them ("experiment") */
8
+ singular: string;
9
+ icon: IconType;
10
+ list: (paths: BujangPaths) => string;
11
+ detail: (paths: BujangPaths, value: string) => string;
12
+ }
13
+ export declare const ORGANIZER_PAGES: Record<'experiments' | 'groups', OrganizerPage>;
14
+ export interface BujangOrganizerNavProps {
15
+ /** "experiments" or "groups" */
16
+ organizer: keyof typeof ORGANIZER_PAGES;
17
+ /** how many values to show, the most recent first (default 5) */
18
+ limit?: number;
19
+ /** icons only (a collapsed side panel) */
20
+ collapsed?: boolean;
21
+ /** called when a link is followed (close a drawer) */
22
+ onNavigate?: () => void;
23
+ }
24
+ /**
25
+ * A sidebar section for the experiments or the groups: its header opens the page of all of them, then
26
+ * the most recent ones (5). Shows nothing while there are none. Opt-in: bujangRoutes({ organizers: true }).
27
+ */
28
+ export declare const BujangOrganizerNav: React.FC<BujangOrganizerNavProps>;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import type { ProjectsInfo } from '../types';
3
+ /** The registered projects (GET /projects), shared with the Projects pages */
4
+ export declare function useBujangProjects(): import("@tanstack/react-query").UseQueryResult<ProjectsInfo, Error>;
5
+ export interface BujangProjectsNavProps {
6
+ /** icons only (a collapsed side panel) */
7
+ collapsed?: boolean;
8
+ /** called when a link is followed (close a drawer) */
9
+ onNavigate?: () => void;
10
+ }
11
+ /**
12
+ * A sidebar section of its own: "Projects" (the Projects page), a + to register a repository, and a
13
+ * quick link to each project (its jobs). Opt-in: mount it with `bujangRoutes({ projects: true })`.
14
+ */
15
+ export declare const BujangProjectsNav: React.FC<BujangProjectsNavProps>;
package/dist/index.d.ts CHANGED
@@ -6,6 +6,15 @@ export { PipelinesView, PipelineDetailsView } from './views/PipelinesView';
6
6
  export { PipelineGraph, pipelineMermaid, pipelineSteps } from './views/PipelineGraph';
7
7
  export type { GraphStep } from './views/PipelineGraph';
8
8
  export { ScheduledJobsView } from './views/ScheduledJobsView';
9
+ export { ProjectsView } from './views/ProjectsView';
10
+ export { ProjectDetailsView } from './views/ProjectDetailsView';
11
+ export { BujangProjectsNav, useBujangProjects } from './components/ProjectsNav';
12
+ export { BujangOrganizerNav } from './components/OrganizerNav';
13
+ export type { BujangOrganizerNavProps } from './components/OrganizerNav';
14
+ export { OrganizerValuesView, OrganizerValueView } from './views/OrganizerValuesView';
15
+ export { CollectionOverview, CollectionTabs } from './views/CollectionView';
16
+ export { ComparePanel, CollectionJobs } from './views/OverviewPanels';
17
+ export type { BujangProjectsNavProps } from './components/ProjectsNav';
9
18
  export { AgentActivityView, AgentBadge, McpHelp } from './views/AgentActivityView';
10
19
  export { SettingsView } from './views/SettingsView';
11
20
  export { JanitorView } from './views/JanitorView';
@@ -18,8 +27,8 @@ export { JobArtifactsCard } from './views/JobArtifacts';
18
27
  export { JobImportantButton, JobGroupsButton, JobImportantStar } from './views/JobMarks';
19
28
  export { BujangProvider, useBujang, useBujangPaths } from './context';
20
29
  export type { BujangProviderProps, BujangContextValue } from './context';
21
- export { createBujangPaths, defaultRoutePatterns, normalizeBasePath, bujangNavItems } from './paths';
22
- export type { BujangPaths, BujangView, BujangNavItem } from './paths';
30
+ export { createBujangPaths, defaultRoutePatterns, normalizeBasePath, bujangNavItems, OPTIONAL_VIEWS, PROJECT_VIEWS, ORGANIZER_VIEWS } from './paths';
31
+ export type { BujangPaths, BujangView, BujangNavItem, BujangNavOptions } from './paths';
23
32
  export { bujangRoutes, bujangRouteElements } from './routes';
24
33
  export type { BujangRoutesOptions, BujangRouteObject } from './routes';
25
34
  export { Tooltip } from './components/tooltip';