-
Notifications
You must be signed in to change notification settings - Fork 230
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
Initialize the global RMGDatabase object upon calling it #1565
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1565 +/- ##
==========================================
+ Coverage 41.84% 41.86% +0.01%
==========================================
Files 165 165
Lines 28008 28007 -1
Branches 5713 5713
==========================================
+ Hits 11721 11726 +5
+ Misses 15498 15493 -5
+ Partials 789 788 -1
Continue to review full report at Codecov.
|
I think this looks good. Do we want the re-initialization message to be debug or warning? Personally, I'm leaning more towards warning since I think users should be aware that it is happening. |
done! |
Looks good to me! |
rmgpy/data/rmg.py
Outdated
logging.warning("Should only make one instance of RMGDatabase because it's stored as a module-level variable!") | ||
logging.warning("Unexpected behaviour may result!") | ||
if database is not None: | ||
logging.warn('An instance of RMGDatabase already exists. Re-initializing it.') |
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.
I think we should use logging.warning
. logging.warn
is just a pointer to logging.warning
, and is now deprecated in Python 3.
even (and especially) if it already exists. This solves cases when using RMG's API where the database doesn't get appropriately updated.
good to know, done |
I can approve that the RMG/ARC feature works as expected when cherry-picking this commit. def clear_rmg_database():
"""Set the RMG database object instance to None"""
rmg_db = getDB()
rmg_db.thermo = None
rmg_db.transport = None
rmg_db.forbiddenStructures = None
rmg_db.kinetics = None
rmg_db.statmech = None
rmg_db.solvation = None was problematic, and in the second iteration RMG comlained about missing components in the database (e.g., can't check forbidden structures since In any case, I'm very happy with the implementation in this PR. |
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.
Thanks! I'll go ahead and merge.
Initialize the global
RMGDatabase
object upon calling it even (and especially) if it already exists.This solves cases when using RMG's API where the database doesn't get appropriately updated.