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

Make Universe store its kwargs for better persistence support #292

Closed
dotsdl opened this issue May 29, 2015 · 5 comments
Closed

Make Universe store its kwargs for better persistence support #292

dotsdl opened this issue May 29, 2015 · 5 comments

Comments

@dotsdl
Copy link
Member

dotsdl commented May 29, 2015

As discussed in datreant/MDSynthesis#25, it would be useful for a Universe to hold on to its init kwargs so that these can be used by (semi-) persistence schemes to regenerate universes from its inputs. This could be as simple as storing the kwargs with

self._kwargs = kwargs.copy()

in the Universe init.

@dotsdl dotsdl self-assigned this May 29, 2015
@orbeckst
Copy link
Member

There are some caveats, though:

  • The topology and trajectory formats can also take classes as "format" and these can essentially be arbitrary code (as long as it conforms to the topology and trajectory API).
  • Many readers can also take streams (or rather, NamedStream) instead of filenames.

Perhaps something to be aware of, or do some scrubbing of self._kwargs() or try to store it as an in-memory pickle using cStringIO.

@dotsdl
Copy link
Member Author

dotsdl commented May 29, 2015

Hmmm...that does complicate things. Not to make this specific to how MDSynthesis is handling the persistence problem, but would storing the kwargs address all cases in which the topology and trajectory(s) live physically in the filesystem? Meaning, for universes generated from files, will storing the kwargs be enough to generate the same universe again (excluding modifications post-init)? The streamio is great, but I don't see how it can be used within the MDSynthesis persistence model.

@orbeckst
Copy link
Member

On 29 May, 2015, at 12:13, David Dotson wrote:

The streamio is great, but I don't see how it can be used within the MDSynthesis persistence model.

Perhaps it can't but then you need to reject certain inputs right away.

kain88-de pushed a commit that referenced this issue Apr 6, 2016
* A Universe now holds onto its initialization kwargs.
(Fixes #292)
This is useful for external libraries, such as MDSynthesis
(https://github.com/datreant/MDSynthesis), to re-initialize a Universe
from its arguments.

* Added tests for Universe keeping a copy of its init kwargs.

Basic test that it holds on to these as we'd expect in
test_atomgroup.TestUniverse. Another test that these work as expected in
guess_bonds tests.

* Test equality of full kwargs dict

* Exposed Universe kwargs with read-only property

* Updated changelog with Universe kwargs exposure

* guess_bounds -> guess_bonds

* Made test for universe kwargs staticmethod since we don't use self

* Removed `self` from staticmethod test.
@kain88-de
Copy link
Member

This has been reversed due to the topology refactor. We need to fix it again. I noticed because mdsynthesis tests are failing

@kain88-de kain88-de reopened this Nov 7, 2016
@kain88-de
Copy link
Member

OK this is entirely in MDSynthesis because some tests expected that the public kwargs are readonly and that there is a private _kwargs

@kain88-de kain88-de mentioned this issue Nov 7, 2016
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants