-
Notifications
You must be signed in to change notification settings - Fork 110
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
Make custodian threadsafe (explicit file paths) #317
Conversation
Thank you very much for this PR! I genuinely think this is a very important one to address, and I would be happy to help get this over the finish line. Some things to do:
Note: Addresses #316 for VASP. |
Nice. I agree it is needed. Never realized that the relative paths are non-threadsafe. |
@shyuep It's not obvious to me how to update _mod_input in the nwchem handlers. I don't see it actually used/referenced anywhere; can this be removed? https://github.com/materialsproject/custodian/blob/master/custodian/nwchem/handlers.py#L42 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #317 +/- ##
==========================================
+ Coverage 62.67% 62.78% +0.11%
==========================================
Files 35 35
Lines 3003 3018 +15
==========================================
+ Hits 1882 1895 +13
- Misses 1121 1123 +2 ☔ View full report in Codecov by Sentry. |
@zulissimeta Pls go ahead and delete it. If the tests pass, I have no problem. My philosophy is - if the original author didn't bother to write tests to guarantee a functionality, no one else has a responsibility to ensure that it sticks around. Also, feel free to just focus on the classes that you actually use (e.g., vasp). There is no need to concern yourself with making other components threadsafe (e.g., nwchem or qchem) unless you are using them or are inclined to do it. |
Thanks for all the work! |
Thanks @shyuep - you might want to leave this open for a little bit; I think @Andrew-S-Rosen was going to take a pass and add some simple tests for the directory functionality. |
Thanks @shyuep and @zulissimeta! I'll open a follow-up PR for additional tests and any fixes. |
Custodian is great, but the expectation is that it's running in its own process and the current working directory is used everywhere. Most file IO is hard-coded to either "./", os.getcwd(), or just implicitly assumes one of those. This could be a problem if multiple threads (say in a workflow) were running custodian jobs, since all threads share the same cwd.
This PR is a first stab at making paths explicitly everywhere so the process cwd is never used implicitly or explicitly. Only the VASP paths have been updated so far.