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

Fail to pickle last frame of DCD, XDR files #2878

Closed
yuxuanzhuang opened this issue Jul 29, 2020 · 1 comment · Fixed by #2723 or #2911
Closed

Fail to pickle last frame of DCD, XDR files #2878

yuxuanzhuang opened this issue Jul 29, 2020 · 1 comment · Fixed by #2723 or #2911
Labels
GSoC GSoC project
Milestone

Comments

@yuxuanzhuang
Copy link
Contributor

Expected behavior

The trajectory can be pickled no matter which frame it is current in.

Actual behavior

XDR and DCD readers cannot pickle the last frame.
Raising the EOFError

Code to reproduce the behavior

u = mda.Universe(GRO_MEMPROT, XTC_MEMPROT)
u.trajectory[4] #  last frame
pickle.loads(pickle.dumps(u.trajectory))
EOFError: Trying to seek over max number of frames

Current version of MDAnalysis

  • Which version are you using? (run python -c "import MDAnalysis as mda; print(mda.__version__)") 2.0.0 dev
  • Which version of Python (python -V)? 3.8
  • Which operating system? Ubuntu 20
@orbeckst
Copy link
Member

@orbeckst orbeckst mentioned this issue Jul 29, 2020
4 tasks
@orbeckst orbeckst added the GSoC GSoC project label Aug 7, 2020
orbeckst pushed a commit that referenced this issue Aug 8, 2020
* Fixes #2878
* basic approach: composition instead of inheritance for pickling Universe (which was
   tested in PR #2704 (which was derived from PR #2140))
* Changes made in this Pull Request:
    - add new classes and pickle_open function to picklable_file_io.py
    - add new picklable `BufferedReader`, `FileIO`, and `TextIOWrapper` classes.
    - implement `__getstate__`, `__setstate__` to `Universe` and `BaseReader`
    - fix DCD, XDR pickle issue
    - modified gsd and ncdf to be picklabel
    - modified ChainReader to be picklabel
    - ensure chemfiles is picklable
* add tests (MultiFrameReader will test for serializability)
* update CHANGELOG
* update docs

Note: This merge squashed 120 commits. See PR #2723 for the full history with 420 comments.
orbeckst pushed a commit that referenced this issue Aug 13, 2020
- fix issue #2878
- add tests to the base tests (but xfail for any format that does not
  implement pickling yet)
@yuxuanzhuang yuxuanzhuang mentioned this issue Aug 15, 2020
4 tasks
orbeckst pushed a commit that referenced this issue Aug 17, 2020
- Fixes #2878
- Changes made in this Pull Request:
    - add more comprehensive tests for pickling low-level dcd and xdr files
    - fix a bug that was introduced in #2723 (wrong seeking in DCD and XDR, note: this bug was only in develop, never in released code, see discussion in PR #2908)
- update CHANGELOG
- maybe backport in #2908
PicoCentauri pushed a commit to PicoCentauri/mdanalysis that referenced this issue Mar 30, 2021
* Fixes MDAnalysis#2878
* basic approach: composition instead of inheritance for pickling Universe (which was
   tested in PR MDAnalysis#2704 (which was derived from PR MDAnalysis#2140))
* Changes made in this Pull Request:
    - add new classes and pickle_open function to picklable_file_io.py
    - add new picklable `BufferedReader`, `FileIO`, and `TextIOWrapper` classes.
    - implement `__getstate__`, `__setstate__` to `Universe` and `BaseReader`
    - fix DCD, XDR pickle issue
    - modified gsd and ncdf to be picklabel
    - modified ChainReader to be picklabel
    - ensure chemfiles is picklable
* add tests (MultiFrameReader will test for serializability)
* update CHANGELOG
* update docs

Note: This merge squashed 120 commits. See PR MDAnalysis#2723 for the full history with 420 comments.
PicoCentauri pushed a commit to PicoCentauri/mdanalysis that referenced this issue Mar 30, 2021
- Fixes MDAnalysis#2878
- Changes made in this Pull Request:
    - add more comprehensive tests for pickling low-level dcd and xdr files
    - fix a bug that was introduced in MDAnalysis#2723 (wrong seeking in DCD and XDR, note: this bug was only in develop, never in released code, see discussion in PR MDAnalysis#2908)
- update CHANGELOG
- maybe backport in MDAnalysis#2908
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoC GSoC project
Projects
None yet
2 participants