Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detach from running cluster #186

Closed
jacobtomlinson opened this issue Oct 14, 2019 · 4 comments
Closed

Detach from running cluster #186

jacobtomlinson opened this issue Oct 14, 2019 · 4 comments

Comments

@jacobtomlinson
Copy link
Member

The current behaviour of dask-kubernetes is to create ephemeral clusters and use them to perform calculation. There is a bunch of logic here to clean up the cluster when the Python object is removed.

This may not always be the desired use case and we may want to support detaching from a cluster. This also fits with #185 where we may want to attach to an already running cluster.

@mrocklin
Copy link
Member

mrocklin commented Oct 14, 2019 via email

@jcrist
Copy link
Member

jcrist commented Oct 14, 2019

We use the keyword shutdown_on_close in dask-gateway (defaults to True, except when connecting to a running cluster then the default is False). Typically a cluster object has a few things you'd want to cleanup:

  • Remote cluster resources (e.g. kubernetes pods)
  • Local async things (event loop, background tasks, comms, etc...)

The .close() method is always called on GC of an object, but the meaning of .close() differs based on the value of shutdown_on_close for the cluster.

# On .close()/GC of cluster object, remote cluster is cleaned up
cluster = GatewayCluster()
cluster.close()

# On .close()/GC of cluster object, only local resources are cleaned up
cluster = GatewayCluster(shutdown_on_close=False)
cluster.close()

# You can override this behavior by passing `shutdown=True` to close
# or using the `shutdown()` method which is an alias to this
cluster.close(shutdown=True)
cluster.shutdown()

# When connecting to a previously started cluster, the default for
# shutdown_on_close is False
cluster = GatewayCluster.from_name(cluster_name)

This option only makes sense if the scheduler is remote (which is always true for dask-gateway).

@jacobtomlinson
Copy link
Member Author

Thanks @jcrist this is the kind of thing I want to implement here. Now that we have the option of creating remote schedulers it would be good to implement this functionality.

@jacobtomlinson
Copy link
Member Author

I'm going to close this out as being closely related to #185.

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

No branches or pull requests

3 participants