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

Handle connection exception when checking the user #207

Merged
merged 3 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion clockwork_web/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ def get(mila_email_username: str):

mc = get_db()

L = list(mc["users"].find({"mila_email_username": mila_email_username}))
try:
L = list(mc["users"].find({"mila_email_username": mila_email_username}))
except:
return None

# This is not an error from which we expect to be able to recover gracefully.
# It could happen if you copied data from your database directly
# using an external script, and ended up with many instances of your users.
Expand Down
1 change: 1 addition & 0 deletions scripts/ensure_one_fake_admin_in_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Helper script to make sure testing db contains at least 1 admin user.
Used for frontend admin tests.
"""

from slurm_state.mongo_client import get_mongo_client
from slurm_state.config import get_config

Expand Down
Loading