diff --git a/torchci/components/additionalTestInfo/TestInfo.tsx b/torchci/components/additionalTestInfo/TestInfo.tsx index 4eef142c06..1d4ba4858e 100644 --- a/torchci/components/additionalTestInfo/TestInfo.tsx +++ b/torchci/components/additionalTestInfo/TestInfo.tsx @@ -37,6 +37,10 @@ export function genMessage({ return errorString.trim(); } +export function isPendingJob(job: JobData) { + return IsJobInProgress(job.conclusion); +} + export function isPending(jobs: JobData[]) { return jobs.some((job) => IsJobInProgress(job.conclusion)); } diff --git a/torchci/components/commit/WorkflowBox.tsx b/torchci/components/commit/WorkflowBox.tsx index 5ed9135185..9826c21d74 100644 --- a/torchci/components/commit/WorkflowBox.tsx +++ b/torchci/components/commit/WorkflowBox.tsx @@ -1,5 +1,9 @@ import { Button, Stack, styled, Tooltip, Typography } from "@mui/material"; -import { isPending, TestInfo } from "components/additionalTestInfo/TestInfo"; +import { + isPending, + isPendingJob, + TestInfo, +} from "components/additionalTestInfo/TestInfo"; import styles from "components/commit/commit.module.css"; import LogViewer, { SearchLogViewer } from "components/common/log/LogViewer"; import { durationDisplay } from "components/common/TimeUtils"; @@ -97,18 +101,13 @@ function WorkflowJobSummary({ ); } - if (utilMetadata && utilMetadata.length > 0) { - if (utilMetadata.length > 1) { - console.log( - `Multiple util metadata found for job ${job.id}, currently only showing the first one` - ); - } - const m = utilMetadata[0]; + if (job.id && !isPendingJob(job)) { + const m = job; subInfo.push( <> { const router = useRouter(); const { workflowId, jobId, attempt } = router.query; + let shouldFetch = workflowId && jobId; let { data, error } = useSWRImmutable( - `/api/utilization/${workflowId}/${jobId}/${attempt}`, + shouldFetch + ? `/api/job_utilization/${workflowId}/${jobId}/${attempt}` + : null, fetcherHandleError, { errorRetryCount: 3,