Expected behavior
Passing nprocs > 1, should call the multiprocessing portion of HydrogenBondLifetimes and return normally.
Actual behavior
The code fails with an import error for sys:
ts= 1
ts= 2
/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/site-packages/MDAnalysis/analysis/base.py:116: DeprecationWarning: Setting the following kwargs should be done in the run() method: start, stop
DeprecationWarning)
/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/site-packages/MDAnalysis/analysis/base.py:116: DeprecationWarning: Setting the following kwargs should be done in the run() method: start, stop
DeprecationWarning)
/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/site-packages/MDAnalysis/analysis/hbonds/hbond_analysis.py:650: SelectionWarning: No acceptors found in selection 2. You might have to specify a custom 'acceptors' keyword. Selection will update so continuing with fingers crossed.
warnings.warn(errmsg, category=SelectionWarning)
/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/site-packages/MDAnalysis/analysis/hbonds/hbond_analysis.py:650: SelectionWarning: No donors found in selection 2. You might have to specify a custom 'donors' keyword. Selection will update so continuing with fingers crossed.
warnings.warn(errmsg, category=SelectionWarning)
error
trying again
Process Process-1:
/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/site-packages/MDAnalysis/analysis/hbonds/hbond_analysis.py:650: SelectionWarning: No acceptors found in selection 2. You might have to specify a custom 'acceptors' keyword. Selection will update so continuing with fingers crossed.
warnings.warn(errmsg, category=SelectionWarning)
/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/site-packages/MDAnalysis/analysis/hbonds/hbond_analysis.py:650: SelectionWarning: No donors found in selection 2. You might have to specify a custom 'donors' keyword. Selection will update so continuing with fingers crossed.
warnings.warn(errmsg, category=SelectionWarning)
Process Process-2:
Traceback (most recent call last):
File "/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/site-packages/MDAnalysis/analysis/waterdynamics.py", line 659, in _HBA
sys.stdout.flush()
NameError: name 'sys' is not defined
Traceback (most recent call last):
File "/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/site-packages/MDAnalysis/analysis/waterdynamics.py", line 653, in _HBA
h.run(verbose=verbose)
File "/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/site-packages/MDAnalysis/analysis/hbonds/hbond_analysis.py", line 936, in run
verbose=kwargs.get('verbose', False))
File "/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/site-packages/MDAnalysis/lib/log.py", line 350, in __init__
assert numsteps > 0, "numsteps step must be >0"
AssertionError: numsteps step must be >0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/biggin/b131/bioc1523/software/anaconda/python3.6/2019.7/envs/all/lib/python3.7/site-packages/MDAnalysis/analysis/waterdynamics.py", line 658, in _HBA
sys.stdout.flush()
NameError: name 'sys' is not defined
Fixing the code to import sys leads to an infinite loop due to a repeated attempt to re-excute the failing code block:
|
while True: |
|
try: |
|
h.run(verbose=verbose) |
|
break |
|
except: |
|
print("error") |
|
print("trying again") |
|
sys.stdout.flush() |
|
sys.stdout.flush() |
|
conn.send(h.timeseries[0]) |
|
conn.close() |
Some extra comments
So I went back through the git history, and the removal of sys occured in the very first PR #300.
It is therefore not clear to me that this code has ever worked. That being said, it is very much possible that I'm not calling this in the right manner.
Code to reproduce the behavior
import MDAnalysis as mda
from MDAnalysis.tests.datafiles import waterPSF, waterDCD
from MDAnalysis.analysis import waterdynamics
SELECTION1 = "byres name OH2"
SELECTION2 = "byres name P1"
universe = mda.Universe(waterPSF, waterDCD)
# Calling this without nproc works and is covered by tests
hbl = waterdynamics.HydrogenBondLifetimes(universe, SELECTION1, SELECTION2, 0, 10, 2, nproc=2)
hbl.run()
Currently version of MDAnalysis
- Which version are you using? (run
python -c "import MDAnalysis as mda; print(mda.__version__)") 0.20.1 (tested on latest develop too)
- Which version of Python (
python -V)? 3.7.3
- Which operating system? Ubuntu 18.04.3 LTS
Expected behavior
Passing nprocs > 1, should call the multiprocessing portion of HydrogenBondLifetimes and return normally.
Actual behavior
The code fails with an import error for sys:
Fixing the code to import sys leads to an infinite loop due to a repeated attempt to re-excute the failing code block:
mdanalysis/package/MDAnalysis/analysis/waterdynamics.py
Lines 651 to 661 in 0dede25
Some extra comments
So I went back through the git history, and the removal of sys occured in the very first PR #300.
It is therefore not clear to me that this code has ever worked. That being said, it is very much possible that I'm not calling this in the right manner.
Code to reproduce the behavior
Currently version of MDAnalysis
python -c "import MDAnalysis as mda; print(mda.__version__)") 0.20.1 (tested on latest develop too)python -V)? 3.7.3