@milabench/bujang 0.1.18 → 0.1.19
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 +31 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4679 -4151
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +3 -1
- package/dist/routes.d.ts +1 -1
- package/dist/types.d.ts +42 -0
- package/dist/views/JobsTable.d.ts +1 -0
- package/dist/views/ProjectsView.d.ts +2 -0
- package/package.json +1 -1
- package/src/api.ts +54 -2
- package/src/index.ts +1 -0
- package/src/paths.ts +7 -1
- package/src/routes.tsx +3 -1
- package/src/types.ts +41 -0
- package/src/views/JobLogs.tsx +47 -2
- package/src/views/JobSubmit.tsx +22 -0
- package/src/views/JobsTable.tsx +37 -15
- package/src/views/JobsView.tsx +23 -0
- package/src/views/PipelineEditor.tsx +69 -2
- package/src/views/PipelinesView.tsx +145 -4
- package/src/views/ProjectsView.tsx +246 -0
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' | '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,8 @@ 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;
|
|
14
16
|
/** Agent activity, optionally filtered on one session. */
|
|
15
17
|
agent: (session?: string) => string;
|
|
16
18
|
/** Janitor: background tasks (running, periodic, history), sync queue, cleanups. `section`: a card id. */
|
package/dist/routes.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface BujangRouteObject {
|
|
|
15
15
|
/**
|
|
16
16
|
* Route objects for the default bujang URL layout under `basePath`:
|
|
17
17
|
* /jobs, /jobs/submit, /jobrunner/:slurmJobId/:jrJobId, /joblogs/:slurmJobId/:jrJobId,
|
|
18
|
-
* /pipelines, /pipelines/:pipelineName, /scheduled, /agent, /janitor, /setup, /settings.
|
|
18
|
+
* /pipelines, /pipelines/:pipelineName, /scheduled, /projects, /agent, /janitor, /setup, /settings.
|
|
19
19
|
*/
|
|
20
20
|
export declare function bujangRoutes(options?: BujangRoutesOptions): BujangRouteObject[];
|
|
21
21
|
/** 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,42 @@ export interface OrganizerGroups {
|
|
|
856
862
|
jobs: string[];
|
|
857
863
|
}[];
|
|
858
864
|
}
|
|
865
|
+
/** A code repository registered as a project: its jobs are linked into `target` (GET /projects) */
|
|
866
|
+
export interface Project {
|
|
867
|
+
name: string;
|
|
868
|
+
/** the repository on the machine of the bujang server */
|
|
869
|
+
path: string;
|
|
870
|
+
/** folder inside the repository, relative ("bujang") */
|
|
871
|
+
folder: string;
|
|
872
|
+
/** path/folder: where the job links are */
|
|
873
|
+
target: string;
|
|
874
|
+
created: number | null;
|
|
875
|
+
/** the repository folder exists */
|
|
876
|
+
exists: boolean;
|
|
877
|
+
/** it is a git repository */
|
|
878
|
+
git: boolean;
|
|
879
|
+
/** jobs tagged for the project (runs and their steps) */
|
|
880
|
+
jobs: number;
|
|
881
|
+
/** links in the repository folder */
|
|
882
|
+
links: number;
|
|
883
|
+
}
|
|
884
|
+
export interface ProjectsInfo {
|
|
885
|
+
projects: Project[];
|
|
886
|
+
/** folder used when a registration gives none (the `project_folder` setting) */
|
|
887
|
+
default_folder: string;
|
|
888
|
+
/** false: the `projects` organizer is not loaded (the `organizers` setting), nothing is linked */
|
|
889
|
+
enabled: boolean;
|
|
890
|
+
/** registering and removing need a server that allows edits (settings_writable) */
|
|
891
|
+
writable: boolean;
|
|
892
|
+
/** script argument that tags a job too (export BUJANG_PROJECT=<name>) */
|
|
893
|
+
argument: string;
|
|
894
|
+
}
|
|
895
|
+
/** POST /projects/sync: per project, the links added and removed (or the error) */
|
|
896
|
+
export type ProjectsSyncReport = Record<string, {
|
|
897
|
+
added?: string[];
|
|
898
|
+
removed?: string[];
|
|
899
|
+
error?: string;
|
|
900
|
+
}>;
|
|
859
901
|
/** GET /jobs/<jr>/artifacts: the files of the artifact folders of a job (output/, runs/, results/) */
|
|
860
902
|
export interface JobArtifacts {
|
|
861
903
|
jr_job_id: string;
|
|
@@ -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 */
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -31,6 +31,9 @@ import type {
|
|
|
31
31
|
SettingsUpdateResponse,
|
|
32
32
|
UpdateCheck,
|
|
33
33
|
OrganizerGroups,
|
|
34
|
+
Project,
|
|
35
|
+
ProjectsInfo,
|
|
36
|
+
ProjectsSyncReport,
|
|
34
37
|
SyncStatus,
|
|
35
38
|
JobEnvironment,
|
|
36
39
|
JobArtifacts,
|
|
@@ -166,6 +169,16 @@ export const cancelSlurmJob = async (jobId: string): Promise<{ success: boolean;
|
|
|
166
169
|
}
|
|
167
170
|
};
|
|
168
171
|
|
|
172
|
+
/** scontrol release of a held job (a pipeline step submitted with --hold) */
|
|
173
|
+
export const releaseSlurmJob = async (jobId: string): Promise<{ success: boolean; message?: string; error?: string }> => {
|
|
174
|
+
try {
|
|
175
|
+
const response = await api.post(`/release/${jobId}`);
|
|
176
|
+
return response.data;
|
|
177
|
+
} catch (error) {
|
|
178
|
+
return handleError(error);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
169
182
|
export const getSlurmJobInfo = async (jrJobId: string, jobId?: string): Promise<SlurmJobDetail> => {
|
|
170
183
|
try {
|
|
171
184
|
const url = jobId
|
|
@@ -401,6 +414,8 @@ export const submitSlurmJob = async (request: {
|
|
|
401
414
|
dependency?: [string, string][];
|
|
402
415
|
/** Files for the job: <job folder>/input/<name> on the cluster before it starts ($BUJANG_INPUT_DIR). */
|
|
403
416
|
files?: JobAttachment[];
|
|
417
|
+
/** A registered project: the job folder is linked into its repository (see getProjects). */
|
|
418
|
+
project?: string;
|
|
404
419
|
}): Promise<SlurmJobSubmitResponse> => {
|
|
405
420
|
try {
|
|
406
421
|
const response = await api.post('/submit', request);
|
|
@@ -636,6 +651,40 @@ export const getOrganizers = async (): Promise<OrganizerGroups[]> => {
|
|
|
636
651
|
} catch (error) { return handleError(error); }
|
|
637
652
|
};
|
|
638
653
|
|
|
654
|
+
/** The registered projects: code repositories the jobs tagged for them are linked into. */
|
|
655
|
+
export const getProjects = async (): Promise<ProjectsInfo> => {
|
|
656
|
+
try {
|
|
657
|
+
const response = await api.get('/projects');
|
|
658
|
+
return response.data;
|
|
659
|
+
} catch (error) { return handleError(error); }
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
/** Register a repository (or change its folder): makes <path>/<folder> and links the jobs already tagged. */
|
|
663
|
+
export const registerProject = async (
|
|
664
|
+
body: { name: string; path: string; folder?: string },
|
|
665
|
+
): Promise<{ project: Project; sync?: ProjectsSyncReport[string] }> => {
|
|
666
|
+
try {
|
|
667
|
+
const response = await api.post('/projects', body);
|
|
668
|
+
return response.data;
|
|
669
|
+
} catch (error) { return handleError(error); }
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
/** Forget a project: its links leave the repository, the other files of the folder stay. */
|
|
673
|
+
export const removeProject = async (name: string): Promise<{ name: string; removed: string[] }> => {
|
|
674
|
+
try {
|
|
675
|
+
const response = await api.delete(`/projects/${encodeURIComponent(name)}`);
|
|
676
|
+
return response.data;
|
|
677
|
+
} catch (error) { return handleError(error); }
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
/** Relink the jobs into the repositories now (one project, or all). */
|
|
681
|
+
export const syncProjects = async (name?: string): Promise<ProjectsSyncReport> => {
|
|
682
|
+
try {
|
|
683
|
+
const response = await api.post('/projects/sync', name ? { name } : {});
|
|
684
|
+
return response.data;
|
|
685
|
+
} catch (error) { return handleError(error); }
|
|
686
|
+
};
|
|
687
|
+
|
|
639
688
|
/** The running version against PyPI; the server asks PyPI once a day, `force` asks now. */
|
|
640
689
|
export const getUpdateCheck = async (force = false): Promise<UpdateCheck> => {
|
|
641
690
|
try {
|
|
@@ -758,10 +807,13 @@ export const savePipelineToFile = async (pipelineData: PipelineTemplatePayload):
|
|
|
758
807
|
}
|
|
759
808
|
};
|
|
760
809
|
|
|
761
|
-
export const runPipelineTemplate = async (
|
|
810
|
+
export const runPipelineTemplate = async (
|
|
811
|
+
name: string,
|
|
812
|
+
options: { experiment?: string; project?: string } = {},
|
|
813
|
+
): Promise<PipelineRunResponse> => {
|
|
762
814
|
try {
|
|
763
815
|
// Returns right away, the jobs are submitted in the background (see getPipelineRunStatus)
|
|
764
|
-
const response = await api.post(`/pipeline/run/${encodeURIComponent(name)}`, { context: {} });
|
|
816
|
+
const response = await api.post(`/pipeline/run/${encodeURIComponent(name)}`, { context: {}, ...options });
|
|
765
817
|
return response.data;
|
|
766
818
|
} catch (error) {
|
|
767
819
|
return handleError(error);
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { PipelinesView, PipelineDetailsView } from './views/PipelinesView';
|
|
|
7
7
|
export { PipelineGraph, pipelineMermaid, pipelineSteps } from './views/PipelineGraph';
|
|
8
8
|
export type { GraphStep } from './views/PipelineGraph';
|
|
9
9
|
export { ScheduledJobsView } from './views/ScheduledJobsView';
|
|
10
|
+
export { ProjectsView } from './views/ProjectsView';
|
|
10
11
|
export { AgentActivityView, AgentBadge, McpHelp } from './views/AgentActivityView';
|
|
11
12
|
export { SettingsView } from './views/SettingsView';
|
|
12
13
|
export { JanitorView } from './views/JanitorView';
|
package/src/paths.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IconType } from 'react-icons';
|
|
2
|
-
import { LuBot, LuBrush, LuCalendarClock, LuList, LuRocket, LuSend, LuSettings, LuWorkflow } from 'react-icons/lu';
|
|
2
|
+
import { LuBot, LuBrush, LuCalendarClock, LuFolderGit2, LuList, LuRocket, LuSend, LuSettings, LuWorkflow } from 'react-icons/lu';
|
|
3
3
|
|
|
4
4
|
/** Names of the bujang views. */
|
|
5
5
|
export type BujangView =
|
|
@@ -10,6 +10,7 @@ export type BujangView =
|
|
|
10
10
|
| 'pipelines'
|
|
11
11
|
| 'pipelineDetails'
|
|
12
12
|
| 'scheduled'
|
|
13
|
+
| 'projects'
|
|
13
14
|
| 'agent'
|
|
14
15
|
| 'janitor'
|
|
15
16
|
| 'setup'
|
|
@@ -25,6 +26,8 @@ export interface BujangPaths {
|
|
|
25
26
|
/** One saved pipeline: its graph and its runs, `runId` shows that run. */
|
|
26
27
|
pipelineDetails: (name: string, runId?: string) => string;
|
|
27
28
|
scheduled: () => string;
|
|
29
|
+
/** Registered code repositories and the jobs linked into them. `name` links to one project's card. */
|
|
30
|
+
projects: (name?: string) => string;
|
|
28
31
|
/** Agent activity, optionally filtered on one session. */
|
|
29
32
|
agent: (session?: string) => string;
|
|
30
33
|
/** Janitor: background tasks (running, periodic, history), sync queue, cleanups. `section`: a card id. */
|
|
@@ -47,6 +50,7 @@ export const defaultRoutePatterns: Record<BujangView, string> = {
|
|
|
47
50
|
pipelines: '/pipelines',
|
|
48
51
|
pipelineDetails: '/pipelines/:pipelineName',
|
|
49
52
|
scheduled: '/scheduled',
|
|
53
|
+
projects: '/projects',
|
|
50
54
|
agent: '/agent',
|
|
51
55
|
janitor: '/janitor',
|
|
52
56
|
setup: '/setup',
|
|
@@ -72,6 +76,7 @@ export function createBujangPaths(basePath: string = ''): BujangPaths {
|
|
|
72
76
|
pipelines: () => `${b}/pipelines`,
|
|
73
77
|
pipelineDetails: (name, runId) => `${b}/pipelines/${seg(name)}${runId ? `?run=${encodeURIComponent(runId)}` : ''}`,
|
|
74
78
|
scheduled: () => `${b}/scheduled`,
|
|
79
|
+
projects: (name) => `${b}/projects${name ? `#${encodeURIComponent(`project-${name}`)}` : ''}`,
|
|
75
80
|
agent: (session) => (session ? `${b}/agent?session=${encodeURIComponent(session)}` : `${b}/agent`),
|
|
76
81
|
janitor: (section) => `${b}/janitor${section ? `#${encodeURIComponent(section)}` : ''}`,
|
|
77
82
|
settings: (section) => `${b}/settings${section ? `#${encodeURIComponent(section)}` : ''}`,
|
|
@@ -95,6 +100,7 @@ export function bujangNavItems(paths: BujangPaths = createBujangPaths()): Bujang
|
|
|
95
100
|
{ view: 'submitJob', label: 'Submit Job', path: paths.submitJob(), icon: LuSend },
|
|
96
101
|
{ view: 'scheduled', label: 'Scheduled Jobs', path: paths.scheduled(), icon: LuCalendarClock },
|
|
97
102
|
{ view: 'pipelines', label: 'Pipelines', path: paths.pipelines(), icon: LuWorkflow },
|
|
103
|
+
{ view: 'projects', label: 'Projects', path: paths.projects(), icon: LuFolderGit2 },
|
|
98
104
|
{ view: 'agent', label: 'Agent Activity', path: paths.agent(), icon: LuBot },
|
|
99
105
|
{ view: 'janitor', label: 'Janitor', path: paths.janitor(), icon: LuBrush },
|
|
100
106
|
{ view: 'settings', label: 'Settings', path: paths.settings(), icon: LuSettings },
|
package/src/routes.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import { JobDetailsView } from './views/JobDetails';
|
|
|
8
8
|
import { JobLogsView } from './views/JobLogs';
|
|
9
9
|
import { PipelineDetailsView, PipelinesView } from './views/PipelinesView';
|
|
10
10
|
import { ScheduledJobsView } from './views/ScheduledJobsView';
|
|
11
|
+
import { ProjectsView } from './views/ProjectsView';
|
|
11
12
|
import { AgentActivityView } from './views/AgentActivityView';
|
|
12
13
|
import { SettingsView } from './views/SettingsView';
|
|
13
14
|
import { JanitorView } from './views/JanitorView';
|
|
@@ -35,6 +36,7 @@ const elements: Record<BujangView, () => React.ReactElement> = {
|
|
|
35
36
|
pipelines: () => <PipelinesView />,
|
|
36
37
|
pipelineDetails: () => <PipelineDetailsView />,
|
|
37
38
|
scheduled: () => <ScheduledJobsView />,
|
|
39
|
+
projects: () => <ProjectsView />,
|
|
38
40
|
agent: () => <AgentActivityView />,
|
|
39
41
|
janitor: () => <JanitorView />,
|
|
40
42
|
setup: () => <SetupView />,
|
|
@@ -44,7 +46,7 @@ const elements: Record<BujangView, () => React.ReactElement> = {
|
|
|
44
46
|
/**
|
|
45
47
|
* Route objects for the default bujang URL layout under `basePath`:
|
|
46
48
|
* /jobs, /jobs/submit, /jobrunner/:slurmJobId/:jrJobId, /joblogs/:slurmJobId/:jrJobId,
|
|
47
|
-
* /pipelines, /pipelines/:pipelineName, /scheduled, /agent, /janitor, /setup, /settings.
|
|
49
|
+
* /pipelines, /pipelines/:pipelineName, /scheduled, /projects, /agent, /janitor, /setup, /settings.
|
|
48
50
|
*/
|
|
49
51
|
export function bujangRoutes(options: BujangRoutesOptions = {}): BujangRouteObject[] {
|
|
50
52
|
const base = normalizeBasePath(options.basePath);
|
package/src/types.ts
CHANGED
|
@@ -184,6 +184,10 @@ export interface SlurmClusterStatus {
|
|
|
184
184
|
|
|
185
185
|
export interface SlurmJobStatusResponse {
|
|
186
186
|
status: string;
|
|
187
|
+
/** pending jobs: the squeue reason (JobHeldUser, Dependency, Resources, ...) */
|
|
188
|
+
reason?: string;
|
|
189
|
+
/** pending and held (--hold): waits for `scontrol release` */
|
|
190
|
+
held?: boolean;
|
|
187
191
|
}
|
|
188
192
|
|
|
189
193
|
export interface SlurmJobAccounting {
|
|
@@ -395,6 +399,8 @@ export interface PipelineRunSummary {
|
|
|
395
399
|
/** A step of a run with its current state (sacct/squeue state, HELD, or the ssh step state) */
|
|
396
400
|
export interface PipelineRunStep extends PipelineJob {
|
|
397
401
|
step?: string;
|
|
402
|
+
/** the resolved label of the job (`label` is the template) */
|
|
403
|
+
job_label?: string;
|
|
398
404
|
/** the value of the sweep variable of its parallel group (what tells it apart from its siblings) */
|
|
399
405
|
sweep?: string;
|
|
400
406
|
/** the env variable `sweep` is the value of */
|
|
@@ -917,6 +923,41 @@ export interface OrganizerGroups {
|
|
|
917
923
|
groups: { value: string; jobs: string[] }[];
|
|
918
924
|
}
|
|
919
925
|
|
|
926
|
+
/** A code repository registered as a project: its jobs are linked into `target` (GET /projects) */
|
|
927
|
+
export interface Project {
|
|
928
|
+
name: string;
|
|
929
|
+
/** the repository on the machine of the bujang server */
|
|
930
|
+
path: string;
|
|
931
|
+
/** folder inside the repository, relative ("bujang") */
|
|
932
|
+
folder: string;
|
|
933
|
+
/** path/folder: where the job links are */
|
|
934
|
+
target: string;
|
|
935
|
+
created: number | null;
|
|
936
|
+
/** the repository folder exists */
|
|
937
|
+
exists: boolean;
|
|
938
|
+
/** it is a git repository */
|
|
939
|
+
git: boolean;
|
|
940
|
+
/** jobs tagged for the project (runs and their steps) */
|
|
941
|
+
jobs: number;
|
|
942
|
+
/** links in the repository folder */
|
|
943
|
+
links: number;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
export interface ProjectsInfo {
|
|
947
|
+
projects: Project[];
|
|
948
|
+
/** folder used when a registration gives none (the `project_folder` setting) */
|
|
949
|
+
default_folder: string;
|
|
950
|
+
/** false: the `projects` organizer is not loaded (the `organizers` setting), nothing is linked */
|
|
951
|
+
enabled: boolean;
|
|
952
|
+
/** registering and removing need a server that allows edits (settings_writable) */
|
|
953
|
+
writable: boolean;
|
|
954
|
+
/** script argument that tags a job too (export BUJANG_PROJECT=<name>) */
|
|
955
|
+
argument: string;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/** POST /projects/sync: per project, the links added and removed (or the error) */
|
|
959
|
+
export type ProjectsSyncReport = Record<string, { added?: string[]; removed?: string[]; error?: string }>;
|
|
960
|
+
|
|
920
961
|
/** GET /jobs/<jr>/artifacts: the files of the artifact folders of a job (output/, runs/, results/) */
|
|
921
962
|
export interface JobArtifacts {
|
|
922
963
|
jr_job_id: string;
|
package/src/views/JobLogs.tsx
CHANGED
|
@@ -21,9 +21,9 @@ import {
|
|
|
21
21
|
SegmentGroup,
|
|
22
22
|
} from '@chakra-ui/react';
|
|
23
23
|
import { toaster } from '../toast';
|
|
24
|
-
import { LuArrowLeft, LuRefreshCw, LuX, LuInfo, LuClock, LuPencil, LuTimer } from 'react-icons/lu';
|
|
24
|
+
import { LuArrowLeft, LuRefreshCw, LuX, LuInfo, LuClock, LuPencil, LuTimer, LuPlay } from 'react-icons/lu';
|
|
25
25
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
26
|
-
import { getSlurmJobStdoutFull, getSlurmJobStderrFull, getSlurmJobStdoutSize, getSlurmJobStderrSize, getSlurmJobStatusSimple, getSshJobStatus, getSlurmJobAccounting, rerunSlurmJob, cancelSlurmJob, getSlurmJobInfo, getSlurmJobCluster, getSlurmClusterStatus, earlySyncJob, getSlurmJobScript, getSlurmTemplates, getSlurmProfiles, getSlurmClusters } from '../api';
|
|
26
|
+
import { getSlurmJobStdoutFull, getSlurmJobStderrFull, getSlurmJobStdoutSize, getSlurmJobStderrSize, getSlurmJobStatusSimple, getSshJobStatus, getSlurmJobAccounting, rerunSlurmJob, cancelSlurmJob, releaseSlurmJob, getSlurmJobInfo, getSlurmJobCluster, getSlurmClusterStatus, earlySyncJob, getSlurmJobScript, getSlurmTemplates, getSlurmProfiles, getSlurmClusters } from '../api';
|
|
27
27
|
import { JobSubmissionForm } from './JobSubmit';
|
|
28
28
|
import type { JobSubmissionInitialData } from './JobSubmit';
|
|
29
29
|
import { LogDisplay } from './LogDisplay';
|
|
@@ -460,6 +460,34 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
|
|
|
460
460
|
}
|
|
461
461
|
};
|
|
462
462
|
|
|
463
|
+
// Release state: a held job (pipeline step submitted with --hold)
|
|
464
|
+
const [isReleasing, setIsReleasing] = useState(false);
|
|
465
|
+
const isHeld = !!jobStatusData?.held && jobStatus?.toUpperCase() === 'PENDING';
|
|
466
|
+
|
|
467
|
+
const handleRelease = async () => {
|
|
468
|
+
if (!slurmJobId || slurmJobId === '-') return;
|
|
469
|
+
setIsReleasing(true);
|
|
470
|
+
try {
|
|
471
|
+
const result = await releaseSlurmJob(slurmJobId);
|
|
472
|
+
toaster.create({
|
|
473
|
+
title: result.success ? 'Job Released' : 'Release Failed',
|
|
474
|
+
description: result.success ? (result.message || `Job ${slurmJobId} released`) : (result.error || 'Failed to release job'),
|
|
475
|
+
type: result.success ? 'success' : 'error',
|
|
476
|
+
duration: 5000,
|
|
477
|
+
});
|
|
478
|
+
if (result.success) refetchStatus();
|
|
479
|
+
} catch (error) {
|
|
480
|
+
toaster.create({
|
|
481
|
+
title: 'Release Failed',
|
|
482
|
+
description: (error as ApiError).message || 'An unexpected error occurred',
|
|
483
|
+
type: 'error',
|
|
484
|
+
duration: 5000,
|
|
485
|
+
});
|
|
486
|
+
} finally {
|
|
487
|
+
setIsReleasing(false);
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
|
|
463
491
|
const handleEarlySync = async () => {
|
|
464
492
|
if (!jrJobId || !slurmJobId || slurmJobId === '-') {
|
|
465
493
|
toaster.create({
|
|
@@ -736,6 +764,18 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
|
|
|
736
764
|
Auto
|
|
737
765
|
</Button>
|
|
738
766
|
</HStack>
|
|
767
|
+
{isHeld && (
|
|
768
|
+
<Button
|
|
769
|
+
variant="outline"
|
|
770
|
+
colorScheme="orange"
|
|
771
|
+
onClick={handleRelease}
|
|
772
|
+
loading={isReleasing}
|
|
773
|
+
title={`Held (${jobStatusData?.reason}): scontrol release lets slurm schedule it`}
|
|
774
|
+
>
|
|
775
|
+
<LuPlay />
|
|
776
|
+
Release Job
|
|
777
|
+
</Button>
|
|
778
|
+
)}
|
|
739
779
|
{canCancelJob(jobStatus) && (
|
|
740
780
|
<Button
|
|
741
781
|
variant="outline"
|
|
@@ -837,6 +877,11 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
|
|
|
837
877
|
<Badge colorScheme={getStatusColor(jobStatus)}>
|
|
838
878
|
{jobStatus}
|
|
839
879
|
</Badge>
|
|
880
|
+
{jobStatusData?.reason && jobStatus.toUpperCase() === 'PENDING' && (
|
|
881
|
+
<Badge ml={1} colorPalette={isHeld ? 'orange' : 'gray'} title="squeue pending reason">
|
|
882
|
+
{isHeld ? `HELD (${jobStatusData.reason})` : jobStatusData.reason}
|
|
883
|
+
</Badge>
|
|
884
|
+
)}
|
|
840
885
|
</WrapItem>
|
|
841
886
|
)}
|
|
842
887
|
{statusLoading && (
|
package/src/views/JobSubmit.tsx
CHANGED
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
createScheduledJob,
|
|
36
36
|
fileToAttachment,
|
|
37
37
|
getJobEnvironment,
|
|
38
|
+
getProjects,
|
|
38
39
|
} from '../api';
|
|
39
40
|
import type { SlurmProfile, SlurmJob, ApiError, ScheduledJob, JobEnvironment } from '../types';
|
|
40
41
|
|
|
@@ -340,6 +341,11 @@ export const JobSubmissionForm: React.FC<JobSubmissionFormProps> = ({
|
|
|
340
341
|
// Schedule dialog (name and cron expression)
|
|
341
342
|
const [scheduleOpen, setScheduleOpen] = useState(false);
|
|
342
343
|
|
|
344
|
+
// a registered project: the job folder is linked into its repository (?project=<name> picks one)
|
|
345
|
+
const { data: projectsInfo } = useQuery({ queryKey: ['bujang-projects'], queryFn: getProjects, staleTime: 60_000, retry: false });
|
|
346
|
+
const projectNames = useMemo(() => (projectsInfo?.projects ?? []).map(p => p.name), [projectsInfo]);
|
|
347
|
+
const [project, setProject] = useState<string>(() => (syncUrl ? searchParams.get('project') : null) || '');
|
|
348
|
+
|
|
343
349
|
// Mutations
|
|
344
350
|
const sshGate = useSshConnectGate();
|
|
345
351
|
const submitJobMutation = useMutation({
|
|
@@ -668,6 +674,7 @@ export const JobSubmissionForm: React.FC<JobSubmissionFormProps> = ({
|
|
|
668
674
|
sbatch_args: _collectSbatchArgs(),
|
|
669
675
|
script_args: _collectScriptArgs(),
|
|
670
676
|
files,
|
|
677
|
+
project: project || undefined,
|
|
671
678
|
};
|
|
672
679
|
// a cluster without an open ssh connection (MFA): log in first, then submit
|
|
673
680
|
await sshGate.ensure(selectedCluster, () => submitJobMutation.mutate(request));
|
|
@@ -938,6 +945,21 @@ export const JobSubmissionForm: React.FC<JobSubmissionFormProps> = ({
|
|
|
938
945
|
</Button>
|
|
939
946
|
</>
|
|
940
947
|
)}
|
|
948
|
+
{projectNames.length > 0 && (
|
|
949
|
+
<NativeSelect.Root size="sm" w="200px" flexShrink={0} title="Link the job folder into the repository of a project">
|
|
950
|
+
<NativeSelect.Field
|
|
951
|
+
value={project}
|
|
952
|
+
onChange={(e) => setProject(e.target.value)}
|
|
953
|
+
bg="var(--color-input-bg)"
|
|
954
|
+
borderColor="var(--color-input-border)"
|
|
955
|
+
color="var(--color-text)"
|
|
956
|
+
>
|
|
957
|
+
<option value="">no project</option>
|
|
958
|
+
{projectNames.map(name => <option key={name} value={name}>project: {name}</option>)}
|
|
959
|
+
</NativeSelect.Field>
|
|
960
|
+
<NativeSelect.Indicator />
|
|
961
|
+
</NativeSelect.Root>
|
|
962
|
+
)}
|
|
941
963
|
<Button
|
|
942
964
|
onClick={handleSubmitJob}
|
|
943
965
|
loading={submitJobMutation.isPending}
|
package/src/views/JobsTable.tsx
CHANGED
|
@@ -24,9 +24,10 @@ import {
|
|
|
24
24
|
LuArrowUpDown,
|
|
25
25
|
LuCircleCheck,
|
|
26
26
|
LuClock,
|
|
27
|
-
LuEye,
|
|
28
27
|
LuFilter,
|
|
29
28
|
LuInfo,
|
|
29
|
+
LuPause,
|
|
30
|
+
LuPlay,
|
|
30
31
|
LuRefreshCw,
|
|
31
32
|
LuTrash2,
|
|
32
33
|
LuTriangleAlert,
|
|
@@ -65,8 +66,17 @@ export interface JobRow {
|
|
|
65
66
|
freshness: number | null;
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
/** squeue reasons of a held job (submitted with --hold, waits for `scontrol release`) */
|
|
70
|
+
const HELD_REASONS = ['JobHeldUser', 'JobHeldAdmin'];
|
|
71
|
+
|
|
72
|
+
/** PENDING shown as HELD when the job waits for a release, not for resources */
|
|
73
|
+
const withHeld = (status: string, job: Partial<SlurmJob> & { hold?: boolean }): string =>
|
|
74
|
+
status.toUpperCase() === 'PENDING' && (job.hold || HELD_REASONS.includes(job.state_reason ?? ''))
|
|
75
|
+
? 'HELD'
|
|
76
|
+
: status;
|
|
77
|
+
|
|
68
78
|
export const fromActive = (job: SlurmJob): JobRow => {
|
|
69
|
-
const status = job.job_state?.[0] || NO_JOB_STATE;
|
|
79
|
+
const status = withHeld(job.job_state?.[0] || NO_JOB_STATE, job);
|
|
70
80
|
const limit = typeof job.time_limit === 'string' ? null : job.time_limit?.number ?? null;
|
|
71
81
|
return {
|
|
72
82
|
key: `active-${job.cluster ?? ''}-${job.job_id}`,
|
|
@@ -111,7 +121,7 @@ export const fromPersisted = (p: PersitedJobInfo): JobRow => {
|
|
|
111
121
|
jobId: acc?.job_id?.toString() || job.job_id || '-',
|
|
112
122
|
jrJobId: p.name,
|
|
113
123
|
name: p.label || acc?.name || job.name || job.job_name || 'Persisted Job',
|
|
114
|
-
status: acc?.state?.current?.[0] || job.job_state?.[0] || 'PENDING',
|
|
124
|
+
status: acc?.state?.current?.[0] || withHeld(job.job_state?.[0] || 'PENDING', job),
|
|
115
125
|
cluster: p.cluster || 'mila',
|
|
116
126
|
partition: acc?.partition || job.partition || 'N/A',
|
|
117
127
|
user: acc?.user || job.user_name || job.user || 'N/A',
|
|
@@ -159,6 +169,8 @@ const getStatusColor = (status: string) => {
|
|
|
159
169
|
case 'pending':
|
|
160
170
|
case 'pd':
|
|
161
171
|
return 'yellow';
|
|
172
|
+
case 'held':
|
|
173
|
+
return 'orange';
|
|
162
174
|
case 'completed':
|
|
163
175
|
case 'cd':
|
|
164
176
|
return 'blue';
|
|
@@ -178,6 +190,8 @@ const getStatusIcon = (status: string) => {
|
|
|
178
190
|
case 'pending':
|
|
179
191
|
case 'pd':
|
|
180
192
|
return <LuClock color="var(--color-status-pending)" />;
|
|
193
|
+
case 'held':
|
|
194
|
+
return <LuPause color="var(--color-status-pending)" />;
|
|
181
195
|
case 'completed':
|
|
182
196
|
case 'cd':
|
|
183
197
|
return <LuCircleCheck color="var(--color-status-completed)" />;
|
|
@@ -189,9 +203,9 @@ const getStatusIcon = (status: string) => {
|
|
|
189
203
|
}
|
|
190
204
|
};
|
|
191
205
|
|
|
192
|
-
const isLive = (status: string) => ['running', 'pending', 'r', 'pd'].includes(status.toLowerCase());
|
|
206
|
+
const isLive = (status: string) => ['running', 'pending', 'held', 'r', 'pd'].includes(status.toLowerCase());
|
|
193
207
|
/** still in slurm's hands (not only running/pending): rerunning it now would duplicate it */
|
|
194
|
-
const UNFINISHED = ['running', 'pending', 'r', 'pd', 'configuring', 'cf', 'completing', 'cg', 'suspended', 's',
|
|
208
|
+
const UNFINISHED = ['running', 'pending', 'held', 'r', 'pd', 'configuring', 'cf', 'completing', 'cg', 'suspended', 's',
|
|
195
209
|
'requeued', 'rq', 'requeue_hold', 'rh', 'requeue_fed', 'rf', 'resizing', 'rs', 'stage_out', 'so', 'signaling', 'si'];
|
|
196
210
|
const isFinal = (status: string) => !UNFINISHED.includes(status.toLowerCase());
|
|
197
211
|
|
|
@@ -398,6 +412,7 @@ interface JobsTableProps {
|
|
|
398
412
|
/** caps the rows' height; without it they fill the card (give the card a height, e.g. flex: 1) */
|
|
399
413
|
maxH?: string;
|
|
400
414
|
onCancel: (jobId: string) => void;
|
|
415
|
+
onRelease: (jobId: string) => void;
|
|
401
416
|
onRerun: (jrJobId: string) => void;
|
|
402
417
|
onGroup: (group: string) => void;
|
|
403
418
|
/** quick filters (important, organizers), in the header next to the title */
|
|
@@ -414,6 +429,7 @@ export const JobsTable: React.FC<JobsTableProps & { cardProps?: React.ComponentP
|
|
|
414
429
|
emptyHint,
|
|
415
430
|
maxH,
|
|
416
431
|
onCancel,
|
|
432
|
+
onRelease,
|
|
417
433
|
onRerun,
|
|
418
434
|
onGroup,
|
|
419
435
|
quickFilters,
|
|
@@ -613,6 +629,7 @@ export const JobsTable: React.FC<JobsTableProps & { cardProps?: React.ComponentP
|
|
|
613
629
|
logsPath={paths.jobLogs(row.jobId, row.jrJobId || NO_JR_JOB_ID)}
|
|
614
630
|
pipelinePath={row.pipeline ? paths.pipelineDetails(row.pipeline.name, row.pipeline.run_id) : null}
|
|
615
631
|
onCancel={onCancel}
|
|
632
|
+
onRelease={onRelease}
|
|
616
633
|
onRerun={onRerun}
|
|
617
634
|
onGroup={onGroup}
|
|
618
635
|
/>
|
|
@@ -632,9 +649,10 @@ const JobRowView: React.FC<{
|
|
|
632
649
|
logsPath: string;
|
|
633
650
|
pipelinePath: string | null;
|
|
634
651
|
onCancel: (jobId: string) => void;
|
|
652
|
+
onRelease: (jobId: string) => void;
|
|
635
653
|
onRerun: (jrJobId: string) => void;
|
|
636
654
|
onGroup: (group: string) => void;
|
|
637
|
-
}> = ({ row, striped, logsPath, pipelinePath, onCancel, onRerun, onGroup }) => (
|
|
655
|
+
}> = ({ row, striped, logsPath, pipelinePath, onCancel, onRelease, onRerun, onGroup }) => (
|
|
638
656
|
<Table.Row _hover={{ bg: 'var(--color-bg-hover)' }} bg={striped ? 'var(--color-bg-stripe)' : 'transparent'}>
|
|
639
657
|
<Table.Cell pl={6} pr={4}>
|
|
640
658
|
<HStack gap={2}>
|
|
@@ -666,15 +684,12 @@ const JobRowView: React.FC<{
|
|
|
666
684
|
</Table.Cell>
|
|
667
685
|
<Table.Cell>
|
|
668
686
|
<HStack gap={2} flexWrap="wrap">
|
|
669
|
-
{/* the
|
|
670
|
-
<
|
|
671
|
-
<
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
</Link>
|
|
676
|
-
</Tooltip>
|
|
677
|
-
<Text color="var(--color-text)">{row.name}</Text>
|
|
687
|
+
{/* the name opens the logs (away from cancel at the end of the row: no misclick) */}
|
|
688
|
+
<Link to={logsPath} title="View Logs">
|
|
689
|
+
<Text color="var(--color-text)" _hover={{ textDecoration: 'underline', color: 'var(--color-link, var(--color-primary))' }}>
|
|
690
|
+
{row.name}
|
|
691
|
+
</Text>
|
|
692
|
+
</Link>
|
|
678
693
|
{row.groups.map((g) => (
|
|
679
694
|
<Badge
|
|
680
695
|
key={g}
|
|
@@ -733,6 +748,13 @@ const JobRowView: React.FC<{
|
|
|
733
748
|
</IconButton>
|
|
734
749
|
</Tooltip>
|
|
735
750
|
)}
|
|
751
|
+
{row.active && row.status.toUpperCase() === 'HELD' && row.jobId !== NO_JOB_ID && (
|
|
752
|
+
<Tooltip positioning={{ placement: 'top', offset: { mainAxis: 8 } }} content="Release Job (scontrol release)">
|
|
753
|
+
<IconButton aria-label="Release job" size="xs" variant="ghost" colorScheme="orange" onClick={() => onRelease(row.jobId)}>
|
|
754
|
+
<LuPlay />
|
|
755
|
+
</IconButton>
|
|
756
|
+
</Tooltip>
|
|
757
|
+
)}
|
|
736
758
|
{row.active && isLive(row.status) && row.jobId !== NO_JOB_ID && (
|
|
737
759
|
<Tooltip positioning={{ placement: 'top', offset: { mainAxis: 8 } }} content="Cancel Job">
|
|
738
760
|
<IconButton aria-label="Cancel job" size="xs" variant="ghost" colorScheme="red" onClick={() => onCancel(row.jobId)}>
|
package/src/views/JobsView.tsx
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
getSlurmPersistedJobs,
|
|
20
20
|
cancelSlurmJob,
|
|
21
21
|
rerunSlurmJob,
|
|
22
|
+
releaseSlurmJob,
|
|
22
23
|
getOrganizers,
|
|
23
24
|
getSyncStatus,
|
|
24
25
|
syncNow,
|
|
@@ -256,6 +257,27 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
256
257
|
},
|
|
257
258
|
});
|
|
258
259
|
|
|
260
|
+
const releaseJobMutation = useMutation({
|
|
261
|
+
mutationFn: releaseSlurmJob,
|
|
262
|
+
onSuccess: (data) => {
|
|
263
|
+
toaster.create({
|
|
264
|
+
title: 'Job Released',
|
|
265
|
+
description: data.message || 'Job released',
|
|
266
|
+
type: 'success',
|
|
267
|
+
duration: 5000,
|
|
268
|
+
});
|
|
269
|
+
queryClient.invalidateQueries({ queryKey: ['slurm-jobs'] });
|
|
270
|
+
},
|
|
271
|
+
onError: (error: ApiError) => {
|
|
272
|
+
toaster.create({
|
|
273
|
+
title: 'Release Failed',
|
|
274
|
+
description: error.message || 'Failed to release job',
|
|
275
|
+
type: 'error',
|
|
276
|
+
duration: 5000,
|
|
277
|
+
});
|
|
278
|
+
},
|
|
279
|
+
});
|
|
280
|
+
|
|
259
281
|
const rerunJobMutation = useMutation({
|
|
260
282
|
mutationFn: rerunSlurmJob,
|
|
261
283
|
onSuccess: (data) => {
|
|
@@ -293,6 +315,7 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
293
315
|
};
|
|
294
316
|
const tableActions = {
|
|
295
317
|
onCancel: handleCancelJob,
|
|
318
|
+
onRelease: (jobId: string) => releaseJobMutation.mutate(jobId),
|
|
296
319
|
onRerun: handleRerunJob,
|
|
297
320
|
onGroup: (g: string) => setFilter('groups', g),
|
|
298
321
|
};
|