Skip to content
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

Refactoring try-excepts and remove prints. #57

Merged
merged 6 commits into from
Dec 17, 2024
Merged

Conversation

alexzhang13
Copy link
Collaborator

@alexzhang13 alexzhang13 commented Dec 16, 2024

Description

This PR refactors the try-except logic in the leaderboard cog. It also removes redundant prints, and prevents leaking exact error traces to the Discord user. It also fixes a bug for when a duplicate leaderboard is created, and returns a better user message.

Screenshot 2024-12-15 at 9 50 56 PM

Checklist

Before submitting this PR, ensure the following steps have been completed:

  • Run the slash command /verifyruns on your own server.
    • Run the cluster bot on your server:
      python discord-bot.py
    • Start training runs with the slash command /verifyruns.
    • Verify that the bot eventually responds with:
      ✅ All runs completed successfully!
      
      (It may take a few minutes for all runs to finish. In particular, the GitHub
      runs may take a little longer. The Modal run is typically quick.)
      For more information on running a cluster bot on your own server, see
      README.md.

@alexzhang13 alexzhang13 requested a review from b9r5 December 16, 2024 05:51
f"Leaderboard '{leaderboard_name}' created.\n"
+ f"Reference code: {reference_code}.\n"
+ f"Submission deadline: {date_value}",
print("HAHA", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print("HAHA", err)

logger.error(str(e))
if "'NoneType' object is not subscriptable" in str(e):
await interaction.response.send_message(
f"The leaderboard '{leaderboard_name}' doesn't exist.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be weird because there was already a db.get_leaderboard(...) call above.

@alexzhang13 alexzhang13 merged commit 1fe2c0b into main Dec 17, 2024
1 check failed
@alexzhang13 alexzhang13 deleted the refactor_try_excepts branch December 17, 2024 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants