From 9c0112fdf8d4a8cea6444e24fe5d97841bf67c35 Mon Sep 17 00:00:00 2001 From: paramthakkar123 Date: Sat, 19 Apr 2025 00:25:47 +0530 Subject: [PATCH] Modified Dr. CI so it could detect runner disconnection failures --- torchci/lib/drciUtils.ts | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/torchci/lib/drciUtils.ts b/torchci/lib/drciUtils.ts index 89447efac4..7eaec62dab 100644 --- a/torchci/lib/drciUtils.ts +++ b/torchci/lib/drciUtils.ts @@ -100,14 +100,25 @@ export function formDrciComment( owner: string = OWNER, repo: string = REPO, pr_results: string = "", - sevs: string = "" + sevs: string = "", + runnerDisconnectionJobs: RecentWorkflowsData[] = [] ): string { const header = formDrciHeader(owner, repo, pr_num); - const comment = `${DRCI_COMMENT_START} + let comment = `${DRCI_COMMENT_START} ${header} ${sevs} ${pr_results} ${DRCI_COMMENT_END}`; + + if (runnerDisconnectionJobs.length > 0) { + comment += `\n\n## :warning: Runner Disconnection Failures\n`; + comment += runnerDisconnectionJobs + .map( + (job) => + `- [${job.name}](${job.html_url}): Runner disconnection detected.` + ) + .join("\n"); + } return comment; } @@ -553,3 +564,16 @@ export async function isSameAuthor( // * Cherry picking return isSameEmail || isSameCommitUsername || isSamePrUsername; } + +export function isRunnerDisconnectionFailure(job: RecentWorkflowsData): boolean { + const runnerDisconnectionPatterns = [ + /The runner has received a shutdown signal/i, + /The operation was canceled/i, + /The runner could not connect to the server/i, + /The runner is offline/i, + ]; + + return runnerDisconnectionPatterns.some((pattern) => + job.failure_lines.some((line) => pattern.test(line)) + ); +}