-
Notifications
You must be signed in to change notification settings - Fork 75
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
[ch] Dr. CI to use CH Part 1 #5634
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
c114332
to
47d6a09
Compare
47d6a09
to
b21443c
Compare
b21443c
to
d74df70
Compare
acc[row.pr_num].push(row.merge_commit_sha); | ||
return acc; | ||
}, new Map<number, string[]>()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this function here from jobUtils.ts because it imports from clickhouse.ts file
label, | ||
}); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split up functions since I want Dr. CI to use CH, but hud to still use rockset for now, and the gating by environment variable doesn't work for that
OWNER, | ||
repo, | ||
Array.from(workflowsByPR.keys()) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this query to be out of the loop so its one big query instead of one query for each PR
@@ -81,3 +89,5 @@ WHERE | |||
w.id in (select id from materialized_views.workflow_run_by_head_sha where head_sha in (select sha from recent_prs)) | |||
ORDER BY | |||
time DESC | |||
-- Non experimental analyzer has problems with final... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought, the need to add final into all the different places seems easy to miss. Maybe we should adopt what @kit1980 has been doing in https://github.com/pytorch/test-infra/blob/main/torchci/clickhouse_queries/queued_jobs_by_label/query.sql#L48 by setting final to true for the whole query?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe when we get a linter working in CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, a linter for this would be good
torchci/lib/clickhouse.ts
Outdated
@@ -1,5 +1,12 @@ | |||
// This file can't be imported by .tsx files due to client/server stuff (ex not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can only be used on the server side, i.e. API. All HUD pages should query the API https://github.com/pytorch/test-infra/tree/main/torchci/pages/api/clickhouse to get the data instead. This is the same reason I need to add the toggle for CH/Rockset on HUD metric page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something that can be done by a linter?
// Import itself to ensure that mocks can be applied, see | ||
// https://stackoverflow.com/questions/51900413/jest-mock-function-doesnt-work-while-it-was-called-in-the-other-function | ||
// https://stackoverflow.com/questions/45111198/how-to-mock-functions-in-the-same-module-using-jest | ||
import * as thisModule from "./clickhouse"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL! Previously, I need to refactor the code to move the functions I want to mock to another module instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some minors comments but overall LGTM!
Follow up to #5634. These are the one off queries that I needed to track down. Surprisingly, none of the current PRs go through this path, so I used some older PRs, like 135397, 114772, as tests
Moves most queries used by Dr. CI to CH. There are some one off queries that I still need to track down
!
. This causes a mild conflict with theJobData
struct, so there's some casting that I don't think actually does anything. I'm also not sure how accurate the typing was originally, since I think some ids were int before toodayjs.utc
to make sure it is correct (dayjs
uses local timezone by default)I checked the outputs by cherry picking csl/comp_orig (4db3fa5) onto this branch and origin/main (origin/main also needs 055a919 to fix a bug), running curl
curl "http://localhost:3000/api/drci/drci" --data 'repo=pytorch' > ../_logs/<new, orig>.json
, running a scriptand the diffing the files
There were small differences which I then checked individually, and they were due to the databases not being exactly the same when I did the curls. There were also some small differences in which disable issues were used, but based on the code for that I think it's still technically correct