From d3fa14a3c409107473d4b15d3026172fae6ca5b6 Mon Sep 17 00:00:00 2001 From: Catherine Lee Date: Tue, 10 Dec 2024 13:23:26 -0800 Subject: [PATCH 1/3] tc --- torchci/components/JobLinks.tsx | 5 ----- torchci/components/WorkflowBox.tsx | 6 ------ torchci/pages/kpis.tsx | 1 + torchci/pages/test/insights.tsx | 1 + 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/torchci/components/JobLinks.tsx b/torchci/components/JobLinks.tsx index 89e921c1b1..76c4121b05 100644 --- a/torchci/components/JobLinks.tsx +++ b/torchci/components/JobLinks.tsx @@ -77,11 +77,6 @@ export default function JobLinks({ ); } - const testInsightsLink = TestInsightsLink({ job: job, separator: "" }); - if (testInsightsLink != null) { - subInfo.push(testInsightsLink); - } - if (isFailedJob(job)) { const revertInfoCopy = RevertInfoCopy({ job: job }); if (revertInfoCopy != null) { diff --git a/torchci/components/WorkflowBox.tsx b/torchci/components/WorkflowBox.tsx index 279ccf9c70..972b736d50 100644 --- a/torchci/components/WorkflowBox.tsx +++ b/torchci/components/WorkflowBox.tsx @@ -10,7 +10,6 @@ import { TestInfo } from "./additionalTestInfo/TestInfo"; import JobArtifact from "./JobArtifact"; import JobSummary from "./JobSummary"; import LogViewer, { SearchLogViewer } from "./LogViewer"; -import TestInsightsLink from "./TestInsights"; import { durationDisplay } from "./TimeUtils"; function sortJobsByConclusion(jobA: JobData, jobB: JobData): number { @@ -56,11 +55,6 @@ function WorkflowJobSummary({ ); } - const testInsightsLink = TestInsightsLink({ job: job, separator: "" }); - if (testInsightsLink != null) { - subInfo.push(testInsightsLink); - } - const hasArtifacts = artifacts && artifacts.length > 0; function setArtifactsToShowHelper() { diff --git a/torchci/pages/kpis.tsx b/torchci/pages/kpis.tsx index c744053b33..2c845e295d 100644 --- a/torchci/pages/kpis.tsx +++ b/torchci/pages/kpis.tsx @@ -81,6 +81,7 @@ export default function Kpis() { yAxisFieldName={"ttrs_mins"} yAxisRenderer={(duration) => duration} groupByFieldName={"percentile"} + useClickHouse={false} /> diff --git a/torchci/pages/test/insights.tsx b/torchci/pages/test/insights.tsx index e2a6fa56ae..62344cd71d 100644 --- a/torchci/pages/test/insights.tsx +++ b/torchci/pages/test/insights.tsx @@ -307,6 +307,7 @@ function GetJobs({ } export default function Page() { + return
Deprecated
; const [startTime, _setStartTime] = useState(dayjs().subtract(1, "week")); const [stopTime, _setStopTime] = useState(dayjs()); From f3f0a121633be80f1d22d930c706c4bce4815ecb Mon Sep 17 00:00:00 2001 From: Catherine Lee Date: Tue, 10 Dec 2024 13:24:48 -0800 Subject: [PATCH 2/3] tc --- torchci/components/JobLinks.tsx | 1 - torchci/components/TestInsights.tsx | 67 ----- torchci/pages/test/insights.tsx | 382 ---------------------------- 3 files changed, 450 deletions(-) delete mode 100644 torchci/components/TestInsights.tsx delete mode 100644 torchci/pages/test/insights.tsx diff --git a/torchci/components/JobLinks.tsx b/torchci/components/JobLinks.tsx index 76c4121b05..ab2b6fbdee 100644 --- a/torchci/components/JobLinks.tsx +++ b/torchci/components/JobLinks.tsx @@ -8,7 +8,6 @@ import { IssueData, JobData } from "../lib/types"; import CopyLink from "./CopyLink"; import styles from "./JobLinks.module.css"; import ReproductionCommand from "./ReproductionCommand"; -import TestInsightsLink from "./TestInsights"; import { durationDisplay, LocalTimeHuman } from "./TimeUtils"; export default function JobLinks({ diff --git a/torchci/components/TestInsights.tsx b/torchci/components/TestInsights.tsx deleted file mode 100644 index ae1a65ec8e..0000000000 --- a/torchci/components/TestInsights.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { IsJobInProgress } from "lib/JobClassifierUtil"; -import { JobData } from "../lib/types"; - -// The following jobs are not supported at the moment because neither the monitoring -// script is running there at the moment (libtorch, bazel, android) -const NOT_SUPPORTED_JOBS = ["android", "bazel", "libtorch"]; - -export default function TestInsightsLink({ - job, - separator, -}: { - job: JobData; - separator: string; -}) { - if (job === null) { - return null; - } - - if (IsJobInProgress(job.conclusion)) { - // If the job is still in progress, there is no test insights available yet - return null; - } - - const workflowId = - job.workflowId ?? - job.htmlUrl?.match( - // https://github.com/pytorch/pytorch/actions/runs/3228501114/job/5284857665 - new RegExp("^.+/(?\\d+)/job/.+$") - )?.groups?.workflowId; - - const jobId = - job.id ?? - job.logUrl?.match( - // https://ossci-raw-job-status.s3.amazonaws.com/log/9018026324 - new RegExp("^.+/log/(?\\d+)$") - )?.groups?.jobId; - - if (workflowId === null || jobId === null) { - return null; - } - - for (const name of NOT_SUPPORTED_JOBS) { - if (job.jobName?.includes(name)) { - return null; - } - } - - // Only show test insight link for test jobs - if (!job.jobName?.includes("test")) { - return null; - } - - return ( - - {separator} - - Test insights - - - ); -} diff --git a/torchci/pages/test/insights.tsx b/torchci/pages/test/insights.tsx deleted file mode 100644 index 62344cd71d..0000000000 --- a/torchci/pages/test/insights.tsx +++ /dev/null @@ -1,382 +0,0 @@ -import { Grid, Stack, Typography } from "@mui/material"; -import { TimeSeriesPanelWithData } from "components/metrics/panels/TimeSeriesPanel"; -import dayjs from "dayjs"; -import { fetcher } from "lib/GeneralUtils"; -import { RocksetParam } from "lib/rockset"; -import { useRouter } from "next/router"; -import { useState } from "react"; -import useSWR from "swr"; - -const LASTEST_N_RUNS = 50; -const ROW_HEIGHT = 240; -const TO_GB = 1024 * 1024 * 1024; - -function formatDate(timestamp: string) { - // TODO: This is a weird hack, see how to get rid of this later - return new Date(timestamp).toISOString().replace("T", " ").substring(0, 19); -} - -function formatSeries( - data: any, - // An optional list of markers to mark the start time of the jobs - startTimes: string[], - // An optional list of markers to mark the stop time of the jobs - stopTimes: string[] -) { - const markers = []; - - // TODO: only show the start and stop markers for individual job for now. When - // there are too many jobs aggregated together, it's too hard to see them all - if (startTimes.length == 1 && stopTimes.length == 1) { - for (const startTime of startTimes) { - markers.push({ - name: "Start testing", - xAxis: formatDate(startTime), - lineStyle: { - color: "blue", - }, - }); - } - - for (const stopTime of stopTimes) { - markers.push({ - name: "Stop testing", - xAxis: formatDate(stopTime), - lineStyle: { - color: "red", - }, - }); - } - } - - // Docs for formatting these apache echarts https://echarts.apache.org/en/option.html - return { - type: "line", - symbol: "circle", - symbolSize: 4, - data, - emphasis: { - focus: "series", - }, - markLine: { - symbol: ["none", "none"], - label: { - position: "middle", - formatter: (param: any) => { - return param.name; - }, - }, - data: markers, - }, - }; -} - -function DisplayInsights({ - data, - // Human-readable title of the panel. - title, - // What field name to treat as the time value. - timeFieldName, - // What field name to put on the y axis. - yAxisFieldName, - // What label to put on the y axis. - yAxisLabel, - // An optional list of markers to mark the start time of the jobs - startTimes, - // An optional list of markers to mark the stop time of the jobs - stopTimes, -}: { - data: any; - title: string; - timeFieldName: string; - yAxisFieldName: string; - yAxisLabel?: string; - startTimes: string[]; - stopTimes: string[]; -}) { - const chartData = []; - for (const e of data) { - chartData.push([e[timeFieldName], e[yAxisFieldName]]); - } - const chartSeries = formatSeries(chartData, startTimes, stopTimes); - - return ( - - `${unit}`} - /> - - ); -} - -function GetUsage({ - jobName, - workflowName, - testFile, - testClass, - workflowIds, - jobIds, -}: { - jobName: string; - workflowName?: string; - testFile?: string; - testClass?: string; - workflowIds: string[]; - jobIds: string[]; -}) { - const params = { - workflowName: workflowName, - jobName: jobName, - testFile: testFile, - testClass: testClass, - workflowIds: workflowIds, - jobIds: jobIds, - }; - - const url = `/api/usage-log-aggregator/lambda?params=${encodeURIComponent( - JSON.stringify(params) - )}`; - const { data } = useSWR(url, fetcher); - - if (data === undefined || data.length == 0) { - return <>; - } - - // When the returning data is empty, we know that the lambda has failed to find the - // usage log. This is expected to happend on MacOS and ROCm where the monitor script - // isn't run - if (data["timestamp"] === undefined || data["timestamp"].length === 0) { - return ( - <> - The job didn't generate any usage stats, so there is nothing to - analyze. Please submit an issue to PyTorch Dev Infra team. - - Create an issue - - - ); - } - - const transformedData = []; - // Transform the data a bit to fit into the same rockset schema - for (const idx in data["timestamp"]) { - transformedData.push({ - timestamp: data["timestamp"][idx], - cpu: data["cpu"][idx], - mem: data["mem"][idx] / TO_GB, - gpu: data["gpu"][idx], - gpu_mem: data["gpu_mem"][idx] / TO_GB, - }); - } - - if (transformedData.length !== 0) { - const lastTimestamp = new Date( - transformedData[transformedData.length - 1]["timestamp"] - ); - // Add one more 1-minute data point so that we can clearly show the stop time. This is - // purely for presentation purpose - const extra = new Date(lastTimestamp.getTime() + 60 * 1000); - - transformedData.push({ - timestamp: extra, - cpu: 0, - mem: 0, - gpu: 0, - gpu_mem: 0, - }); - } - - const startTimes = []; - const stopTimes = []; - for (const jobName in data["jobs"]) { - const job = data["jobs"][jobName]; - startTimes.push(job["start_time"]); - stopTimes.push(job["stop_time"]); - } - - return ( - - - - - - - - - - ); -} - -function GetJobs({ - jobName, - workflowName, - testFile, - testClass, - workflowId, - jobId, - queryParams, -}: { - jobName: string; - workflowName?: string; - testFile?: string; - testClass?: string; - workflowId?: string; - jobId?: string; - queryParams: RocksetParam[]; -}) { - const queryCollection = "commons"; - const queryName = "test_insights_latest_runs"; - - const workflowIds = []; - const jobIds = []; - - const url = `/api/query/${queryCollection}/${queryName}?parameters=${encodeURIComponent( - JSON.stringify(queryParams) - )}`; - const { data, error } = useSWR(url, fetcher); - - // If there is no workflow and job ID specified, query Rockset for the list of N latest jobs - if (workflowId == null || jobId == null) { - if (data === undefined || data.length == 0) { - return
; - } - - for (const e of data) { - workflowIds.push(e["workflow_id"]); - jobIds.push(e["job_id"]); - } - } else { - workflowIds.push(workflowId); - jobIds.push(jobId); - } - - return ( - - - {jobName} - - - - - ); -} - -export default function Page() { - return
Deprecated
; - const [startTime, _setStartTime] = useState(dayjs().subtract(1, "week")); - const [stopTime, _setStopTime] = useState(dayjs()); - - const router = useRouter(); - // Need all these parameters to narrow down the test selection - const workflowName = router.query.workflowName as string; - const jobName = router.query.jobName as string; - const testFile = router.query.testFile as string; - const testClass = router.query.testClass as string; - const workflowId = router.query.workflowId as string; - const jobId = router.query.jobId as string; - - if (jobName === undefined) { - return ( - - - Missing job name - - - ); - } - - const queryParams: RocksetParam[] = [ - { - name: "startTime", - type: "string", - value: startTime, - }, - { - name: "stopTime", - type: "string", - value: stopTime, - }, - { - name: "jobName", - type: "string", - value: jobName, - }, - { - name: "workflowName", - type: "string", - value: workflowName ?? "", - }, - { - name: "testFile", - type: "string", - value: testFile ?? "", - }, - { - name: "testClass", - type: "string", - value: testClass ?? "", - }, - { - name: "limit", - type: "int", - value: LASTEST_N_RUNS, - }, - ]; - - return ( - - ); -} From d28d0902c7d73bcf9e045f217b095b862f2b4707 Mon Sep 17 00:00:00 2001 From: Catherine Lee Date: Tue, 10 Dec 2024 13:25:12 -0800 Subject: [PATCH 3/3] tc --- torchci/pages/kpis.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/torchci/pages/kpis.tsx b/torchci/pages/kpis.tsx index 2c845e295d..c744053b33 100644 --- a/torchci/pages/kpis.tsx +++ b/torchci/pages/kpis.tsx @@ -81,7 +81,6 @@ export default function Kpis() { yAxisFieldName={"ttrs_mins"} yAxisRenderer={(duration) => duration} groupByFieldName={"percentile"} - useClickHouse={false} />