Skip to content

Conversation

@jacobtomlinson
Copy link
Member

@jacobtomlinson jacobtomlinson commented Mar 18, 2021

Adds a discovery method for KubeCluster objects and also the from_name method required to reconstruct a KubeCluster object.

This PR works by serializing the KubeCluster object into a Kubernetes Secret resource, allowing it to be recreated at a later time.

This may not be an ideal approach, but opening this anyway as a reference.

from dask_kubernetes import KubeCluster

pod_spec = {...}  # Minimal pod spec omitted

cluster = KubeCluster(pod_spec, shutdown_on_close=True)  # Don't destroy the cluster if we destroy the object
cluster.scale(5)

del cluster
$ daskctl cluster list
NAME                        ADDRESS                TYPE         WORKERS  THREADS  MEMORY   CREATED   STATUS
dask-jtomlinson-bffca7fc-7  tcp://localhost:65125  KubeCluster        5        5  5.20 GB  Just now  Running
from dask_ctl import get_cluster

cluster = get_cluster("dask-jtomlinson-bffca7fc-7")

# Use cluster for Dask work

cluster.close()

Note the address is localhost as I used port forwarding in my config. This port will randomly change every time we run get_cluster (which is used within daskctl). For clusters using a LoadBalancer or NodePort this address will be consistent.

Depends on dask/distributed#4605

@jacobtomlinson
Copy link
Member Author

Hopefully this can be replaced with something based on dask/distributed#5033 which would enable use of the scheduler as the key/value store instead of a secret.

@jacobtomlinson
Copy link
Member Author

Closing in favour of #468

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant