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
Load tools automatically #69
Conversation
- added logging at debug for the env setting (although not clear how to enable the logger at this stage unless it is started from another script which already has a gromacs logger running) - added entry to CHANGES
- checks for set_gmxrc_environment() moved inside function; Moved checking of input set_gmxrc_environment() into the function itself so that we can just safely call it from __init__ without further crud. (Also, the try/except OSError in __init__ for set_gmxrc_environment() would have never triggered because we were already catching it inside.) - use cfg.getpath() to get GMXRC from cfg file instead of cfg.get() - Added docs.
Conflicts: CHANGES
How can the following code of # concatenate all index files
make_ndx = Make_ndx(f=kwargs.get('s'), n=ndx)
rc,out,err = make_ndx(o=self.multi_ndx, input=['q'], stdout=False, stderr=False) Probably worked in some previous version. So can I assume that is safe to remove |
a0b0e51
to
9ec9e21
Compare
Sorry, I was wrong. Of course it works! |
df30326
to
8370ec7
Compare
Please look this PR! Of course it will not be accepted as is, it just has some ideas that may be useful. For example I apologize if my issues and commits seems disorganized because git just don't fit in my head! My local repo is messy and I do a lot of funny stuff to push a commit. |
@@ -94,175 +71,202 @@ def _generate_sphinx_class_string(clsname): | |||
'mdrun': 'mdrun', | |||
'make_ndx': 'make_ndx', | |||
'make_edi': 'make_edi', | |||
'gmxdump': 'gmxdump', | |||
'gmxcheck': 'gmxcheck', | |||
'dump': 'gmxdump', |
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.
This looks like a separate fix. Could you please make it a separate 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.
Done #71!
HI @pslacerda , can you please rebase to develop? During the 0.5.1 release #70 I had to rewrite the history of develop. I haven't had time to do a full review of your PR (and I also want to see what is really new compared to develop). I like that you created more functions. Ping me when you're done, sorry, a bit busy at the moment! |
Conflicts: CHANGES gromacs/__init__.py gromacs/config.py gromacs/tools.py
Of all that code seems that |
Now it has more adherence to the project's programming style. The |
load_tools.extend(cfg.getlist('Gromacs', g)) | ||
del g | ||
|
||
def get_tools(): |
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.
Good idea to make it a function.
ping @orbeckst, |
What do you think about my previous suggestion of a mdp file dynamic repository. When the user know what he is doing is more a matter of join together mdp options and adjust parameters. Maybe we can help people at doing this. Molecular dynamics for noobs and repository for the rest, along with previously made GromacsWrapper programs we can seriously help to popularize molecular simulations. |
Also the commits of this PR needs to be combined into one so don't mess with the repository history. And the patch-0.5.1 branch can already be deleted as was already merged into develop. I'm not very skilled at git and github but seems relatively important things to do. Following this PR I have some patches for core.py like this one, would be my last major patch at hand. I also propose move the plugins into a separated repository, will be cleaner and make easier to move just the main code to Python 3, for example. |
Yes, seems that we're almost there with this PR! |
Probably also remove or update the branch gh-pages |
@pslacerda – sorry for the delay... working on some other urgent stuff. Please ping again if nothing happened by Wednesday. |
@pslacerda , quick comments while I have 5 minutes to spare:
Regarding this PR: I can do some rebasing and history massaging. I just need to test locally. I'll also look at the docs... in fact, I will probably get rid of the gh-pages branch, given that rtd http://gromacswrapper.readthedocs.io/ works for us – I opened #80. |
Sorry @pslacerda – still not managed to try it. Busy with urgent stuff. Next week should be better. |
With the new changes, one cannot install Gromacswrapper if Gromacs has not been sourced. See the output on travis job #102.1 and
If I source However, we need to be able to install without Gromacs present. |
…acsWrapper into automatic-tool-loading
I didn't had this problem here but now the setup.py doesn't import the whole package before install it, just import the version file. |
I'm not understanding the errors on #103.1 as they doesn't happen here when running |
- make sure that MAJOR_RELEASE is empty if there is no cfg file - make sure that no tools are defined by default (otherwise autoloading will not look for more tools) - added debug logging to tool loading (activate with GW_START_LOGGING=true, see previous commit) - cbook: catch failed tool loading with AttributeError, too I think we can soon remove the template config file.
Sorry @pslacerda , this took forever. I ironed out a few bugs related to Gromacs v4 loading but seems to be good now. Merging now.... |
regarding errors on travis: not sure, @ianmkenney is working on tests for MDPOW and anything that he finds/cooks up will also be applicable to GW. You can always raise an issue for tests that don't behave. I think there's already #61 (and #47). |
cmdargs = ['bash', '-c', ". {0} && echo {1}".format(gmxrc, | ||
' '.join(['${0}'.format(v) for v in envvars]))] | ||
' '.join(['___${{{0}}}___'.format(v) for v in envvars]))] |
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.
If a env var such as GMXPREFIX
or GROMACS_DIR
is not defined then it produces an empty value. Empty values are not picked up when the output is parsed and lead to wrong assignments of values to env vars. That was a problem with Gromacs 4.
Moving unknown env vars to the end would have been sufficient but using "Sentinel" markers around will ensure that even an empty result is picked up because it produces ___'___
(the ' should not be there but indicates where "nothing" is). The line below then removes the sentinels. Cludgy but fairly safe.
(Of course, everything just breaks if the env var values contain spaces as in GMXBIN=/Users/joe/Stuff for work/gromacs
...)
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.
Btw, it might be better to put the values on new lines and then split on those:
cmdargs = ['bash', '-c', ". {0} && echo {1}".format(gmxrc,
'\n'.join(['${{{0}}}'.format(v) for v in envvars]))]
...
out = out.split('\n')
for key, value in zip(envvars, out):
value = value.strip()
os.environ[key] = value
This will work even for subsequent empty lines:
>>> out = "\n".join(["line 1", "line 2", "", "line 4", "", "", "line_5", ""])
>>> out.split("\n")
['line 1', 'line 2', '', 'line 4', '', '', 'line_5', '']
I got it! |
So lets put more |
NULL string ( Just fix develop, test it locally, and then commit to develop. |
Proposal for tool loading as in issue #68. Awaiting for opinions or changes proposals.
Even if almost complete it remains largely untested (eg.
extra
andgroups
).