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

ENH: Store stats in mongo atlas #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

oesteban
Copy link
Member

@oesteban oesteban commented Jan 4, 2023

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?

@oesteban oesteban requested a review from mgxd January 4, 2023 11:18
Copy link

@mgxd mgxd left a 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)
Copy link

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.

Copy link
Member Author

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.

Comment on lines +52 to +58
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"
)
)
Copy link

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?

@oesteban
Copy link
Member Author

oesteban commented Jan 4, 2023

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.

@vsoch
Copy link

vsoch commented Jan 4, 2023

Why not use ORAS?

@oesteban
Copy link
Member Author

oesteban commented Jan 4, 2023

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)

@oesteban
Copy link
Member Author

oesteban commented Jan 4, 2023

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.

3 participants