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

update to dask 0.18.0 #66

Merged
merged 11 commits into from
Nov 1, 2018
10 changes: 5 additions & 5 deletions pmda/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from six.moves import range

import MDAnalysis as mda
from dask import distributed, multiprocessing
from dask import distributed
from dask.delayed import delayed
from joblib import cpu_count
import numpy as np
Expand Down Expand Up @@ -291,13 +291,13 @@ def run(self,

"""
if scheduler is None:
scheduler = multiprocessing
scheduler = 'multiprocessing'

if n_jobs == -1:
n_jobs = cpu_count()

if n_blocks is None:
if scheduler == multiprocessing:
if scheduler == 'multiprocessing':
n_blocks = n_jobs
elif isinstance(scheduler, distributed.Client):
n_blocks = len(scheduler.ncores())
Expand All @@ -306,8 +306,8 @@ def run(self,
"Couldn't guess ideal number of blocks from scheduler."
"Please provide `n_blocks` in call to method.")

scheduler_kwargs = {'get': scheduler.get}
if scheduler == multiprocessing:
scheduler_kwargs = {'scheduler': scheduler}
if scheduler == 'multiprocessing':
scheduler_kwargs['num_workers'] = n_jobs

start, stop, step = self._trajectory.check_slice_indices(
Expand Down
4 changes: 2 additions & 2 deletions pmda/test/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from MDAnalysisTests.datafiles import DCD, PSF
import joblib

from dask import distributed, multiprocessing
from dask import distributed

from pmda import parallel

Expand Down Expand Up @@ -95,7 +95,7 @@ def scheduler(request, client):
if request.param == 'distributed':
return client
else:
return multiprocessing
return request.param
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool: so now we will be able to expand to all schedulers that dask supports by just adding strings to the fixture parametrization.



def test_scheduler(analysis, scheduler):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
packages=find_packages(),
install_requires=[
'MDAnalysis>=0.18',
'dask',
'dask>=0.18',
'six',
'joblib', # cpu_count func currently
],
Expand Down