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

Client.shutdown claims to close cluster, but doesn't #1085

Closed
mrocklin opened this issue May 17, 2017 · 8 comments
Closed

Client.shutdown claims to close cluster, but doesn't #1085

mrocklin opened this issue May 17, 2017 · 8 comments
Labels
documentation Improve or add to documentation

Comments

@mrocklin
Copy link
Member

Client.shutdown claims in its docstring to tear down the cluster. This isn't currently the case. It only closes its own connection. We can either

  1. Change the docstring
  2. Change the behavior

If we change only the docstring, then should we also add the shutdown functionality to the client?

If we change the behavior then should we also add a close method?

http://stackoverflow.com/questions/44021931/stopping-dask-ssh-created-scheduler-from-the-client-interface

@martindurant
Copy link
Member

I believe there should be a method to tear down the cluster from the client. "shutdown" seems like the best name for this, so I would go for option 2. "close" would be the same thing as what happens on del?

@pitrou
Copy link
Member

pitrou commented May 22, 2017

I believe things would be less confusing if cluster-affecting methods would be named explicitly, such as restart_cluster instead of restart and shutdown_cluster instead of shutdown. If I were to read user code without perusing the docs, I would never guess that Client.restart restarts the cluster, not the client.

Agreed to also have a separate close method that does what shutdown does right now, and have __del__ call it. It's good to allow explicit resource cleanup when an object can keep many resources alive.

@eriknw
Copy link
Member

eriknw commented Aug 3, 2017

I'm in favor of restart_cluster, shutdown_cluster, and close methods. I'll work on a PR.

@GenevieveBuckley
Copy link
Contributor

@eriknw are you still interested in working on this?

@eriknw
Copy link
Member

eriknw commented Oct 18, 2021

Welp. I remember poking around at this, but I can't find my previous work. Oops. I doubt I'll be able to work on this this quarter.

@GenevieveBuckley
Copy link
Contributor

Ok then. This might be a candidate for a good first or second issue, if someone is happy to leave a comment outlining roughly what should be done.

@xsqian
Copy link

xsqian commented Mar 15, 2023

Hi there, any progress on this?

@jrbourbeau
Copy link
Member

There have been some related updates and today client.shutdown() does close the cluster

In [1]: from distributed import Client, LocalCluster

In [2]: cluster = LocalCluster()

In [3]: client = Client(cluster)

In [4]: cluster.status
Out[4]: <Status.running: 'running'>

In [5]: client.shutdown()

In [6]: cluster.status
Out[6]: <Status.closed: 'closed'>

Closing as resolved, though we can reopen as needed

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

No branches or pull requests

7 participants