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

MongoDB Output #159

Merged
merged 5 commits into from May 10, 2019
Merged

MongoDB Output #159

merged 5 commits into from May 10, 2019

Conversation

coderdj
Copy link
Contributor

@coderdj coderdj commented May 9, 2019

Started with a mongodb store that Jelle wrote then removed from strax ~1 year ago and updated it to the frontend/backend/saver paradigm. It's for use in the online monitoring where some basic plugins will dump info to MongoDB for display online.

Copy link
Member

@JelleAalbers JelleAalbers left a comment

Choose a reason for hiding this comment

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

Looks good Dan, thanks for adding this! I forgot why the old MongoDB store was removed, but maybe I was too lazy to port it to the new frontend/backend paradigm... This also fixes many issues with that old code, such as support for multi-row chunks and array fields.

limit is respected!
"""

try:
Copy link
Member

Choose a reason for hiding this comment

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

pymongo is now a dependency (due to using json_util also in the files backend), so this check is not needed.

self.log.debug(f"{key} is NOT in cache.")
raise strax.DataNotAvailable

def _read_meta(self, coll_name):
Copy link
Member

Choose a reason for hiding this comment

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

This is not used right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestions. Updated.

One thing I just noticed is that I never call 'drop'. Is it standard in strax to leave partial data written on disk or clear it in case of a crash? I saw the allow_partial option so I'm assuming I could use that if I want to handle it somehow.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! Indeed it's standard to leave it; this dates back to when we thought online deletion was necessary. The only time strax clears data is while overwriting, I guess you could drop the collection if it already exists when you init the saver, just like in https://github.com/AxFoundation/strax/blob/master/strax/storage/files.py#L277. The frontend has an allow_overwrite option that can prevent savers getting created if the data already exists and isn't corrupted (unless you say you want to overwrite).

@JelleAalbers JelleAalbers merged commit 2f8ce1a into AxFoundation:master May 10, 2019
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.

None yet

2 participants