@milabench/bujang 0.1.17 → 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.
@@ -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}
@@ -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 view before the name, away from cancel at the end of the row: no misclick */}
670
- <Tooltip positioning={{ placement: 'top', offset: { mainAxis: 8 } }} content="View Logs">
671
- <Link to={logsPath}>
672
- <IconButton aria-label="View job logs" size="xs" variant="ghost">
673
- <LuEye />
674
- </IconButton>
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)}>
@@ -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
  };
@@ -10,6 +10,7 @@ import { formatSize } from './JobArtifacts';
10
10
  import {
11
11
  FILE_FIELDS,
12
12
  ROW_LIMIT,
13
+ SkipInput,
13
14
  VegaChart,
14
15
  buildSpec,
15
16
  builderOfPanel,
@@ -18,6 +19,7 @@ import {
18
19
  mergeFields,
19
20
  panelEvents,
20
21
  panelFiles,
22
+ skipFirst,
21
23
  specFields,
22
24
  } from './dataCharts';
23
25
 
@@ -828,7 +830,13 @@ const useChart = (jrJobId: string, files: JobData['files'], panel: ChartBlock) =
828
830
  };
829
831
 
830
832
  /** The chart of a block, or why there is none */
831
- const ChartView: React.FC<{ chart: ReturnType<typeof useChart>; files?: string }> = ({ chart, files }) => (
833
+ const ChartView: React.FC<{
834
+ chart: ReturnType<typeof useChart>;
835
+ /** the rows drawn, those of the chart when absent */
836
+ rows?: Record<string, unknown>[];
837
+ files?: string;
838
+ controls?: HTMLElement | null;
839
+ }> = ({ chart, rows = chart.rows, files, controls }) => (
832
840
  <>
833
841
  {!chart.fields.length && (
834
842
  <Text fontSize="sm" color="var(--color-text-muted)">
@@ -838,7 +846,7 @@ const ChartView: React.FC<{ chart: ReturnType<typeof useChart>; files?: string }
838
846
  {chart.error && (
839
847
  <Alert.Root status="error" mb={2}><Alert.Indicator /><Alert.Description>{chart.error.message}</Alert.Description></Alert.Root>
840
848
  )}
841
- {chart.ready && chart.spec && chart.rows && <VegaChart spec={chart.spec} rows={chart.rows} />}
849
+ {chart.ready && chart.spec && rows && <VegaChart spec={chart.spec} rows={rows} controls={controls} />}
842
850
  </>
843
851
  );
844
852
 
@@ -846,7 +854,17 @@ const ChartView: React.FC<{ chart: ReturnType<typeof useChart>; files?: string }
846
854
  export const ChartPanel: React.FC<PanelProps<'chart'>> = ({ jrJobId, files, panel, actions }) => {
847
855
  const chart = useChart(jrJobId, files, panel);
848
856
  const [open, setOpen] = useEditor(actions.onEditor);
857
+ // the inputs of the chart, on the line of its title
858
+ const [controls, setControls] = useState<HTMLElement | null>(null);
849
859
  const { event, rows, isFetching } = chart;
860
+ const [skip, setSkip] = useState(panel.skip ?? 0);
861
+ const shown = useMemo(() => rows && skipFirst(rows, chart.spec, skip), [rows, chart.spec, skip]);
862
+ // kept in the layout when it is edited
863
+ const saveSkip = () => {
864
+ if (!actions.editing || skip === (panel.skip ?? 0)) return;
865
+ const { skip: _skip, ...rest } = panel;
866
+ actions.onChange(skip ? { ...rest, skip } : rest);
867
+ };
850
868
  return (
851
869
  <PanelFrame
852
870
  title={panel.title || event || 'records'}
@@ -856,9 +874,24 @@ export const ChartPanel: React.FC<PanelProps<'chart'>> = ({ jrJobId, files, pane
856
874
  info={<>
857
875
  {isFetching && <Spinner size="xs" />}
858
876
  {rows && <Text>{rows.length}{rows.length >= ROW_LIMIT ? '+' : ''} rows</Text>}
877
+ <SkipInput value={skip} onChange={setSkip} onDone={saveSkip} />
878
+ <Box
879
+ ref={setControls}
880
+ css={{
881
+ '& > div': { display: 'flex', flexWrap: 'wrap', gap: '8px' },
882
+ '& label': { display: 'flex', alignItems: 'center', gap: '4px' },
883
+ '& select, & input': {
884
+ color: 'var(--color-text)',
885
+ background: 'var(--color-bg-card)',
886
+ border: '1px solid var(--color-border)',
887
+ borderRadius: '4px',
888
+ padding: '1px 4px',
889
+ },
890
+ }}
891
+ />
859
892
  </>}
860
893
  >
861
- <ChartView chart={chart} files={panel.files} />
894
+ <ChartView chart={chart} rows={shown} files={panel.files} controls={controls} />
862
895
  {open && (
863
896
  <ChartEditor
864
897
  jrJobId={jrJobId}
@@ -927,6 +960,7 @@ const ChartEditor: React.FC<{
927
960
  onApply({
928
961
  // a spec left as drawn: the builder fields of the panel stay
929
962
  ...(text === initialText && !panel.spec ? fields : { kind: 'chart' as const, spec: parsed }),
963
+ ...(panel.skip ? { skip: panel.skip } : {}),
930
964
  ...(title.trim() ? { title: title.trim() } : {}),
931
965
  event,
932
966
  ...(paths.trim() ? { files: paths.trim() } : {}),
@@ -16,7 +16,7 @@ import {
16
16
  Textarea,
17
17
  VStack,
18
18
  } from '@chakra-ui/react';
19
- import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
19
+ import { useMutation, useQueries, useQuery, useQueryClient } from '@tanstack/react-query';
20
20
  import { LuPlus, LuTrash2 } from 'react-icons/lu';
21
21
  import { getSlurmTemplateContent, saveSlurmProfile, saveSlurmTemplate } from '../api';
22
22
  import type { ApiError, PipelineNode, PipelineTemplatePayload, SlurmProfile } from '../types';
@@ -116,6 +116,27 @@ const changeType = (node: PipelineNode, type: NodeType, fallback: { script: stri
116
116
  return { ...node, type };
117
117
  };
118
118
 
119
+ /** The `export NAME=CONSTANT` lines of a script, read as the server does to resolve the labels (script_arguments) */
120
+ const exportedConstants = (script: string): Record<string, string> => {
121
+ const out: Record<string, string> = {};
122
+ for (const [, name, raw] of script.matchAll(/^[ \t]*export[ \t]+([A-Za-z_][A-Za-z0-9_]*)[ \t]*=[ \t]*([^$\n\r]*?)[ \t]*\r?$/gm)) {
123
+ const value = raw.trim();
124
+ const quoted = value.length >= 2 && value[0] === value[value.length - 1] && `"'`.includes(value[0]);
125
+ out[name] = quoted ? value.slice(1, -1) : value;
126
+ }
127
+ return out;
128
+ };
129
+
130
+ /** The label a job will get (resolve_label of the server): its own, its nearest group's or its script's, `{NAME}` filled */
131
+ const resolvedLabel = (job: Extract<PipelineNode, { type: 'job' }>, inherited: string | undefined, script: string | undefined): string => {
132
+ const values: Record<string, string> = { ...exportedConstants(script ?? ''), ...(job.env ?? {}) };
133
+ const template = job.label || inherited || values.BUJANG_JOB_LABEL || values.JR_JOB_LABEL || '';
134
+ return template.replace(/\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (all, name: string) => String(values[name] ?? all)).split(/\s+/).filter(Boolean).join(' ').slice(0, 200);
135
+ };
136
+
137
+ /** The scripts of the jobs under a node */
138
+ const scriptsOf = (node: PipelineNode): string[] => (node.type === 'job' ? (node.script ? [node.script] : []) : node.jobs.flatMap(scriptsOf));
139
+
119
140
  const TYPE_LABEL: Record<NodeType, string> = { job: 'Job', sequential: 'Sequential', parallel: 'Parallel' };
120
141
  export const TYPE_COLOR: Record<NodeType, string> = {
121
142
  job: 'var(--color-pipeline-job-border)',
@@ -174,12 +195,17 @@ const TreeRows: React.FC<{
174
195
  onHover: (hover: Hover) => void;
175
196
  /** the sweep variable of the nearest parallel group above: its value names a job */
176
197
  sweepKey?: string;
177
- }> = ({ node, path, marker, selected, onSelect, onType, onDelete, onAdd, root, hover, onHover, sweepKey }) => {
198
+ /** the label of the nearest group above that has one */
199
+ groupLabel?: string;
200
+ /** the content of the scripts, to resolve the labels */
201
+ scripts: Record<string, string | undefined>;
202
+ }> = ({ node, path, marker, selected, onSelect, onType, onDelete, onAdd, root, hover, onHover, sweepKey, groupLabel, scripts }) => {
178
203
  const depth = path.length;
179
204
  const isSelected = samePath(selected, path);
180
205
  const swept = node.type === 'job' ? sweepValue(node.env, sweepKey) : undefined;
181
206
  const name = swept ?? nodeName(node);
182
207
  const childSweep = groupSweepKey(node) || sweepKey;
208
+ const label = node.type === 'job' ? resolvedLabel(node, groupLabel, scripts[node.script]) : '';
183
209
  const tint = hoverTint(hover, path, root);
184
210
  const deleting = hover?.mode === 'delete' && !!tint;
185
211
  return (
@@ -217,6 +243,7 @@ const TreeRows: React.FC<{
217
243
  {swept && node.type === 'job' && node.script && (
218
244
  <Text as="span" color="var(--color-text-muted)"> · {scriptStem(node.script)}</Text>
219
245
  )}
246
+ {label && <Text as="span" color="var(--color-text-muted)" title={label}> · {label}</Text>}
220
247
  </Text>
221
248
  {depth > 0 && (
222
249
  <IconButton
@@ -251,6 +278,8 @@ const TreeRows: React.FC<{
251
278
  hover={hover}
252
279
  onHover={onHover}
253
280
  sweepKey={childSweep}
281
+ groupLabel={node.label || groupLabel}
282
+ scripts={scripts}
254
283
  />
255
284
  ))}
256
285
  <Box
@@ -487,6 +516,21 @@ const ScriptTab: React.FC<{ script: string; content?: string; usedBy: number }>
487
516
  );
488
517
  };
489
518
 
519
+ /** `node` with this label, without any when it is empty */
520
+ const withLabel = <T extends PipelineNode, >(node: T, label: string): T => {
521
+ const { label: _old, ...rest } = node;
522
+ return (label ? { ...rest, label } : rest) as T;
523
+ };
524
+
525
+ /** The label of a job, or of the jobs under a group */
526
+ const LabelField: React.FC<{ value?: string; help: string; onChange: (label: string) => void }> = ({ value, help, onChange }) => (
527
+ <Field.Root>
528
+ <Field.Label fontSize="xs">Label (optional)</Field.Label>
529
+ <Input size="sm" placeholder="train lr={LR}" value={value ?? ''} onChange={(e) => onChange(e.target.value)} />
530
+ <Field.HelperText fontSize="xs">{help}</Field.HelperText>
531
+ </Field.Root>
532
+ );
533
+
490
534
  /** The selected job: script and resources pickers, then its arguments, its profile and its script */
491
535
  const JobPane: React.FC<{
492
536
  job: JobNode;
@@ -509,6 +553,11 @@ const JobPane: React.FC<{
509
553
 
510
554
  return (
511
555
  <Flex direction="column" gap={3} h="100%" minH={0}>
556
+ <LabelField
557
+ value={job.label}
558
+ help="Names the job in the job list, {NAME} is the value of its argument NAME. Empty: the label of its group, else the script's BUJANG_JOB_LABEL."
559
+ onChange={(label) => onChange(withLabel(job, label))}
560
+ />
512
561
  <HStack gap={3} align="flex-end" flexWrap="wrap">
513
562
  <Field.Root flex="1 1 220px">
514
563
  <Field.Label fontSize="xs">Script</Field.Label>
@@ -577,6 +626,11 @@ const GroupPane: React.FC<{
577
626
  <Field.Label fontSize="xs">{group.type === 'sequential' ? 'Sequential' : 'Parallel'} group name</Field.Label>
578
627
  <Input size="sm" value={group.name} onChange={(e) => onChange({ ...group, name: e.target.value })} />
579
628
  </Field.Root>
629
+ <LabelField
630
+ value={group.label}
631
+ help="Names every job under the group in the job list, {NAME} is the value of the argument NAME of each job. The label of a job, or of a closer group, wins."
632
+ onChange={(label) => onChange(withLabel(group, label))}
633
+ />
580
634
  {group.type === 'parallel' && (
581
635
  <Field.Root>
582
636
  <Field.Label fontSize="xs">Sweep variable (optional)</Field.Label>
@@ -638,6 +692,18 @@ export const PipelineBuilder: React.FC<{
638
692
  if (loadedTemplateData.definition) setRoot(loadedTemplateData.definition);
639
693
  }, [loadedTemplateData]);
640
694
 
695
+ // the content of its scripts, to show the labels of its jobs
696
+ const scriptNames = [...new Set(scriptsOf(root))];
697
+ const contents = useQueries({
698
+ queries: scriptNames.map((script) => ({
699
+ queryKey: ['slurm-template-content', script],
700
+ queryFn: () => getSlurmTemplateContent(script),
701
+ retry: false,
702
+ staleTime: 30_000,
703
+ })),
704
+ });
705
+ const scripts = Object.fromEntries(scriptNames.map((script, i) => [script, contents[i]?.data]));
706
+
641
707
  const selectedNode = selected ? nodeAt(root, selected) : undefined;
642
708
  const issue = useMemo(() => problem(root), [root]);
643
709
 
@@ -739,6 +805,7 @@ export const PipelineBuilder: React.FC<{
739
805
  root={root}
740
806
  hover={hover}
741
807
  onHover={setHover}
808
+ scripts={scripts}
742
809
  />
743
810
  </Box>
744
811
  <Box flex={1} minW={0} p={4} overflow="auto">