-
Notifications
You must be signed in to change notification settings - Fork 33
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
Create a MultiStore object and a Store-like object to access it #787
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #787 +/- ##
==========================================
+ Coverage 88.26% 88.56% +0.29%
==========================================
Files 42 43 +1
Lines 3188 3323 +135
==========================================
+ Hits 2814 2943 +129
- Misses 374 380 +6
☔ View full report in Codecov by Sentry. |
I wrote a script to test if the classes introduced here work as intended when working with multiple processes, but I'm not sure how to integrate it into the pytest, since it uses helper functions. Here it is:
|
Hi @sivonxay, this looks great. Thanks for putting it together. No concerns on my end other than the tests, but I can take a look at that. I think this is general enough to be appropriate in maggma, as you say. Happy to merge now. |
Thanks Jason! |
The primary goal of the
MultiStore
object is to solve an issue where individual fireworks making connections to Stores can lead to a large number of total connections. When running inrlaunch multi
mode, these connections can be pooled with little issue. In order to accomplish this, aStore
should be shared across multiple processes.MongoClient
already handles connection pooling, but it cannot be passed to child processes, since pickling will result in new connections being made. To circumvent this, amultiprocessing.Manager
can be used to "host" theStore
on the parent process and then the children can access thisStore
.The caveats of this are:
MultiStore
cannot inherit fromStore
and cannot be used normally. The StoreFacade provides a way to interact with the MultiStore as if it were an ordinary Store.Note: This might belong in another package, but I thought it was flexible and generic enough that it could be put into maggma.
These are the pull requests for Fireworks and Jobflow
Todo:
MongoStore.safe_update
Contributor Checklist