diff --git a/torchci/clickhouse_queries/nightly_jobs_red/params.json b/torchci/clickhouse_queries/nightly_jobs_red/params.json index f145ed276d..b05661e470 100644 --- a/torchci/clickhouse_queries/nightly_jobs_red/params.json +++ b/torchci/clickhouse_queries/nightly_jobs_red/params.json @@ -2,6 +2,5 @@ "granularity": "String", "repo": "String", "startTime": "DateTime64(3)", - "stopTime": "DateTime64(3)", - "timezone": "String" -} \ No newline at end of file + "stopTime": "DateTime64(3)" +} diff --git a/torchci/clickhouse_queries/nightly_jobs_red/query.sql b/torchci/clickhouse_queries/nightly_jobs_red/query.sql index 66d87c6ef2..b991012274 100644 --- a/torchci/clickhouse_queries/nightly_jobs_red/query.sql +++ b/torchci/clickhouse_queries/nightly_jobs_red/query.sql @@ -1,37 +1,37 @@ --- !!! Query is not converted to CH syntax yet. Delete this line when it gets converted SELECT - FORMAT_ISO8601( - DATE_TRUNC(:granularity, time) + DATE_TRUNC( + {granularity: String }, + time ) AS granularity_bucket, AVG( CASE when conclusion = 'failure' THEN 1 when conclusion = 'timed_out' THEN 1 when conclusion = 'cancelled' THEN 1 - when conclusion = 'skipped' THEN 1 + when conclusion = 'skipped' THEN 1 ELSE 0 END - ) as red, + ) as red FROM - ( - SELECT - job._event_time AT TIME ZONE :timezone as time, - job.conclusion as conclusion, - FROM - commons.workflow_job job - JOIN commons.workflow_run workflow on workflow.id = job.run_id - JOIN push on workflow.head_commit.id = push.head_commit.id - WHERE - job.name NOT LIKE '%generate-matrix%' - AND job.name NOT LIKE '%unittests%' - AND workflow.name NOT IN ('cron', 'Bandit', 'tests') - AND push.ref = 'refs/heads/nightly' - AND push.repository.owner.name = 'pytorch' - AND push.repository.name = :repo - AND job._event_time >= PARSE_DATETIME_ISO8601(:startTime) - AND job._event_time < PARSE_DATETIME_ISO8601(:stopTime) - ) as all_job +( +SELECT + job.created_at AS time, + job.conclusion AS conclusion +FROM + workflow_job job + JOIN workflow_run workflow ON workflow.id = job.run_id + JOIN push ON workflow.head_commit.'id' = push.head_commit.'id' +WHERE + job.name NOT LIKE '%generate-matrix%' + AND job.name NOT LIKE '%unittests%' + AND workflow.name NOT IN ('cron', 'Bandit', 'tests') + AND push.ref = 'refs/heads/nightly' + AND push.repository.'owner'.'name' = 'pytorch' + AND push.repository.'name' = {repo: String } + AND job.created_at >= {startTime: DateTime64(3)} + AND job.created_at < {stopTime: DateTime64(3)} +) GROUP BY - DATE_TRUNC(:granularity, time) + granularity_bucket ORDER BY - DATE_TRUNC(:granularity, time) ASC + granularity_bucket ASC diff --git a/torchci/clickhouse_queries/nightly_jobs_red_by_name/query.sql b/torchci/clickhouse_queries/nightly_jobs_red_by_name/query.sql index be86ee4650..3409880753 100644 --- a/torchci/clickhouse_queries/nightly_jobs_red_by_name/query.sql +++ b/torchci/clickhouse_queries/nightly_jobs_red_by_name/query.sql @@ -1,20 +1,19 @@ --- !!! Query is not converted to CH syntax yet. Delete this line when it gets converted -SELECT - COUNT(*) COUNT, workflow.name + SELECT + COUNT(*) AS COUNT, + workflow.name as name FROM - commons.workflow_job job - JOIN commons.workflow_run workflow on workflow.id = job.run_id - JOIN push on workflow.head_commit.id = push.head_commit.id + workflow_job job + JOIN workflow_run workflow on workflow.id = job.run_id + JOIN push ON workflow.head_commit.'id' = push.head_commit.'id' WHERE job.name NOT LIKE '%generate-matrix%' AND job.name NOT LIKE '%unittests%' AND workflow.name NOT IN ('cron', 'Bandit', 'tests', 'Lint') AND push.ref = 'refs/heads/nightly' - AND push.repository.owner.name = 'pytorch' - AND push.repository.name in ('pytorch', 'vision', 'audio', 'text') - AND job._event_time >= PARSE_DATETIME_ISO8601(:startTime) - AND job._event_time < PARSE_DATETIME_ISO8601(:stopTime) - AND job.conclusion in ('failure', 'timed_out', 'cancelled') + AND push.repository.'owner'.'name' = 'pytorch' + AND push.repository.'name' IN ('pytorch', 'vision', 'audio') + AND job.created_at >= {startTime: DateTime64(3)} + AND job.created_at < {stopTime: DateTime64(3)} + AND job.conclusion IN ('failure', 'timed_out', 'cancelled') GROUP BY workflow.name - ORDER BY COUNT DESC diff --git a/torchci/clickhouse_queries/nightly_jobs_red_by_platform/params.json b/torchci/clickhouse_queries/nightly_jobs_red_by_platform/params.json index b2ae5eb177..9d4d78152f 100644 --- a/torchci/clickhouse_queries/nightly_jobs_red_by_platform/params.json +++ b/torchci/clickhouse_queries/nightly_jobs_red_by_platform/params.json @@ -1,4 +1,5 @@ { "startTime": "DateTime64(3)", - "stopTime": "DateTime64(3)" -} \ No newline at end of file + "stopTime": "DateTime64(3)", + "repo": "String" +} diff --git a/torchci/clickhouse_queries/nightly_jobs_red_by_platform/query.sql b/torchci/clickhouse_queries/nightly_jobs_red_by_platform/query.sql index ec5495e641..ba534eac6e 100644 --- a/torchci/clickhouse_queries/nightly_jobs_red_by_platform/query.sql +++ b/torchci/clickhouse_queries/nightly_jobs_red_by_platform/query.sql @@ -1,38 +1,30 @@ --- !!! Query is not converted to CH syntax yet. Delete this line when it gets converted WITH all_failed_jobs AS ( - SELECT - COUNT(*) COUNT, workflow.path + SELECT + COUNT(*) AS COUNT, workflow.path FROM - commons.workflow_job job - JOIN commons.workflow_run workflow on workflow.id = job.run_id - JOIN push on workflow.head_commit.id = push.head_commit.id + workflow_job job + JOIN workflow_run workflow on workflow.id = job.run_id + JOIN push ON workflow.head_commit.'id' = push.head_commit.'id' WHERE job.name NOT LIKE '%generate-matrix%' AND job.name NOT LIKE '%unittests%' AND workflow.name NOT IN ('cron', 'Bandit', 'tests', 'Lint') AND push.ref = 'refs/heads/nightly' - AND push.repository.owner.name = 'pytorch' - AND push.repository.name in ('pytorch', 'vision', 'audio', 'text') - AND job._event_time >= PARSE_DATETIME_ISO8601(:startTime) - AND job._event_time < PARSE_DATETIME_ISO8601(:stopTime) - AND job.conclusion in ('failure', 'timed_out', 'cancelled') + AND push.repository.'owner'.'name' = 'pytorch' + AND push.repository.'name' = {repo: String } + AND job.created_at >= {startTime: DateTime64(3)} + AND job.created_at < {stopTime: DateTime64(3)} + AND job.conclusion IN ('failure', 'timed_out', 'cancelled') GROUP BY workflow.path ) -SELECT - SUM(COUNT) as Count, 'Conda' as Platform -FROM - all_failed_jobs -where path like '%conda%' -UNION SELECT SUM(COUNT) as Count, 'Wheel' as Platform FROM all_failed_jobs -where path like '%wheel%' -UNION +where workflow.path like '%wheel%' +UNION ALL SELECT SUM(COUNT) as Count, 'Libtorch' as Platform FROM all_failed_jobs -where path like '%libtorch%' - +where workflow.path like '%libtorch%' diff --git a/torchci/clickhouse_queries/nightly_jobs_red_past_day/query.sql b/torchci/clickhouse_queries/nightly_jobs_red_past_day/query.sql index 637166ca0f..e19a38c730 100644 --- a/torchci/clickhouse_queries/nightly_jobs_red_past_day/query.sql +++ b/torchci/clickhouse_queries/nightly_jobs_red_past_day/query.sql @@ -1,20 +1,18 @@ --- !!! Query is not converted to CH syntax yet. Delete this line when it gets converted SELECT - COUNT(*) COUNT, - job.name + COUNT(*) AS COUNT, + job.name as name FROM - commons.workflow_job job - JOIN commons.workflow_run workflow on workflow.id = job.run_id - JOIN push on workflow.head_commit.id = push.head_commit.id + workflow_job job + JOIN workflow_run workflow ON workflow.id = job.run_id + join push on push.head_commit.'id' = workflow.head_commit.'id' WHERE job.name NOT LIKE '%generate-matrix%' AND job.name NOT LIKE '%unittests%' AND workflow.name NOT IN ('cron', 'Bandit', 'tests') AND push.ref = 'refs/heads/nightly' - AND push.repository.owner.name = 'pytorch' - AND push.repository.name = :repo - AND job.conclusion in ('failure', 'timed_out', 'cancelled') - AND job._event_time >= CURRENT_DATE() - INTERVAL 1 DAY + AND push.repository.'owner'.'name' = 'pytorch' + AND push.repository.'name' = {repo: String } + AND job.conclusion IN ('failure', 'timed_out', 'cancelled') + AND job.completed_at >= today() - 1 GROUP BY job.name -ORDER BY COUNT - +ORDER BY COUNT; diff --git a/torchci/clickhouse_queries/validation_jobs_red_past_day/query.sql b/torchci/clickhouse_queries/validation_jobs_red_past_day/query.sql index 0ac82c8db3..6c3c300aa9 100644 --- a/torchci/clickhouse_queries/validation_jobs_red_past_day/query.sql +++ b/torchci/clickhouse_queries/validation_jobs_red_past_day/query.sql @@ -1,17 +1,15 @@ --- !!! Query is not converted to CH syntax yet. Delete this line when it gets converted SELECT - COUNT(*) COUNT, - job.name + COUNT(*) AS COUNT, + job.name as name FROM - commons.workflow_job job - JOIN commons.workflow_run workflow on workflow.id = job.run_id + workflow_job job + JOIN workflow_run workflow ON workflow.id = job.run_id WHERE - job.head_branch = 'main' - AND workflow.name = 'cron' - AND workflow.event = 'schedule' - AND job.conclusion in ('failure', 'timed_out', 'cancelled') - AND job.name like CONCAT('%',:channel,'%') - AND workflow.repository.full_name = 'pytorch/builder' - AND job._event_time >= CURRENT_DATE() - INTERVAL 1 DAY + job.head_branch = 'main' + AND workflow.name like '%Binaries Validations%' + AND workflow.event = 'schedule' + AND job.name like concat('%', {channel: String}, '%') + AND job.conclusion IN ('failure', 'timed_out', 'cancelled') + AND job.completed_at >= today() - 1 GROUP BY job.name -ORDER BY COUNT DESC \ No newline at end of file +ORDER BY COUNT DESC; diff --git a/torchci/pages/nightlies.tsx b/torchci/pages/nightlies.tsx index 4c84e6fcf4..94bd16ceb3 100644 --- a/torchci/pages/nightlies.tsx +++ b/torchci/pages/nightlies.tsx @@ -1,10 +1,9 @@ import { Grid, Paper, Skeleton, Stack, Typography } from "@mui/material"; -import TablePanel from "components/metrics/panels/TablePanelRS"; +import TablePanel from "components/metrics/panels/TablePanel"; import dayjs from "dayjs"; import { EChartsOption } from "echarts"; import ReactECharts from "echarts-for-react"; import { fetcher } from "lib/GeneralUtils"; -import { RocksetParam } from "lib/rockset"; import { TimeRangePicker } from "pages/metrics"; import { useState } from "react"; import useSWR from "swr"; @@ -13,14 +12,16 @@ function NightlyJobsRedPanel({ params, repo, }: { - params: RocksetParam[]; + params: { [key: string]: any }; repo: string; }) { - let repo_p = params.find(({ name }) => name == "repo"); - if (repo_p && repo) repo_p.value = repo; - - const url = `/api/query/nightlies/nightly_jobs_red?parameters=${encodeURIComponent( - JSON.stringify(params) + const queryParams: { [key: string]: any } = { + ...params, + repo: repo, + granularity: "day", + }; + const url = `/api/clickhouse/nightly_jobs_red?parameters=${encodeURIComponent( + JSON.stringify(queryParams) )}`; const { data } = useSWR(url, fetcher, { @@ -71,134 +72,17 @@ function NightlyJobsRedPanel({ ); } -function ValidationRedPanel({ - params, - channel, - query_type, -}: { - params: RocksetParam[]; - channel: string; - query_type: string; -}) { - const url = - `/api/query/nightlies/` + - query_type + - `_jobs_red?parameters=${encodeURIComponent( - JSON.stringify([ - ...params, - { - name: "timezone", - type: "string", - value: Intl.DateTimeFormat().resolvedOptions().timeZone, - }, - { - name: "channel", - type: "string", - value: channel, - }, - ]) - )}`; - - const { data } = useSWR(url, fetcher, { - refreshInterval: 5 * 60 * 1000, // refresh every 5 minutes - }); - - if (data === undefined) { - return ; - } - - const options: EChartsOption = { - title: { - text: - channel.charAt(0).toUpperCase() + - channel.slice(1) + - " " + - query_type.charAt(0).toUpperCase() + - query_type.slice(1) + - " workflows failures", - }, - grid: { top: 60, right: 8, bottom: 24, left: 36 }, - dataset: { source: data }, - xAxis: { type: "category" }, - yAxis: { - type: "value", - }, - series: [ - { - type: "bar", - stack: "all", - encode: { - x: "granularity_bucket", - y: "green", - }, - }, - { - type: "bar", - stack: "all", - encode: { - x: "granularity_bucket", - y: "red", - }, - }, - { - type: "bar", - stack: "all", - encode: { - x: "granularity_bucket", - y: "pending", - }, - }, - ], - color: ["#3ba272", "#ee6666", "#f2d643"], - tooltip: { - trigger: "axis", - formatter: (params: any) => { - const red = params[0].data.red; - const green = params[0].data.green; - const pending = params[0].data.pending; - const total = params[0].data.total; - - const redPct = ((red / total) * 100).toFixed(2) + "%"; - const greenPct = ((green / total) * 100).toFixed(2) + "%"; - const pendingPct = ((pending / total) * 100).toFixed(2) + "%"; - return `Red: ${red} (${redPct})
Green: ${green} (${greenPct})
Pending: ${pending} (${pendingPct})
Total: ${total}`; - }, - }, - }; - - return ( - - - - ); -} - const ROW_HEIGHT = 340; export default function Page() { const [startTime, setStartTime] = useState(dayjs().subtract(1, "week")); const [stopTime, setStopTime] = useState(dayjs()); const [timeRange, setTimeRange] = useState(7); - const timeParams: RocksetParam[] = [ - { - name: "startTime", - type: "string", - value: startTime, - }, - { - name: "stopTime", - type: "string", - value: stopTime, - }, - { - name: "repo", - type: "string", - value: "pytorch", - }, - ]; + const timeParams = { + startTime: dayjs(startTime).utc().format("YYYY-MM-DDTHH:mm:ss.SSS"), + stopTime: dayjs(stopTime).utc().format("YYYY-MM-DDTHH:mm:ss.SSS"), + repo: "pytorch", + }; return (
@@ -225,19 +109,12 @@ export default function Page() { el.name }} + dataGridProps={{ getRowId: (el: any) => el["name"] }} /> @@ -249,19 +126,12 @@ export default function Page() { el.name }} + dataGridProps={{ getRowId: (el: any) => el["name"] }} /> @@ -273,51 +143,12 @@ export default function Page() { el.name }} - /> - - - - - - - - el.name }} - /> - - - - el["name"] }} /> @@ -325,27 +156,12 @@ export default function Page() { el.name }} - /> - - - - el["name"] }} /> @@ -353,27 +169,12 @@ export default function Page() { el.name }} - /> - - - - el["name"] }} /> @@ -384,12 +185,11 @@ export default function Page() { } queryName={"nightly_jobs_red_by_name"} queryParams={timeParams} - queryCollection="nightlies" columns={[ { field: "COUNT", headerName: "Count", flex: 1 }, { field: "name", headerName: "Name", flex: 4 }, ]} - dataGridProps={{ getRowId: (el: any) => el.name }} + dataGridProps={{ getRowId: (el: any) => el["name"] }} /> @@ -400,7 +200,6 @@ export default function Page() { } queryName={"nightly_jobs_red_by_platform"} queryParams={timeParams} - queryCollection="nightlies" columns={[ { field: "Count", headerName: "Count", flex: 1 }, { field: "Platform", headerName: "Platform", flex: 4 },