@milabench/bujang 0.1.15 → 0.1.17

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.
@@ -10,6 +10,7 @@ import {
10
10
  VStack,
11
11
  HStack,
12
12
  Button,
13
+ NativeSelect,
13
14
  Card,
14
15
  Spinner,
15
16
  Alert,
@@ -23,7 +24,7 @@ import {
23
24
  import { toaster } from '../toast';
24
25
  import { LuArrowLeft, LuRefreshCw, LuX, LuInfo, LuClock, LuPencil } from 'react-icons/lu';
25
26
  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 } from '../api';
27
+ import { getSlurmJobStdoutFull, getSlurmJobStderrFull, getSlurmJobStdoutSize, getSlurmJobStderrSize, getSlurmJobStatusSimple, getSshJobStatus, getSlurmJobAccounting, rerunSlurmJob, cancelSlurmJob, getSlurmJobInfo, getSlurmJobCluster, getSlurmClusterStatus, earlySyncJob, getSlurmJobScript, getSlurmTemplates, getSlurmProfiles, getSlurmClusters } from '../api';
27
28
  import { JobSubmissionForm } from './JobSubmit';
28
29
  import type { JobSubmissionInitialData } from './JobSubmit';
29
30
  import { LogDisplay } from './LogDisplay';
@@ -35,6 +36,30 @@ import type { SlurmJobDetail, ApiError } from '../types';
35
36
  type JobLogsViewProps = Record<string, never>;
36
37
  type JobLogsTab = 'logs' | 'overview';
37
38
 
39
+ // Seconds between two automatic early syncs: 'x2' waits twice the time the last one took
40
+ type AutoSyncEvery = 'x2' | '10' | '30' | '60';
41
+ const AUTO_SYNC_EVERY: { value: AutoSyncEvery; label: string }[] = [
42
+ { value: 'x2', label: '2× sync time' },
43
+ { value: '10', label: '10 s' },
44
+ { value: '30', label: '30 s' },
45
+ { value: '60', label: '60 s' },
46
+ ];
47
+ const AUTO_SYNC_KEY = 'bujang-auto-early-sync';
48
+ /** 'x2' does not go below: each sync starts a step in the job */
49
+ const AUTO_SYNC_MIN = 5;
50
+
51
+ /** Seconds to the next automatic early sync; `took`: seconds of the last one */
52
+ const autoSyncDelay = (every: AutoSyncEvery, took = 0) => (every === 'x2' ? Math.max(AUTO_SYNC_MIN, 2 * took) : Number(every));
53
+
54
+ const savedAutoSyncEvery = (): AutoSyncEvery => {
55
+ try {
56
+ const saved = localStorage.getItem(AUTO_SYNC_KEY);
57
+ return AUTO_SYNC_EVERY.find((o) => o.value === saved)?.value ?? 'x2';
58
+ } catch {
59
+ return 'x2';
60
+ }
61
+ };
62
+
38
63
  const getStatusColor = (status: string) => {
39
64
  switch (status?.toLowerCase()) {
40
65
  case 'running':
@@ -120,6 +145,14 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
120
145
 
121
146
  // Early sync state
122
147
  const [isEarlySync, setIsEarlySync] = useState(false);
148
+ // the job synced automatically: off when the page moves to another job
149
+ const [autoSyncJob, setAutoSyncJob] = useState<string | null>(null);
150
+ const autoSync = !!jrJobId && autoSyncJob === jrJobId;
151
+ const [autoSyncEvery, setAutoSyncEvery] = useState<AutoSyncEvery>(savedAutoSyncEvery);
152
+ const changeAutoSyncEvery = (value: AutoSyncEvery) => {
153
+ try { localStorage.setItem(AUTO_SYNC_KEY, value); } catch { /* this page only */ }
154
+ setAutoSyncEvery(value);
155
+ };
123
156
 
124
157
  // Edit & Resubmit state
125
158
  const [isEditModalOpen, setIsEditModalOpen] = useState(false);
@@ -355,6 +388,7 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
355
388
  const handleRefresh = () => {
356
389
  refetchStatus();
357
390
  queryClient.invalidateQueries({ queryKey: ['slurm-job-logs'] });
391
+ queryClient.invalidateQueries({ queryKey: ['bujang-job-data', jrJobId] });
358
392
  queryClient.invalidateQueries({ queryKey: ['slurm-cluster-status'] });
359
393
  setCountdown(30);
360
394
  toaster.create({
@@ -476,8 +510,9 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
476
510
  duration: 5000,
477
511
  });
478
512
 
479
- // Refresh the logs after sync
513
+ // Refresh the logs and the overview after sync
480
514
  queryClient.invalidateQueries({ queryKey: ['slurm-job-logs'] });
515
+ queryClient.invalidateQueries({ queryKey: ['bujang-job-data', jrJobId] });
481
516
  } else {
482
517
  toaster.create({
483
518
  title: 'Early Sync Failed',
@@ -499,6 +534,32 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
499
534
  }
500
535
  };
501
536
 
537
+ // Automatic early sync, while the job runs. A failed one is tried again at the next turn (the
538
+ // error is shown on the button)
539
+ const { data: autoSyncResult, error: autoSyncFailure } = useQuery({
540
+ queryKey: ['bujang-auto-early-sync', jrJobId, slurmJobId],
541
+ queryFn: async () => {
542
+ const start = performance.now();
543
+ const result = await earlySyncJob(jrJobId!, slurmJobId!);
544
+ const took = (performance.now() - start) / 1000;
545
+ if (result.status === 'ok') {
546
+ queryClient.invalidateQueries({ queryKey: ['slurm-job-logs'] });
547
+ queryClient.invalidateQueries({ queryKey: ['bujang-job-data', jrJobId] });
548
+ }
549
+ return { ...result, took };
550
+ },
551
+ enabled: autoSync && !!slurmJobId && slurmJobId !== '-' && jobStatus?.toUpperCase() === 'RUNNING',
552
+ refetchInterval: (query) => 1000 * autoSyncDelay(autoSyncEvery, query.state.data?.took),
553
+ refetchOnWindowFocus: false,
554
+ retry: false,
555
+ gcTime: 0,
556
+ });
557
+ const autoSyncError = autoSyncFailure
558
+ ? ((autoSyncFailure as unknown as ApiError).message || 'An unexpected error occurred')
559
+ : autoSyncResult && autoSyncResult.status !== 'ok'
560
+ ? (autoSyncResult.error || 'Could not sync the job results early')
561
+ : null;
562
+
502
563
  // Lazy-loaded templates & profiles for the edit modal
503
564
  const { data: templateNames } = useQuery<string[]>({
504
565
  queryKey: ['slurm-templates'],
@@ -518,6 +579,14 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
518
579
  staleTime: 300000,
519
580
  });
520
581
 
582
+ const { data: clusters } = useQuery({
583
+ queryKey: ['slurm-clusters'],
584
+ queryFn: getSlurmClusters,
585
+ enabled: isEditModalOpen,
586
+ refetchOnWindowFocus: false,
587
+ staleTime: 600000,
588
+ });
589
+
521
590
  const handleEditResubmit = async () => {
522
591
  if (!jrJobId) return;
523
592
 
@@ -533,7 +602,9 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
533
602
  });
534
603
  return;
535
604
  }
605
+ const { cluster } = jobClusterData ?? await getSlurmJobCluster(jrJobId);
536
606
  setEditInitialData({
607
+ cluster,
537
608
  script: data.script,
538
609
  job_name: data.job_name,
539
610
  sbatch_args: data.sbatch_args,
@@ -654,16 +725,46 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
654
725
  <LuPencil />
655
726
  </Button>
656
727
  </HStack>
657
- <Button
658
- variant="outline"
659
- colorScheme="orange"
660
- onClick={handleEarlySync}
661
- loading={isEarlySync}
662
- disabled={!slurmJobId || slurmJobId === '-' || isJobTerminal}
663
- >
664
- <LuClock />
665
- Early Sync
666
- </Button>
728
+ <HStack gap={0}>
729
+ <Button
730
+ variant="outline"
731
+ colorScheme="orange"
732
+ onClick={handleEarlySync}
733
+ loading={isEarlySync}
734
+ disabled={!slurmJobId || slurmJobId === '-' || isJobTerminal}
735
+ borderRightRadius={0}
736
+ >
737
+ <LuClock />
738
+ Early Sync
739
+ </Button>
740
+ <Button
741
+ variant={autoSync && !isJobTerminal ? 'solid' : 'outline'}
742
+ colorPalette={autoSync && autoSyncError ? 'red' : undefined}
743
+ onClick={() => setAutoSyncJob(autoSync ? null : jrJobId ?? null)}
744
+ disabled={!slurmJobId || slurmJobId === '-' || isJobTerminal}
745
+ aria-pressed={autoSync}
746
+ borderLeftRadius={0}
747
+ borderLeft="none"
748
+ px={2}
749
+ title={autoSync && autoSyncError
750
+ ? `Automatic early sync failed, trying again: ${autoSyncError}`
751
+ : `Early sync while the job runs (${autoSync ? `on: every ${autoSyncDelay(autoSyncEvery, autoSyncResult?.took).toFixed(0)} s` : 'off'})`}
752
+ >
753
+ Auto
754
+ </Button>
755
+ <NativeSelect.Root size="md" w="140px" title="Time between two automatic early syncs">
756
+ <NativeSelect.Field
757
+ aria-label="Time between two automatic early syncs"
758
+ value={autoSyncEvery}
759
+ onChange={(e) => changeAutoSyncEvery(e.target.value as AutoSyncEvery)}
760
+ borderLeftRadius={0}
761
+ borderLeft="none"
762
+ >
763
+ {AUTO_SYNC_EVERY.map((o) => <option key={o.value} value={o.value}>{o.label}</option>)}
764
+ </NativeSelect.Field>
765
+ <NativeSelect.Indicator />
766
+ </NativeSelect.Root>
767
+ </HStack>
667
768
  {canCancelJob(jobStatus) && (
668
769
  <Button
669
770
  variant="outline"
@@ -796,7 +897,7 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
796
897
  {/* Logs Display - the logs are local files, show them even when the status could not be fetched */}
797
898
  {activeTab === 'overview' && jrJobId && (
798
899
  <Box flex="1" minH={0} overflowY="auto">
799
- <JobDataOverview jrJobId={jrJobId} />
900
+ <JobDataOverview jrJobId={jrJobId} live={!!jobStatus && !isJobTerminal} />
800
901
  </Box>
801
902
  )}
802
903
 
@@ -859,14 +960,12 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
859
960
  <Dialog.Backdrop />
860
961
  <Dialog.Positioner>
861
962
  <Dialog.Content className="bujang-dialog" maxW="95vw" maxH="95vh" overflow="hidden" display="flex" flexDirection="column">
862
- <Dialog.Header>
863
- <Dialog.Title>Edit & Resubmit Job</Dialog.Title>
864
- <Dialog.CloseTrigger />
865
- </Dialog.Header>
963
+ {/* the form has the title ("Edit & Resubmit Job"): no header of the dialog */}
866
964
  <Dialog.Body flex="1" overflow="auto" p={0}>
867
965
  <JobSubmissionForm
868
966
  templates={templateNames}
869
967
  profiles={profiles || []}
968
+ clusters={clusters || []}
870
969
  activeJobs={[]}
871
970
  onClose={handleEditModalClose}
872
971
  initialData={editInitialData}
@@ -233,6 +233,7 @@ const updateScriptWithExportVars = (script: string, scriptArgs: Record<string, s
233
233
  };
234
234
 
235
235
  export interface JobSubmissionInitialData {
236
+ cluster?: string;
236
237
  script?: string;
237
238
  job_name?: string;
238
239
  sbatch_args?: string[];
@@ -310,7 +311,7 @@ export const JobSubmissionForm: React.FC<JobSubmissionFormProps> = ({
310
311
 
311
312
  const [selectedProfile, setSelectedProfile] = useState<string>('');
312
313
  const [selectedTemplate, setSelectedTemplate] = useState<string>('');
313
- const [selectedCluster, setSelectedCluster] = useState<string>(urlSelection.cluster || 'mila');
314
+ const [selectedCluster, setSelectedCluster] = useState<string>(initialData?.cluster || urlSelection.cluster || 'mila');
314
315
 
315
316
  // Controlled state for NumberInput components
316
317
  const [nodes, setNodes] = useState<string>('');
@@ -913,25 +914,30 @@ export const JobSubmissionForm: React.FC<JobSubmissionFormProps> = ({
913
914
  </Heading>
914
915
 
915
916
  <HStack gap={2} flex={1} justify="flex-end" minW={0} flexWrap="wrap">
916
- <Button
917
- variant="outline"
918
- onClick={() => setScheduleOpen(true)}
919
- fontWeight="medium"
920
- size="sm"
921
- flexShrink={0}
922
- >
923
- <LuCalendar /> Schedule
924
- </Button>
925
- <Button
926
- variant="outline"
927
- onClick={() => setSweepArgs(_collectScriptArgs())}
928
- fontWeight="medium"
929
- size="sm"
930
- flexShrink={0}
931
- title="Make a pipeline out of this job: one job per combination of argument values"
932
- >
933
- <LuWorkflow /> Sweep
934
- </Button>
917
+ {/* resubmitting one job: no schedule nor sweep */}
918
+ {!initialData && (
919
+ <>
920
+ <Button
921
+ variant="outline"
922
+ onClick={() => setScheduleOpen(true)}
923
+ fontWeight="medium"
924
+ size="sm"
925
+ flexShrink={0}
926
+ >
927
+ <LuCalendar /> Schedule
928
+ </Button>
929
+ <Button
930
+ variant="outline"
931
+ onClick={() => setSweepArgs(_collectScriptArgs())}
932
+ fontWeight="medium"
933
+ size="sm"
934
+ flexShrink={0}
935
+ title="Make a pipeline out of this job: one job per combination of argument values"
936
+ >
937
+ <LuWorkflow /> Sweep
938
+ </Button>
939
+ </>
940
+ )}
935
941
  <Button
936
942
  onClick={handleSubmitJob}
937
943
  loading={submitJobMutation.isPending}
@@ -988,7 +994,7 @@ export const JobSubmissionForm: React.FC<JobSubmissionFormProps> = ({
988
994
  <option key={c.name} value={c.name}>{c.name}</option>
989
995
  ))}
990
996
  {clusters.length === 0 && (
991
- <option value="mila">mila</option>
997
+ <option value={selectedCluster}>{selectedCluster}</option>
992
998
  )}
993
999
  </NativeSelect.Field>
994
1000
  </NativeSelect.Root>
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Link } from 'react-router-dom';
2
+ import { Link, useSearchParams } from 'react-router-dom';
3
3
  import {
4
4
  Alert,
5
5
  Badge,
@@ -190,6 +190,10 @@ const getStatusIcon = (status: string) => {
190
190
  };
191
191
 
192
192
  const isLive = (status: string) => ['running', 'pending', 'r', 'pd'].includes(status.toLowerCase());
193
+ /** 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',
195
+ 'requeued', 'rq', 'requeue_hold', 'rh', 'requeue_fed', 'rf', 'resizing', 'rs', 'stage_out', 'so', 'signaling', 'si'];
196
+ const isFinal = (status: string) => !UNFINISHED.includes(status.toLowerCase());
193
197
 
194
198
  const hexToRgb = (hex: string): [number, number, number] => {
195
199
  const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
@@ -263,6 +267,32 @@ type Filters = Partial<Record<ColumnId, string | string[]>>;
263
267
 
264
268
  const isSet = (f: string | string[] | undefined) => (Array.isArray(f) ? f.length > 0 : !!f);
265
269
 
270
+ const FILTER_PREFIX = 'f.';
271
+ const SORT_PARAM = 'sort';
272
+
273
+ const readFilters = (params: URLSearchParams): Filters => {
274
+ const out: Filters = {};
275
+ for (const c of COLUMNS) {
276
+ if (c.filter === 'text') {
277
+ const value = params.get(FILTER_PREFIX + c.id);
278
+ if (value) out[c.id] = value;
279
+ } else if (c.filter === 'values') {
280
+ const values = params.getAll(FILTER_PREFIX + c.id);
281
+ if (values.length) out[c.id] = values;
282
+ }
283
+ }
284
+ return out;
285
+ };
286
+
287
+ /** ?sort=time (ascending), ?sort=-time (descending) */
288
+ const readSort = (params: URLSearchParams): Sort => {
289
+ const raw = params.get(SORT_PARAM);
290
+ if (!raw) return null;
291
+ const desc = raw.startsWith('-');
292
+ const column = (desc ? raw.slice(1) : raw) as ColumnId;
293
+ return COLUMNS.some((c) => c.id === column) ? { column, dir: desc ? 'desc' : 'asc' } : null;
294
+ };
295
+
266
296
  /** The funnel of a column header: a small popover with the filter of the column */
267
297
  const ColumnFilter: React.FC<{
268
298
  column: Column;
@@ -365,10 +395,13 @@ interface JobsTableProps {
365
395
  error?: { message?: string } | null;
366
396
  empty: string;
367
397
  emptyHint: string;
368
- maxH: string;
398
+ /** caps the rows' height; without it they fill the card (give the card a height, e.g. flex: 1) */
399
+ maxH?: string;
369
400
  onCancel: (jobId: string) => void;
370
401
  onRerun: (jrJobId: string) => void;
371
402
  onGroup: (group: string) => void;
403
+ /** quick filters (important, organizers), in the header next to the title */
404
+ quickFilters?: React.ReactNode;
372
405
  }
373
406
 
374
407
  export const JobsTable: React.FC<JobsTableProps & { cardProps?: React.ComponentProps<typeof Card.Root> }> = ({
@@ -383,11 +416,24 @@ export const JobsTable: React.FC<JobsTableProps & { cardProps?: React.ComponentP
383
416
  onCancel,
384
417
  onRerun,
385
418
  onGroup,
419
+ quickFilters,
386
420
  cardProps,
387
421
  }) => {
388
422
  const paths = useBujangPaths();
389
- const [filters, setFilters] = React.useState<Filters>({});
390
- const [sort, setSort] = React.useState<Sort>(null);
423
+ // in the URL (?f.status=RUNNING&f.status=PENDING&f.name=train&sort=-time): back from a job brings
424
+ // them back; the split tables share them
425
+ const [params, setParams] = useSearchParams();
426
+ const filters = React.useMemo(() => readFilters(params), [params]);
427
+ const sort = React.useMemo(() => readSort(params), [params]);
428
+ const update = (change: (next: URLSearchParams) => void) =>
429
+ setParams(
430
+ (prev) => {
431
+ const next = new URLSearchParams(prev);
432
+ change(next);
433
+ return next;
434
+ },
435
+ { replace: true },
436
+ );
391
437
 
392
438
  const options = React.useMemo(() => {
393
439
  const out: Partial<Record<ColumnId, string[]>> = {};
@@ -421,10 +467,18 @@ export const JobsTable: React.FC<JobsTableProps & { cardProps?: React.ComponentP
421
467
 
422
468
  const filtering = Object.values(filters).some(isSet);
423
469
  const cycleSort = (column: ColumnId) =>
424
- setSort((s) =>
425
- s?.column !== column ? { column, dir: 'asc' } : s.dir === 'asc' ? { column, dir: 'desc' } : null,
426
- );
427
- const setFilter = (column: ColumnId, value: string | string[]) => setFilters((f) => ({ ...f, [column]: value }));
470
+ update((next) => {
471
+ const s = readSort(next);
472
+ const to: Sort = s?.column !== column ? { column, dir: 'asc' } : s.dir === 'asc' ? { column, dir: 'desc' } : null;
473
+ if (to) next.set(SORT_PARAM, `${to.dir === 'desc' ? '-' : ''}${to.column}`);
474
+ else next.delete(SORT_PARAM);
475
+ });
476
+ const setFilter = (column: ColumnId, value: string | string[]) =>
477
+ update((next) => {
478
+ next.delete(FILTER_PREFIX + column);
479
+ for (const v of Array.isArray(value) ? value : value ? [value] : []) next.append(FILTER_PREFIX + column, v);
480
+ });
481
+ const clearFilters = () => update((next) => COLUMNS.forEach((c) => next.delete(FILTER_PREFIX + c.id)));
428
482
  const narrowed = filtering || shown.length !== total;
429
483
  const count = `${narrowed ? `${shown.length} of ${total}` : shown.length} ${total === 1 ? 'job' : 'jobs'}`;
430
484
 
@@ -440,16 +494,19 @@ export const JobsTable: React.FC<JobsTableProps & { cardProps?: React.ComponentP
440
494
  {...cardProps}
441
495
  >
442
496
  <Card.Header bg="var(--color-bg-header)" borderBottomWidth="1px" borderBottomColor="var(--color-border)" py={4} px={6}>
443
- <HStack justify="space-between" align="center">
444
- <Heading size="md" fontWeight="semibold" color="var(--color-text)">
445
- {title}
446
- </Heading>
497
+ <HStack justify="space-between" align="center" gap={4} flexWrap="wrap">
498
+ <HStack gap={4} flexWrap="wrap">
499
+ <Heading size="md" fontWeight="semibold" color="var(--color-text)">
500
+ {title}
501
+ </Heading>
502
+ {quickFilters}
503
+ </HStack>
447
504
  <Badge variant="subtle" fontSize="xs" px={2} py={1}>
448
505
  {count}
449
506
  </Badge>
450
507
  </HStack>
451
508
  </Card.Header>
452
- <Card.Body p={0} flex="1" minH={0}>
509
+ <Card.Body p={0} flex="1" minH={0} display="flex" flexDirection="column">
453
510
  {error ? (
454
511
  <Alert.Root status="error">
455
512
  <Alert.Indicator />
@@ -475,7 +532,7 @@ export const JobsTable: React.FC<JobsTableProps & { cardProps?: React.ComponentP
475
532
  </Text>
476
533
  </Box>
477
534
  ) : (
478
- <Table.ScrollArea maxH={maxH} overflowY="auto">
535
+ <Table.ScrollArea maxH={maxH} flex="1" minH={0} overflowY="auto">
479
536
  <Table.Root variant="line" size="sm" stickyHeader css={COMPACT_ROWS}>
480
537
  <Table.Header bg="var(--color-bg-header)">
481
538
  {/* the name sorts (again to reverse, a third time for the default order), the funnel filters */}
@@ -529,7 +586,7 @@ export const JobsTable: React.FC<JobsTableProps & { cardProps?: React.ComponentP
529
586
  variant="ghost"
530
587
  minW="18px"
531
588
  h="18px"
532
- onClick={() => setFilters({})}
589
+ onClick={clearFilters}
533
590
  >
534
591
  <LuX />
535
592
  </IconButton>
@@ -609,6 +666,14 @@ const JobRowView: React.FC<{
609
666
  </Table.Cell>
610
667
  <Table.Cell>
611
668
  <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>
612
677
  <Text color="var(--color-text)">{row.name}</Text>
613
678
  {row.groups.map((g) => (
614
679
  <Badge
@@ -661,13 +726,13 @@ const JobRowView: React.FC<{
661
726
  </Table.Cell>
662
727
  <Table.Cell>
663
728
  <HStack gap={2}>
664
- <Tooltip positioning={{ placement: 'top', offset: { mainAxis: 8 } }} content="View Logs">
665
- <Link to={logsPath}>
666
- <IconButton aria-label="View job logs" size="xs" variant="ghost">
667
- <LuEye />
729
+ {row.persisted && row.jrJobId && isFinal(row.status) && (
730
+ <Tooltip positioning={{ placement: 'top', offset: { mainAxis: 8 } }} content="Rerun Job">
731
+ <IconButton aria-label="Rerun job" size="xs" variant="ghost" colorScheme="blue" onClick={() => onRerun(row.jrJobId!)}>
732
+ <LuRefreshCw />
668
733
  </IconButton>
669
- </Link>
670
- </Tooltip>
734
+ </Tooltip>
735
+ )}
671
736
  {row.active && isLive(row.status) && row.jobId !== NO_JOB_ID && (
672
737
  <Tooltip positioning={{ placement: 'top', offset: { mainAxis: 8 } }} content="Cancel Job">
673
738
  <IconButton aria-label="Cancel job" size="xs" variant="ghost" colorScheme="red" onClick={() => onCancel(row.jobId)}>
@@ -675,13 +740,6 @@ const JobRowView: React.FC<{
675
740
  </IconButton>
676
741
  </Tooltip>
677
742
  )}
678
- {row.persisted && row.jrJobId && (
679
- <Tooltip positioning={{ placement: 'top', offset: { mainAxis: 8 } }} content="Rerun Job">
680
- <IconButton aria-label="Rerun job" size="xs" variant="ghost" colorScheme="blue" onClick={() => onRerun(row.jrJobId!)}>
681
- <LuRefreshCw />
682
- </IconButton>
683
- </Tooltip>
684
- )}
685
743
  </HStack>
686
744
  </Table.Cell>
687
745
  </Table.Row>