Skip to content

Commit cbdf0ff

Browse files
authored
[HUD] Add "Hide always-skipped jobs" checkbox (#7993)
As they do not provide any value whatsoever
1 parent 2bc7469 commit cbdf0ff

3 files changed

Lines changed: 73 additions & 0 deletions

File tree

torchci/lib/JobClassifierUtil.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,9 @@ export function getGroupingData(
406406
// Track which jobs have failures
407407
const jobsWithFailures = new Set<string>();
408408

409+
// Track which jobs are always skipped (every recorded run was skipped)
410+
const jobsAlwaysSkipped = new Set<string>();
411+
409412
// Track which jobs are viable/strict blocking
410413
const jobsViableStrictBlocking = new Set<string>();
411414

@@ -421,6 +424,27 @@ export function getGroupingData(
421424
jobsWithFailures.add(name);
422425
}
423426

427+
// A job is "always skipped" iff at least one real run exists and every
428+
// real run has conclusion === 'skipped'. `nameToJobs` always has an entry
429+
// per column (empty `{}` stubs for commits where the job didn't run), so
430+
// we identify real runs by the presence of `id`.
431+
let sawAnyJob = false;
432+
let sawNonSkipped = false;
433+
for (const row of shaGrid) {
434+
const job = row.nameToJobs.get(name);
435+
if (!job || !job.id) {
436+
continue;
437+
}
438+
sawAnyJob = true;
439+
if (job.conclusion !== JobStatus.Skipped) {
440+
sawNonSkipped = true;
441+
break;
442+
}
443+
}
444+
if (sawAnyJob && !sawNonSkipped) {
445+
jobsAlwaysSkipped.add(name);
446+
}
447+
424448
// Check if this job is viable/strict blocking
425449
if (
426450
repoOwner &&
@@ -455,11 +479,24 @@ export function getGroupingData(
455479
}
456480
}
457481

482+
// A group is "always skipped" iff every job in it is always skipped
483+
const groupsAlwaysSkipped = new Set<string>();
484+
for (const [groupName, jobs] of groupNameMapping.entries()) {
485+
if (
486+
jobs.length > 0 &&
487+
jobs.every((jobName) => jobsAlwaysSkipped.has(jobName))
488+
) {
489+
groupsAlwaysSkipped.add(groupName);
490+
}
491+
}
492+
458493
return {
459494
shaGrid,
460495
groupNameMapping,
461496
jobsWithFailures,
462497
groupsWithFailures,
498+
jobsAlwaysSkipped,
499+
groupsAlwaysSkipped,
463500
jobsViableStrictBlocking,
464501
groupsViableStrictBlocking,
465502
};

torchci/lib/useGroupingPreference.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,15 @@ export function useHideNonViableStrictPreference(): [
8989
);
9090
return [state, setState];
9191
}
92+
93+
export function useHideAlwaysSkippedPreference(): [
94+
boolean,
95+
(_hideAlwaysSkippedValue: boolean) => void
96+
] {
97+
const [state, setState] = usePreference(
98+
"hideAlwaysSkipped",
99+
/*override*/ undefined,
100+
/*default*/ true
101+
);
102+
return [state, setState];
103+
}

torchci/pages/hud/[repoOwner]/[repoName]/[branch]/[[...page]].tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import {
5252
} from "lib/types";
5353
import {
5454
useGroupingPreference,
55+
useHideAlwaysSkippedPreference,
5556
useHideGreenColumnsPreference,
5657
useHideNonViableStrictPreference,
5758
useMonsterFailuresPreference,
@@ -389,6 +390,8 @@ function FiltersAndSettings({}: {}) {
389390
useHideGreenColumnsPreference();
390391
const [hideNonViableStrict, setHideNonViableStrict] =
391392
useHideNonViableStrictPreference();
393+
const [hideAlwaysSkipped, setHideAlwaysSkipped] =
394+
useHideAlwaysSkippedPreference();
392395
const [useGrouping, setUseGrouping] = useGroupingPreference(
393396
params.nameFilter
394397
);
@@ -447,6 +450,13 @@ function FiltersAndSettings({}: {}) {
447450
key="hideNonViableStrict"
448451
labelText={"Hide non-viable-strict jobs"}
449452
/>,
453+
<CheckBoxSelector
454+
value={hideAlwaysSkipped}
455+
setValue={(value) => setHideAlwaysSkipped(value)}
456+
checkBoxName="hideAlwaysSkipped"
457+
key="hideAlwaysSkipped"
458+
labelText={"Hide always-skipped jobs"}
459+
/>,
450460
<CheckBoxSelector
451461
value={mergeEphemeralLF}
452462
setValue={setMergeEphemeralLF}
@@ -742,13 +752,16 @@ function GroupedHudTable({ params }: { params: HudParams }) {
742752
const [hideUnstable] = usePreference("hideUnstable");
743753
const [hideGreenColumns] = useHideGreenColumnsPreference();
744754
const [hideNonViableStrict] = useHideNonViableStrictPreference();
755+
const [hideAlwaysSkipped] = useHideAlwaysSkippedPreference();
745756
const [useGrouping] = useGroupingPreference(params.nameFilter);
746757

747758
const {
748759
shaGrid,
749760
groupNameMapping,
750761
jobsWithFailures,
751762
groupsWithFailures,
763+
jobsAlwaysSkipped,
764+
groupsAlwaysSkipped,
752765
jobsViableStrictBlocking,
753766
groupsViableStrictBlocking,
754767
} = getGroupingData(
@@ -832,6 +845,17 @@ function GroupedHudTable({ params }: { params: HudParams }) {
832845
}
833846
}
834847

848+
// If hiding always-skipped jobs, drop columns where every recorded run was skipped
849+
if (hideAlwaysSkipped) {
850+
if (groupNameMapping.has(name)) {
851+
if (groupsAlwaysSkipped.has(name)) {
852+
return false;
853+
}
854+
} else if (jobsAlwaysSkipped.has(name)) {
855+
return false;
856+
}
857+
}
858+
835859
// If hiding green columns, filter out names that don't have any failed jobs
836860
if (hideGreenColumns) {
837861
// For group names, check if any job in the group has failures

0 commit comments

Comments
 (0)