Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color code viable/strict blocking jobs differently on HUD #6239

Merged
merged 5 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions torchci/components/GroupJobConclusion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,37 @@ export enum GroupedJobStatus {
Pending = "pending",
}

type RepoViableStrictBlockingJobsMap = {
[key: string]: RegExp[];
};

// TODO: Move this to a config file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/pytorch/pytorch/blob/main/.github/pytorch-probot.yml seems to be a a natural place for this, but agree that we could do it later

const VIABLE_STRICT_BLOCKING_JOBS: RepoViableStrictBlockingJobsMap = {
// Source of truth for these jobs is in https://github.com/pytorch/pytorch/blob/main/.github/workflows/update-viablestrict.yml#L26
"pytorch/pytorch": [/trunk/i, /pull/i, /linux-binary/i, /lint/i],
};

function isJobViableStrictBlocking(
jobName: string | undefined,
repoOwner: string,
repoName: string
): boolean {
if (!jobName) {
return false;
}

const repo = `${repoOwner}/${repoName}`;
let viablestrict_blocking_jobs_patterns =
VIABLE_STRICT_BLOCKING_JOBS[repo] ?? [];

for (const regex of viablestrict_blocking_jobs_patterns) {
if (jobName.match(regex)) {
return true;
}
}
return false;
}

export default function HudGroupedCell({
sha,
groupName,
Expand All @@ -42,6 +73,8 @@ export default function HudGroupedCell({
toggleExpanded,
isClassified,
unstableIssues,
repoOwner,
repoName,
}: {
sha: string;
groupName: string;
Expand All @@ -50,6 +83,8 @@ export default function HudGroupedCell({
toggleExpanded: () => void;
isClassified: boolean;
unstableIssues: IssueData[];
repoOwner: string;
repoName: string;
}) {
const [pinnedId, setPinnedId] = useContext(PinnedTooltipContext);
const style = pinnedId.name == groupName ? hudStyles.highlight : "";
Expand All @@ -60,12 +95,17 @@ export default function HudGroupedCell({
const pendingJobs = [];
const noStatusJobs = [];
const failedPreviousRunJobs = [];

let viableStrictBlocking = false;
for (const job of jobs) {
if (isFailedJob(job)) {
if (isRerunDisabledTestsJob(job) || isUnstableJob(job, unstableIssues)) {
warningOnlyJobs.push(job);
} else {
erroredJobs.push(job);
if (isJobViableStrictBlocking(job.name, repoOwner, repoName)) {
viableStrictBlocking = true;
}
}
} else if (job.conclusion === JobStatus.Pending) {
pendingJobs.push(job);
Expand Down Expand Up @@ -113,15 +153,22 @@ export default function HudGroupedCell({
/>
}
>
<span className={styles.conclusion}>
<span
className={`${styles.conclusion} ${
viableStrictBlocking ? styles.viablestrict_blocking : ""
}`}
>
<span
className={
isClassified
? styles["classified"]
: styles[conclusion ?? "none"]
}
onDoubleClick={toggleExpanded}
style={{ border: "1px solid gainsboro", padding: "0 1px" }}
style={{
border: "1px solid gainsboro",
padding: "0 1px",
}}
>
{getGroupConclusionChar(conclusion)}
</span>
Expand Down
5 changes: 5 additions & 0 deletions torchci/components/JobConclusion.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@
.warning {
color: #f8b88b;
}

.viablestrict_blocking {
border-left: 1px solid red;
border-right: 1px solid red;
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function HudRow({
rowData={rowData}
names={names}
unstableIssues={unstableIssues}
params={params}
/>
</tr>
);
Expand All @@ -185,10 +186,12 @@ function HudJobCells({
rowData,
names,
unstableIssues,
params,
}: {
rowData: RowData;
names: string[];
unstableIssues: IssueData[];
params: HudParams;
}) {
let groupNames = groups.map((group) => group.name).concat("other");
const { expandedGroups, setExpandedGroups, groupNameMapping } =
Expand All @@ -214,6 +217,8 @@ function HudJobCells({
sha={rowData.sha}
key={name}
groupName={name}
repoOwner={params.repoOwner}
repoName={params.repoName}
jobs={
groupNameMapping
.get(name)
Expand Down