Skip to content

Instantly share code, notes, and snippets.

@hungyiwu
Created July 29, 2020 16:20
Show Gist options
  • Save hungyiwu/673283cd9611147c9ed146dedcb5aaee to your computer and use it in GitHub Desktop.
Save hungyiwu/673283cd9611147c9ed146dedcb5aaee to your computer and use it in GitHub Desktop.
Reminder for myself on configuring local dask.distributed cluster and URL of corresponding documentations
# setup local cluster for dask
#
# API documentation
# * dask.distributed.worker
# https://distributed.dask.org/en/latest/worker.html#distributed.worker.Worker
# * dask.distributed.LocalCluster
# https://distributed.dask.org/en/latest/api.html#distributed.LocalCluster
# * dask.distributed.Client
# https://distributed.dask.org/en/latest/api.html#distributed.Client
from dask.distributed import LocalCluster, Client
lc = LocalCluster(
processes=True, # use processes instead of threads
n_workers=2, # 1 scheduler, plus this number of worker
threads_per_worker=1, # note: some libraries may use multi-threading
memory_limit="4GB", # memory cap per worker
)
c = Client(lc)
# then just regular dask code and the settings will take effect automatically
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment