Clusters and clients
Depending on your computer hardware and the calculation you are trying to complete, it may be faster to run it using a mixture of threads and processes. To do this, you need to set up a local cluster.
There are two ways to set up a local cluster that Dask will use. The first way is to create the local cluster and pass it to a client. This is very similar to how you would set up a client to run across a cluster of computers! The second way is to use the client directly and allow it to create the local cluster itself. This is a shortcut that works for local clusters, but not for the other types of cluster.
In this exercise, you will create clients using both methods.
Be careful when creating the cluster and clients. If you configure them incorrectly, your session may time out.
This exercise is part of the course
Parallel Programming with Dask in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import Client and LocalCluster
from ____ import ____, ____
# Create a thread-based local cluster
cluster = LocalCluster(
processes=____,
n_workers=____,
threads_per_worker=____,
)
# Create a client
client = ____