When we spin up a server for a user, we add persistent storage. (We trust our users, and to keep cost down we occasionally send out emails to clean up.) One user asked for a “Reset” feature, especially for users who are not very comfortable in the terminal.
Ideally, I suppose this would be a button, maybe at /hub/home, but I’m not sure if its possible to implement something like this in a general way.
Unless you want to delete the PV entirely, probably the most sensible place to do this is within the single-user server where the volume is mounted, rather than somewhere in the Hub itself.
The simplest (to implement) version of this is a script/command-line tool or Python function that folks can launch. If you do it as a Python function, then can run it from a notebook.
Then, if you want to make extra friendly UI, you can expose it as a button, etc. via a jupyterlab extension. Or distribute a well-documented notebook that folks can step through.
Thanks @minrk, I definitely would not want to delete the whole PV.
The process you outlined works, though I was hoping for a solution that would not require the user-server to be launched at all. Is there a way to extend jupyterhub admin gui for maintenance tasks?
Not directly, but you could write your own JupyterHub service with it’s own web interface:
You haven’t given many details about your deployment, but in the most general case JupyterHub doesn’t have direct access to the user’s storage. For example, with Kubernetes (which I assume you’re using since you’ve mentioned PVs) JupyterHub manages the creation and mounting of a storage volume to your singleuser pod/container, but it never has access to the contents of the volume, only the singleuser server does. The only way to access the contents of the volume is to mount it somewhere which means spawning a pod- and if you’re going to do that it might as well be the user-server.