Skip to content

Commit 04811f4

Browse files
authored
Merge pull request #668 from minrk/nthreads
dask: ncores was renamed to nthreads in 2.0
2 parents 675c991 + c4cfbe5 commit 04811f4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ipyparallel/client/client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,7 +1838,7 @@ def become_dask(
18381838
scheduler_args : dict
18391839
Keyword arguments (e.g. ip) to pass to the distributed.Scheduler constructor.
18401840
**worker_args
1841-
Any additional keyword arguments (e.g. ncores) are passed to the distributed.Worker constructor.
1841+
Any additional keyword arguments (e.g. nthreads) are passed to the distributed.Worker constructor.
18421842
18431843
Returns
18441844
-------
@@ -1867,8 +1867,13 @@ def become_dask(
18671867
# Start a Worker on the selected engines:
18681868
worker_args['address'] = distributed_info['address']
18691869
worker_args['nanny'] = nanny
1870-
# set default ncores=1, since that's how an IPython cluster is typically set up.
1871-
worker_args.setdefault('ncores', 1)
1870+
# distributed 2.0 renamed ncores to nthreads
1871+
if int(distributed.__version__.partition(".")[0]) >= 2:
1872+
nthreads = "nthreads"
1873+
else:
1874+
nthreads = "ncores"
1875+
# set default nthreads=1, since that's how an IPython cluster is typically set up.
1876+
worker_args.setdefault(nthreads, 1)
18721877
dview.apply_sync(util.become_dask_worker, **worker_args)
18731878

18741879
# Finally, return a Client connected to the Scheduler

0 commit comments

Comments
 (0)