Open orbeckst opened 6 years ago
The problem is that ParallelAnalysisBase._dask_helper()
needs to be pickled by dask. But it is a bound method of ParallelAnalysisBase
so that method (or rather, the class that was derived from it, e.g. RMSD
) also needs to be pickled. If this class contains anything that cannot be pickled, the whole pickle fails. In particular, there is ParallelAnalysisBase._trajectory
, which contains the Reader from the universe (not the universe itself, which is currently no picklable). Almost all readers are picklable, except the ChainReader, because it contains a Generator:
_ChainReader__chained_trajectories_iter': <generator object ChainReader._chained_iterator at 0x7f1c19716468>
Ideally, pickling _dask_helper()
would not need to pickle the enclosing class. However, a short term fix should be to make the ChainReader picklable.
ChainReader should work once PR https://github.com/MDAnalysis/mdanalysis/pull/2723 is merged.
Expected behaviour
pmda can deal with any universe/trajectory that can be built with MDAnalysis
Actual behaviour
Fails with TypeError "TypeError: can't pickle generator objects" (see Stack trace below) when the universe.trajectory is a ChainReader
Code to reproduce the behaviour
Currently version of MDAnalysis:
(run
python -c "import MDAnalysis as mda; print(mda.__version__)"
) (runpython -c "import pmda; print(pmda.__version__)"
) (runpython -c "import dask; print(dask.__version__)"
)Stack trace