Skip to content

Commit aab2aff

Browse files
authored
[HUD] Show the odc repro button in more places (#7523)
Make the button show up on HUD tooltips and in the workflow box HUD tooltip requires querying for the workflowId/run_id line height is to make the button shorter so it doesn't change the spacing
1 parent 332014f commit aab2aff

File tree

4 files changed

+44
-11
lines changed

4 files changed

+44
-11
lines changed

torchci/clickhouse_queries/hud_query/query.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ WITH job AS (
44
job.name as job_name,
55
job.workflow_name as workflow_name,
66
job.id as id,
7+
job.run_id as workflowId,
78
job.status as status,
89
job.conclusion_kg as conclusion,
910
job.html_url as html_url,
@@ -42,6 +43,7 @@ SELECT
4243
sha,
4344
CONCAT(workflow_name, ' / ', job_name) as name,
4445
id,
46+
workflowId,
4547
multiIf(
4648
conclusion = ''
4749
and status = 'queued' ,

torchci/components/commit/WorkflowBox.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import LogViewer, { SearchLogViewer } from "components/common/log/LogViewer";
99
import { durationDisplay } from "components/common/TimeUtils";
1010
import JobArtifact from "components/job/JobArtifact";
1111
import JobSummary from "components/job/JobSummary";
12+
import {
13+
canShowODCCommand,
14+
ODCommandInstructions,
15+
} from "components/job/ODCCommand";
1216
import { fetcher } from "lib/GeneralUtils";
1317
import { getConclusionSeverityForSorting } from "lib/JobClassifierUtil";
1418
import { getDurationDisplay, isFailedJob } from "lib/jobUtils";
@@ -117,6 +121,19 @@ function WorkflowJobSummary({
117121
);
118122
}
119123

124+
if (canShowODCCommand(job)) {
125+
const ODCCommand = ODCommandInstructions({
126+
jobId: parseInt(job.id),
127+
workflowId: parseInt(job.workflowId),
128+
failureLineNum: job.failureLineNumbers[0],
129+
headSha: job.sha,
130+
jobName: job.name,
131+
});
132+
if (ODCCommand != null) {
133+
subInfo.push(ODCCommand);
134+
}
135+
}
136+
120137
return (
121138
<>
122139
<JobSummary job={job} unstableIssues={unstableIssues} />

torchci/components/job/JobLinks.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { useSession } from "next-auth/react";
1212
import { IssueLabelApiResponse } from "pages/api/issue/[label]";
1313
import useSWR from "swr";
1414
import styles from "./JobLinks.module.css";
15-
import { ODCommandInstructions } from "./ODCCommand";
15+
import { canShowODCCommand, ODCommandInstructions } from "./ODCCommand";
1616
import ReproductionCommand from "./ReproductionCommand";
1717

1818
const DEFAULT_REPO = "pytorch/pytorch";
@@ -130,16 +130,7 @@ export default function JobLinks({
130130
}
131131
}
132132

133-
if (
134-
job.repo == "pytorch/pytorch" &&
135-
isFailedJob(job) &&
136-
job.workflowId != null &&
137-
job.id != null &&
138-
job.failureLineNumbers &&
139-
job.failureLineNumbers.length > 0 &&
140-
job.sha != null &&
141-
job.name?.includes("linux") // ODC only supports linux jobs for now
142-
) {
133+
if (canShowODCCommand(job)) {
143134
const ODCCommand = ODCommandInstructions({
144135
jobId: parseInt(job.id),
145136
workflowId: parseInt(job.workflowId),

torchci/components/job/ODCCommand.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,33 @@ import {
1111
Typography,
1212
} from "@mui/material";
1313
import { Box, Stack } from "@mui/system";
14+
import { isFailedJob } from "lib/jobUtils";
15+
import { JobData } from "lib/types";
1416
import { useState } from "react";
1517
import useSWR from "swr";
1618

1719
const STARTING_INSTRUCTIONS = "https://fburl.com/workplace/008py9db";
1820

21+
export function canShowODCCommand(job: JobData): job is JobData & {
22+
repo: string;
23+
workflowId: string;
24+
id: string;
25+
failureLineNumbers: number[];
26+
sha: string;
27+
name: string;
28+
} {
29+
const requirementsMet =
30+
job.repo == "pytorch/pytorch" &&
31+
isFailedJob(job) &&
32+
job.workflowId != null &&
33+
job.id != null &&
34+
job.failureLineNumbers &&
35+
job.failureLineNumbers.length > 0 &&
36+
job.sha != null &&
37+
job.name?.includes("linux"); // ODC only supports linux jobs for now
38+
return requirementsMet || false;
39+
}
40+
1941
/**
2042
* Get the reproduction command for the job using osdc gpu-dev CLI
2143
*
@@ -117,6 +139,7 @@ export function ODCommandInstructions({
117139
mb: 0,
118140
pt: 0,
119141
pb: 0,
142+
lineHeight: 1.2,
120143
}}
121144
>
122145
gpu-dev instructions

0 commit comments

Comments
 (0)