Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
19 changes: 16 additions & 3 deletions torchci/components/CommitStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import FilteredJobList from "./FilteredJobList";
import VersionControlLinks from "./VersionControlLinks";
import { CommitData, JobData } from "lib/types";
import { CommitData, JobData, IssueData } from "lib/types";
import WorkflowBox from "./WorkflowBox";
import styles from "components/commit.module.css";
import _ from "lodash";
Expand All @@ -15,7 +15,13 @@ import useScrollTo from "lib/useScrollTo";
import WorkflowDispatcher from "./WorkflowDispatcher";
import { useSession } from "next-auth/react";

function WorkflowsContainer({ jobs }: { jobs: JobData[] }) {
function WorkflowsContainer({
jobs,
unstableIssues,
}: {
jobs: JobData[];
unstableIssues: IssueData[];
}) {
useScrollTo();

if (jobs.length === 0) {
Expand Down Expand Up @@ -44,6 +50,7 @@ function WorkflowsContainer({ jobs }: { jobs: JobData[] }) {
key={workflowName}
workflowName={workflowName}
jobs={jobs}
unstableIssues={unstableIssues}
/>
);
})}
Expand All @@ -58,12 +65,14 @@ export default function CommitStatus({
commit,
jobs,
isCommitPage,
unstableIssues,
}: {
repoOwner: string;
repoName: string;
commit: CommitData;
jobs: JobData[];
isCommitPage: boolean;
unstableIssues: IssueData[];
}) {
const session = useSession();
const isAuthenticated = session.status === "authenticated";
Expand Down Expand Up @@ -93,23 +102,27 @@ export default function CommitStatus({
!isUnstableJob(job)
}
showClassification
unstableIssues={unstableIssues}
/>
<FilteredJobList
filterName="Failed unstable jobs"
jobs={jobs}
pred={(job) => isFailedJob(job) && isUnstableJob(job)}
unstableIssues={unstableIssues}
/>
<FilteredJobList
filterName="Daily rerunning disabled jobs"
jobs={jobs}
pred={(job) => isFailedJob(job) && isRerunDisabledTestsJob(job)}
unstableIssues={unstableIssues}
/>
<FilteredJobList
filterName="Pending jobs"
jobs={jobs}
pred={(job) => job.conclusion === "pending"}
unstableIssues={unstableIssues}
/>
<WorkflowsContainer jobs={jobs} />
<WorkflowsContainer jobs={jobs} unstableIssues={unstableIssues} />
{isAuthenticated && isCommitPage && (
<WorkflowDispatcher
repoOwner={repoOwner}
Expand Down
9 changes: 7 additions & 2 deletions torchci/components/FilteredJobList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ import JobAnnotationToggle from "./JobAnnotationToggle";
import JobLinks from "./JobLinks";
import JobSummary from "./JobSummary";
import LogViewer from "./LogViewer";
import { JobAnnotation } from "lib/types";
import { JobAnnotation, IssueData } from "lib/types";
import useScrollTo from "lib/useScrollTo";

function FailedJobInfo({
job,
showClassification,
annotation,
unstableIssues,
}: {
job: JobData;
showClassification: boolean;
annotation: JobAnnotation;
unstableIssues: IssueData[];
}) {
const router = useRouter();
useScrollTo();
const { repoOwner, repoName } = router.query;
return (
<li key={job.id} id={job.id}>
<JobSummary job={job} />
<JobSummary job={job} unstableIssues={unstableIssues} />
<div>
<JobLinks job={job} />
</div>
Expand All @@ -44,11 +46,13 @@ export default function FilteredJobList({
jobs,
pred,
showClassification = false,
unstableIssues,
}: {
filterName: string;
jobs: JobData[];
pred: (job: JobData) => boolean;
showClassification?: boolean;
unstableIssues: IssueData[];
}) {
const router = useRouter();
const { repoOwner, repoName } = router.query;
Expand Down Expand Up @@ -84,6 +88,7 @@ export default function FilteredJobList({
data[job?.id ?? ""]["annotation"]) ??
JobAnnotation.NULL
}
unstableIssues={unstableIssues}
/>
))}
</ul>
Expand Down
24 changes: 8 additions & 16 deletions torchci/components/JobLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import TestInsightsLink from "./TestInsights";
import ReproductionCommand from "./ReproductionCommand";
import { useSession } from "next-auth/react";
import { isFailure } from "../lib/JobClassifierUtil";
import { transformJobName } from "../lib/jobUtils";

export default function JobLinks({
job,
Expand Down Expand Up @@ -163,9 +164,11 @@ function DisableTest({ job, label }: { job: JobData; label: string }) {

const issues: IssueData[] = data.issues;
const matchingIssues = issues.filter((issue) => issue.title === issueTitle);
const repo = job.repo ?? "pytorch/pytorch";

return (
<DisableIssue
repo={repo}
matchingIssues={matchingIssues}
issueTitle={issueTitle}
issueBody={issueBody}
Expand All @@ -174,21 +177,6 @@ function DisableTest({ job, label }: { job: JobData; label: string }) {
);
}

const jobNameRe = /^(.*) \(([^,]*),.*\)/;
function transformJobName(jobName?: string) {
if (jobName == undefined) {
return null;
}

// We want to have the job name in the following format WORKFLOW / JOB (CONFIG)
const jobNameMatch = jobName.match(jobNameRe);
if (jobNameMatch !== null) {
return `${jobNameMatch[1]} (${jobNameMatch[2]})`;
}

return jobName;
}

function formatUnstableJobBody() {
return encodeURIComponent(
"> Please provide a brief reason on why you need to mark this job as unstable."
Expand Down Expand Up @@ -229,9 +217,11 @@ function UnstableJob({ job, label }: { job: JobData; label: string }) {
const matchingIssues = issues.filter((issue) =>
issueTitle.includes(issue.title)
);
const repo = job.repo ?? "pytorch/pytorch";

return (
<DisableIssue
repo={repo}
matchingIssues={matchingIssues}
issueTitle={issueTitle}
issueBody={issueBody}
Expand All @@ -241,17 +231,19 @@ function UnstableJob({ job, label }: { job: JobData; label: string }) {
}

function DisableIssue({
repo,
matchingIssues,
issueTitle,
issueBody,
isDisabledTest,
}: {
repo: string;
matchingIssues: IssueData[];
issueTitle: string;
issueBody: string;
isDisabledTest: boolean;
}) {
let issueLink = `https://github.com/pytorch/pytorch/issues/new?title=${issueTitle}&body=${issueBody}`;
let issueLink = `https://github.com/${repo}/issues/new?title=${issueTitle}&body=${issueBody}`;
let linkText = isDisabledTest
? "Disable test"
: issueTitle.includes("UNSTABLE")
Expand Down
6 changes: 4 additions & 2 deletions torchci/components/JobSummary.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JobData } from "lib/types";
import { JobData, IssueData } from "lib/types";
import JobConclusion from "./JobConclusion";
import {
isFailedJob,
Expand Down Expand Up @@ -26,17 +26,19 @@ function BranchName({
export default function JobSummary({
job,
highlight,
unstableIssues,
}: {
job: JobData;
highlight: boolean;
unstableIssues: IssueData[];
}) {
return (
<>
<JobConclusion
conclusion={job.conclusion}
warningOnly={
isFailedJob(job) &&
(isRerunDisabledTestsJob(job) || isUnstableJob(job))
(isRerunDisabledTestsJob(job) || isUnstableJob(job, unstableIssues))
}
/>
<a href={job.htmlUrl}> {job.jobName} </a>
Expand Down
9 changes: 7 additions & 2 deletions torchci/components/WorkflowBox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styles from "components/commit.module.css";
import { fetcher } from "lib/GeneralUtils";
import { isFailedJob } from "lib/jobUtils";
import { Artifact, JobData } from "lib/types";
import { Artifact, JobData, IssueData } from "lib/types";
import useSWR from "swr";
import JobArtifact from "./JobArtifact";
import JobSummary from "./JobSummary";
Expand Down Expand Up @@ -29,11 +29,13 @@ function WorkflowJobSummary({
artifacts,
artifactsToShow,
setArtifactsToShow,
unstableIssues,
}: {
job: JobData;
artifacts?: Artifact[];
artifactsToShow: Set<string>;
setArtifactsToShow: any;
unstableIssues: IssueData[];
}) {
var queueTimeInfo = null;
if (job.queueTimeS != null) {
Expand Down Expand Up @@ -72,7 +74,7 @@ function WorkflowJobSummary({

return (
<>
<JobSummary job={job} />
<JobSummary job={job} unstableIssues={unstableIssues} />
<br />
<small>
&nbsp;&nbsp;&nbsp;&nbsp;
Expand All @@ -99,9 +101,11 @@ function WorkflowJobSummary({
export default function WorkflowBox({
workflowName,
jobs,
unstableIssues,
}: {
workflowName: string;
jobs: JobData[];
unstableIssues: IssueData[];
}) {
const isFailed = jobs.some(isFailedJob) !== false;
const workflowClass = isFailed
Expand Down Expand Up @@ -171,6 +175,7 @@ export default function WorkflowBox({
artifacts={groupedArtifacts?.get(job.id)}
artifactsToShow={artifactsToShow}
setArtifactsToShow={setArtifactsToShow}
unstableIssues={unstableIssues}
/>
{(searchString && (
<SearchLogViewer
Expand Down
22 changes: 18 additions & 4 deletions torchci/lib/JobClassifierUtil.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { GroupedJobStatus, JobStatus } from "components/GroupJobConclusion";
import { GroupData, RowData } from "./types";
import { GroupData, RowData, IssueData } from "./types";
import { hasOpenUnstableIssue } from "lib/jobUtils";

const GROUP_MEMORY_LEAK_CHECK = "Memory Leak Check";
const GROUP_RERUN_DISABLED_TESTS = "Rerun Disabled Tests";
Expand Down Expand Up @@ -179,7 +180,16 @@ export function sortGroupNamesForHUD(groupNames: string[]): string[] {
return result;
}

export function classifyGroup(jobName: string): string {
export function classifyGroup(
jobName: string,
unstableIssues?: IssueData[]
): string {
// Double check first if the job has been marked as unstable but doesn't include
// the unstable keyword
if (hasOpenUnstableIssue(jobName, unstableIssues)) {
return GROUP_UNSTABLE;
}

for (const group of groups) {
if (jobName.match(group.regex)) {
return group.name;
Expand Down Expand Up @@ -276,12 +286,16 @@ export function getConclusionSeverityForSorting(conclusion?: string): number {
}
}

export function getGroupingData(shaGrid: RowData[], jobNames: string[]) {
export function getGroupingData(
shaGrid: RowData[],
jobNames: string[],
unstableIssues?: IssueData[]
) {
// Construct Job Groupping Mapping
const groupNameMapping = new Map<string, Array<string>>(); // group -> [jobs]
const jobToGroupName = new Map<string, string>(); // job -> group
for (const name of jobNames) {
const groupName = classifyGroup(name);
const groupName = classifyGroup(name, unstableIssues);
const jobsInGroup = groupNameMapping.get(groupName) ?? [];
jobsInGroup.push(name);
groupNameMapping.set(groupName, jobsInGroup);
Expand Down
Loading