-
Notifications
You must be signed in to change notification settings - Fork 1
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
ENH: Store stats in mongo atlas #1
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comments, but overall looks good - is it working?
from api import get_events | ||
|
||
# Get events | ||
for event in ("started", "success", "failed"): | ||
get_events(event, limit=limit) | ||
get_events(event, limit=limit, mongo_password=mongo_password, mongo_user=mongo_user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently this function is called multiple times while initializing the database connection - I think it would be cleaner to isolate the client initialization within its own function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I hadn't thought of this. This is almost certainly a problem also in current main.
db_client = ( | ||
MongoClient() if mongo_password is None | ||
else MongoClient( | ||
f"mongodb+srv://{quote_plus(mongo_user)}:{quote_plus(mongo_password)}" | ||
"@sentrybackup.sywajav.mongodb.net/?retryWrites=true&w=majority" | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than calling MongoClient
twice, what about having host default to "localhost"
and then updating it if user credentials are present?
It's working locally (the main branch works, basically), but these changes don't. I assumed it was because my computer is in a heavily filtered network, so I believe connections to the remote mongo are being disallowed. I haven't been able to run this somewhere else. But thanks for the speedy feedback, it definitely will help move this forward. |
Why not use ORAS? |
Hey, thanks for chiming in! I'm surprised you keep an eye on this corner of GitHub :) I would eagerly give it a try... but I don't even know what ORAS is. Can you give me a pointer for where to look? (a quick google search didn't give anything useful, but I will admit it was on my phone) |
I'm trying to store results in an atlas db to see if we can share results that way. Do you mind having a look, @mgxd?