|
| 1 | +import asyncio |
| 2 | +import os |
| 3 | +import zipfile |
| 4 | +from datetime import datetime, timedelta, timezone |
| 5 | + |
1 | 6 | import discord |
| 7 | +import requests |
| 8 | +from consts import GITHUB_REPO, GITHUB_TOKEN, GPUType |
2 | 9 | from discord import app_commands |
3 | 10 | from discord.ext import commands |
4 | | -from datetime import datetime, timezone, timedelta |
5 | | -import asyncio |
6 | | -import requests |
7 | | -import zipfile |
8 | | -import os |
9 | 11 | from github import Github |
10 | | -from utils import setup_logging, get_github_branch_name |
11 | | -from consts import GPUType, GITHUB_TOKEN, GITHUB_REPO |
12 | | -from leaderboard_eval import py_eval, cu_eval |
| 12 | +from leaderboard_eval import cu_eval, py_eval |
| 13 | +from utils import get_github_branch_name, setup_logging |
13 | 14 |
|
14 | 15 | logger = setup_logging() |
15 | 16 |
|
@@ -100,12 +101,13 @@ async def run_github( |
100 | 101 | "Failed to trigger GitHub Action. Please check the configuration." |
101 | 102 | ) |
102 | 103 |
|
| 104 | + return thread |
| 105 | + |
103 | 106 | except Exception as e: |
104 | 107 | logger.error(f"Error processing request: {str(e)}", exc_info=True) |
105 | | - await thread.send(f"Error processing request: {str(e)}") |
106 | | - |
107 | | - finally: |
108 | | - return thread |
| 108 | + if thread: |
| 109 | + await thread.send(f"Error processing request: {str(e)}") |
| 110 | + raise |
109 | 111 |
|
110 | 112 | async def trigger_github_action( |
111 | 113 | self, |
@@ -175,7 +177,8 @@ async def check_workflow_status(self, run_id, thread): |
175 | 177 | if elapsed_time > timeout: |
176 | 178 | try: |
177 | 179 | run.cancel() |
178 | | - # Wait briefly to ensure cancellation is processed and Verify the run was actually cancelled |
| 180 | + # Wait briefly to ensure cancellation is processed |
| 181 | + # And Verify the run was actually cancelled |
179 | 182 | await asyncio.sleep(5) |
180 | 183 | run = repo.get_workflow_run(run_id) |
181 | 184 | if run.status != "completed": |
|
0 commit comments