jupyterhub icon indicating copy to clipboard operation
jupyterhub copied to clipboard

Deleting a spawning server

Open lorenzo-cavazzi opened this issue 4 years ago • 1 comments

When I try to delete a named server invoking the DELETE /users/<username>/servers/<servername> API, I get this response if the server is spawning

{"status": 400, "message": "lorenzo.cavazzi.tech:flights-tutorial-1e75e55c is pending spawn, please wait"}

This is fine, but there are specific cases when I do really want to delete the server even if it's spawning, usually because it's stuck somewhere or it's taking longer than expected, but I don't need to wait start_timeout minutes (in our case, that value is quite high). Is there a way to force that?

I have tried to manually remove the pods from Kubernetes, that works but there are a few side effects, like not being able to spawn the same server until cull_idle kick in, which still requires a few minutes according to the start_timeout value.

lorenzo-cavazzi avatar Mar 09 '20 10:03 lorenzo-cavazzi

After digging a bit into the code, I believe it's not currently possible to "force stop" a spawning server. Here are the relevant lines https://github.com/jupyterhub/jupyterhub/blob/1bdc66c75b786c11fb24c13eb281a0dd61fa0a92/jupyterhub/apihandlers/users.py#L443-L457

Would it make sense to allow using any kind of force variable from the API call to bypass raising the error on spawner.pending?

lorenzo-cavazzi avatar Mar 09 '20 10:03 lorenzo-cavazzi