Skip to content

Commit 9effa8e

Browse files
authored
[ez][disablebot] Run every 6 hours instead of 3 (#6877)
As in title. Why: to allow flaky issues to build up more so it is more likely to generate more aggregate issues, since right now there are a bunch but the number doesn't hit the threshold Also change the "was recent" calculation to be a bit more restrictive now that the time is longer to allow for changes to propagate a bit Testing: Added a test and `yarn test`
1 parent b75207f commit 9effa8e

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.github/workflows/disable-flaky-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Disable Flaky Tests
22

33
on:
44
schedule:
5-
# At minute 39 past every 3rd hour Monday through Friday.
6-
- cron: "39 */3 * * 1-5"
5+
# At minute 39 past every 6th hour Monday through Friday.
6+
- cron: "39 */6 * * 1-5"
77
# Have the ability to trigger this job manually through the API
88
workflow_dispatch:
99

torchci/pages/api/flaky-tests/disable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import _ from "lodash";
1212
import type { NextApiRequest, NextApiResponse } from "next";
1313
import { Octokit } from "octokit";
1414

15-
export const NUM_HOURS = 3;
15+
export const NUM_HOURS = 6;
1616
const PYTORCH = "pytorch";
1717
const THRESHOLD = 4;
1818

@@ -300,7 +300,7 @@ async function handleNoLongerFlakyTests(
300300
function wasRecent(test: FlakyTestData) {
301301
if (test.eventTimes) {
302302
return test.eventTimes.some(
303-
(value) => dayjs().diff(dayjs(value), "minutes") < NUM_HOURS * 60
303+
(value) => dayjs().diff(dayjs(value), "minutes") < (NUM_HOURS - 1) * 60
304304
);
305305
}
306306
return true;

torchci/test/flakyBotTests/flakyBotIntegration.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ describe("Disable Flaky Test Integration Tests", () => {
8383
handleScope(scope);
8484
});
8585

86+
test("Do not create new issue if too old", async () => {
87+
const flakyTest = {
88+
...flakyTestA,
89+
eventTimes: flakyTestA.eventTimes?.map((t) =>
90+
dayjs().subtract(5.5, "hour").toString()
91+
),
92+
};
93+
// Should do nothing, so no scope
94+
await disableFlakyTestBot.handleAll(octokit, [flakyTest], [], [], []);
95+
});
96+
8697
test("Comment on open issue", async () => {
8798
const flakyTest = { ...flakyTestA };
8899
const issues = [genSingleIssueFor(flakyTest, {})];

0 commit comments

Comments
 (0)