Skip to content

Commit 9efd66f

Browse files
committedMar 21, 2025·
use private threads for detailed results
1 parent 995fb2d commit 9efd66f

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed
 

‎src/discord-cluster-manager/bot.py

-10
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,6 @@ async def on_ready(self):
223223

224224
await self._setup_leaderboards()
225225

226-
async def create_thread(
227-
self, interaction: discord.Interaction, gpu_name: str, job_name: str
228-
) -> discord.Thread:
229-
thread = await interaction.channel.create_thread(
230-
name=f"{job_name} ({gpu_name})",
231-
type=discord.ChannelType.public_thread,
232-
auto_archive_duration=1440,
233-
)
234-
return thread
235-
236226
async def send_chunked_message(self, channel, content: str, code_block: bool = True):
237227
"""
238228
Send a long message in chunks to avoid Discord's message length limit

‎src/discord-cluster-manager/cogs/submit_cog.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,18 @@ async def _handle_submission(
123123
Returns:
124124
if successful, returns the result of the run.
125125
"""
126-
thread_name = f"{self.name} - {mode.value.capitalize()} Job"
127-
128126
script_content = await self._validate_input_file(interaction, script)
129127
if script_content is None:
130128
return None
131129

132130
# TODO figure out the correct way to handle messaging here
133131
if mode != SubmissionMode.PRIVATE:
134-
thread = await self.bot.create_thread(interaction, gpu_type.name, f"{thread_name}")
132+
thread = await interaction.channel.create_thread(
133+
name=f"{script.filename} on {gpu_type.name} ({self.name})",
134+
type=discord.ChannelType.private_thread,
135+
auto_archive_duration=1440,
136+
)
137+
await thread.add_tags(interaction.user)
135138
config = build_task_config(
136139
task=task, submission_content=script_content, arch=self._get_arch(gpu_type), mode=mode
137140
)
@@ -155,6 +158,7 @@ async def _handle_submission(
155158

156159
try:
157160
await generate_report(thread, result.runs)
161+
await reporter.push(f"See results at {thread.jump_url}")
158162
except Exception as E:
159163
logger.error("Error generating report. Result: %s", result, exc_info=E)
160164
raise

0 commit comments

Comments
 (0)
Please sign in to comment.