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

[HUD] Add job-status "QUEUED" #5859

Merged
merged 15 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 12 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
9 changes: 8 additions & 1 deletion torchci/clickhouse_queries/commit_jobs_query/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ WITH job AS (
job.id,
workflow.id AS workflow_id,
workflow.artifacts_url AS github_artifact_url,
job.conclusion,
multiIf(
job.conclusion = ''
and status = 'queued' ,
'queued',
job.conclusion = '',
'pending',
job.conclusion
) as conclusion,
job.html_url,
IF(
{repo: String } = 'pytorch/pytorch',
Expand Down
15 changes: 10 additions & 5 deletions torchci/clickhouse_queries/hud_query/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ WITH job AS (
job.name as job_name,
workflow.name as workflow_name,
job.id as id,
job.status as status,
job.conclusion as conclusion,
job.html_url as html_url,
IF(
Expand Down Expand Up @@ -47,11 +48,15 @@ SELECT
sha,
CONCAT(workflow_name, ' / ', job_name) as name,
id,
if(
conclusion = '',
'pending',
conclusion
) as conclusion,
multiIf(
yangw-dev marked this conversation as resolved.
Show resolved Hide resolved
conclusion = ''
and status = 'queued' ,
'queued',
conclusion = '',
'pending',
conclusion
) as conclusion,
status as status,
html_url as htmlUrl,
log_url as logUrl,
duration_s as durationS,
Expand Down
9 changes: 8 additions & 1 deletion torchci/components/CommitStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useState } from "react";
import { linkIt, UrlComponent, urlRegex } from "react-linkify-it";
import { getConclusionSeverityForSorting } from "../lib/JobClassifierUtil";
import FilteredJobList from "./FilteredJobList";
import { JobStatus } from "./GroupJobConclusion";
import VersionControlLinks from "./VersionControlLinks";
import WorkflowBox from "./WorkflowBox";
import WorkflowDispatcher from "./WorkflowDispatcher";
Expand Down Expand Up @@ -162,7 +163,13 @@ export default function CommitStatus({
<FilteredJobList
filterName="Pending jobs"
jobs={jobs}
pred={(job) => job.conclusion === "pending"}
pred={(job) => job.conclusion === JobStatus.Pending}
unstableIssues={unstableIssues}
/>
<FilteredJobList
filterName="Queued jobs"
jobs={jobs}
pred={(job) => job.conclusion === JobStatus.Queued}
unstableIssues={unstableIssues}
/>
<WorkflowsContainer
Expand Down
21 changes: 20 additions & 1 deletion torchci/components/GroupJobConclusion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ export enum JobStatus {
Cancelled = "cancelled",
Timed_out = "timed_out",
Skipped = "skipped",
Queued = "queued",
Pending = "pending",
}

export enum GroupedJobStatus {
Failure = "failure",
Pending = "pending",
AllNull = "all_null",
Queued = "queued",
Success = "success",
Classified = "classified",
Flaky = "flaky",
WarningOnly = "warning",
Pending = "pending",
}

export default function HudGroupedCell({
Expand All @@ -52,6 +54,7 @@ export default function HudGroupedCell({

const erroredJobs = [];
const warningOnlyJobs = [];
const queuedJobs = [];
const pendingJobs = [];
const noStatusJobs = [];
const failedPreviousRunJobs = [];
Expand All @@ -64,6 +67,8 @@ export default function HudGroupedCell({
}
} else if (job.conclusion === JobStatus.Pending) {
pendingJobs.push(job);
} else if (job.conclusion === JobStatus.Queued) {
queuedJobs.push(job);
} else if (job.conclusion === undefined) {
noStatusJobs.push(job);
} else if (job.conclusion === JobStatus.Success && job.failedPreviousRun) {
Expand All @@ -80,6 +85,8 @@ export default function HudGroupedCell({
conclusion = GroupedJobStatus.Flaky;
} else if (!(warningOnlyJobs.length == 0)) {
conclusion = GroupedJobStatus.WarningOnly;
} else if (!(queuedJobs.length === 0)) {
conclusion = GroupedJobStatus.Queued;
} else if (noStatusJobs.length === groupData.jobs.length) {
conclusion = GroupedJobStatus.AllNull;
}
Expand All @@ -98,6 +105,7 @@ export default function HudGroupedCell({
groupName={groupData.groupName}
erroredJobs={erroredJobs}
pendingJobs={pendingJobs}
queuedJobs={queuedJobs}
failedPreviousRunJobs={failedPreviousRunJobs}
sha={sha}
/>
Expand Down Expand Up @@ -127,13 +135,15 @@ function GroupTooltip({
groupName,
erroredJobs,
pendingJobs,
queuedJobs,
failedPreviousRunJobs,
sha,
}: {
conclusion: GroupedJobStatus;
groupName: string;
erroredJobs: JobData[];
pendingJobs: JobData[];
queuedJobs: JobData[];
failedPreviousRunJobs: JobData[];
sha?: string;
}) {
Expand All @@ -146,6 +156,15 @@ function GroupTooltip({
message={"The following jobs errored out:"}
/>
);
} else if (conclusion === GroupedJobStatus.Queued) {
return (
<ToolTip
conclusion={conclusion}
groupName={groupName}
jobs={queuedJobs}
message={"The following jobs are still in queue:"}
/>
);
} else if (conclusion === GroupedJobStatus.Pending) {
return (
<ToolTip
Expand Down
4 changes: 2 additions & 2 deletions torchci/components/JobLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dayjs from "dayjs";
import { useSession } from "next-auth/react";
import useSWR from "swr";
import { isFailure } from "../lib/JobClassifierUtil";
import { isFailure, IsJobInProgress } from "../lib/JobClassifierUtil";
import { isFailedJob, transformJobName } from "../lib/jobUtils";
import { IssueData, JobData } from "../lib/types";
import CopyLink from "./CopyLink";
Expand Down Expand Up @@ -31,7 +31,7 @@ export default function JobLinks({
);
}

if (job.conclusion !== "pending" && job.logUrl != null) {
if (!IsJobInProgress(job.conclusion) && job.logUrl != null) {
subInfo.push(
<a target="_blank" rel="noreferrer" href={job.logUrl}>
Raw logs
Expand Down
3 changes: 2 additions & 1 deletion torchci/components/ReproductionCommand.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { IsJobInProgress } from "lib/JobClassifierUtil";
import { useEffect, useState } from "react";
import { JobData } from "../lib/types";
import CopyLink from "./CopyLink";
Expand All @@ -11,7 +12,7 @@ export default function ReproductionCommand({ job }: { job: JobData }) {

if (
job === null ||
job.conclusion === "pending" ||
IsJobInProgress(job.conclusion) ||
!job.jobName?.includes("test") ||
reproComamnd === null
) {
Expand Down
5 changes: 3 additions & 2 deletions torchci/components/TestInsights.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { IsJobInProgress } from "lib/JobClassifierUtil";
import { JobData } from "../lib/types";

// The following jobs are not supported at the moment because neither the monitoring
Expand All @@ -15,8 +16,8 @@ export default function TestInsightsLink({
return null;
}

if (job.conclusion === "pending") {
// If the job is pending, there is no test insights available yet
if (IsJobInProgress(job.conclusion)) {
// If the job is still in progress, there is no test insights available yet
return null;
}

Expand Down
3 changes: 2 additions & 1 deletion torchci/components/additionalTestInfo/TestInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { fetcher } from "lib/GeneralUtils";
import { runWorkflow } from "lib/githubFunctions";
import { IsJobInProgress } from "lib/JobClassifierUtil";
import { JobData } from "lib/types";
import { useSession } from "next-auth/react";
import { useState } from "react";
Expand Down Expand Up @@ -31,7 +32,7 @@ export function genMessage({
}

export function isPending(jobs: JobData[]) {
return jobs.some((job) => job.conclusion === "pending");
return jobs.some((job) => IsJobInProgress(job.conclusion));
}

export function RecursiveDetailsSummary({
Expand Down
37 changes: 31 additions & 6 deletions torchci/lib/JobClassifierUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ export function getGroupConclusionChar(conclusion?: GroupedJobStatus): string {
return "O";
case GroupedJobStatus.Failure:
return "X";
case GroupedJobStatus.Queued:
return "Q";
case GroupedJobStatus.Pending:
return "?";
return "P";
yangw-dev marked this conversation as resolved.
Show resolved Hide resolved
case GroupedJobStatus.AllNull:
return "~";
case GroupedJobStatus.Classified:
Expand All @@ -239,12 +241,31 @@ export function isFailure(conclusion?: string): boolean {
case JobStatus.Success:
case JobStatus.Neutral:
case JobStatus.Skipped:
case JobStatus.Queued:
case JobStatus.Pending:
case undefined:
default:
return false;
}
}

export function IsJobInProgress(conclusion?: string): boolean {
switch (conclusion) {
case JobStatus.Queued:
case JobStatus.Pending:
return true;
case JobStatus.Success:
case JobStatus.Neutral:
case JobStatus.Skipped:
case JobStatus.Failure:
case JobStatus.Cancelled:
case JobStatus.Timed_out:
case undefined:
default:
return false;
}
}

export function getConclusionChar(
conclusion?: string,
failedPreviousRun?: boolean
Expand All @@ -265,8 +286,10 @@ export function getConclusionChar(
return "T";
case JobStatus.Skipped:
return "S";
case JobStatus.Queued:
return "Q";
case JobStatus.Pending:
return "?";
return "P";
yangw-dev marked this conversation as resolved.
Show resolved Hide resolved
case undefined:
return "~";
default:
Expand All @@ -286,14 +309,16 @@ export function getConclusionSeverityForSorting(conclusion?: string): number {
return 2;
case JobStatus.Cancelled:
return 3;
case JobStatus.Pending:
case JobStatus.Queued:
return 4;
case undefined:
case JobStatus.Pending:
return 5;
case JobStatus.Failure:
case undefined:
return 6;
default:
case JobStatus.Failure:
return 7;
default:
return 8;
}
}

Expand Down
2 changes: 1 addition & 1 deletion torchci/lib/fetchHud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default async function fetchHud(params: HudParams): Promise<{
}

const namesSet: Set<string> = new Set();
// Built a list of all the distinct job names.
// Built a list of all the distinct job names, and set the conclusion based on the status.
results?.forEach((job: JobData) => {
namesSet.add(job.name!);
});
Expand Down
5 changes: 3 additions & 2 deletions torchci/lib/searchLogs.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { IsJobInProgress } from "./JobClassifierUtil";
import { JobData } from "./types";

export interface LogSearchResult {
Expand Down Expand Up @@ -52,10 +53,10 @@ async function searchLog(
): Promise<LogSearchResult> {
// Search individual log
try {
if (job.conclusion == "pending") {
if (IsJobInProgress(job.conclusion)) {
return {
results: [],
info: "Job is still running",
info: "Job is still in progress",
};
}

Expand Down
1 change: 1 addition & 0 deletions torchci/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface BasicJobData {
name?: string;
time?: string;
conclusion?: string;
status?: string;
runnerName?: string;
authorEmail?: string;
}
Expand Down
1 change: 1 addition & 0 deletions torchci/pages/[repoOwner]/[repoName]/commit/[sha].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function CommitInfo({
}

const { commit, jobs } = commitData;

return (
<div>
<h2>{commit.commitTitle}</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import CopyLink from "components/CopyLink";
import { JobStatus } from "components/GroupJobConclusion";
import JobAnnotationToggle from "components/JobAnnotationToggle";
import JobConclusion from "components/JobConclusion";
import JobFilterInput from "components/JobFilterInput";
Expand Down Expand Up @@ -201,11 +202,13 @@ function CommitLinks({ row }: { row: RowData }) {

function CommitSummaryLine({
row,
numQueued,
numPending,
showRevert,
ttsAlert,
}: {
row: RowData;
numQueued: number;
numPending: number;
showRevert: boolean;
ttsAlert: boolean;
Expand All @@ -231,7 +234,11 @@ function CommitSummaryLine({
textToCopy={`${location.href.replace(location.hash, "")}#${row.sha}`}
/>
</span>

{numQueued > 0 && (
<span className={styles.shaTitleElement}>
<em>{numQueued} queued</em>
</span>
)}
{numPending > 0 && (
<span className={styles.shaTitleElement}>
<em>{numPending} pending</em>
Expand Down Expand Up @@ -441,7 +448,10 @@ function CommitSummary({

const failedJobs = jobs.filter(isFailedJob);
const classifiedJobs = jobs.filter((job) => job.failureAnnotation != null);
const pendingJobs = jobs.filter((job) => job.conclusion === "pending");
const pendingJobs = jobs.filter(
(job) => job.conclusion === JobStatus.Pending
);
const queuedJobs = jobs.filter((job) => job.conclusion === JobStatus.Queued);

let className;
if (jobs.length === 0) {
Expand Down Expand Up @@ -497,6 +507,7 @@ function CommitSummary({
>
<CommitSummaryLine
row={row}
numQueued={queuedJobs.length}
numPending={pendingJobs.length}
showRevert={failedJobs.length !== 0}
ttsAlert={concerningTTS.length > 0}
Expand Down
Loading