Reuse#
You can name clusters so that you can share them between Python sessions using the name=
keyword. For example:
import coiled
cluster = coiled.Cluster(
n_workers=100,
name="production",
shutdown_on_close=False,
)
Then any Python session connected to this account can connect to this same cluster using this same command.
This is useful in a few situations:
In interactive Python sessions (like Jupyter notebooks) where users frequently restart a notebook, but want rapid access to the same cluster
In production environments, where a web service (or possibly many replicas of the same service) offload work to the cluster
The first time someone calls coiled.Cluster(name="production")
it will create a new cluster. Subsequent calls will connect to the same cluster.