Is there a way to get a list of all running notebooks (ideally a jupyterhub service I could just install, like the idle_culler)? I’d like to periodically poll and log all notebook names for all users. I first started to figure out how to create an api token and use the jupyterhub api to do that, but I thought there might be a jupyterhub service already written that does this.
I’m not aware of anything. If you find something, or if you write your own service, please share it here for others to use!
Thanks, just wanted to check I wasn’t reinventing the wheel. I’ll see what I can come up with.
Since this info only comes from the Jupyter Server API, in JupyterHub 2.0, you’ll need to grant the service the
access:servers scope to be able to make requests to the server API. Jupyter Server requests can use the same authentication as the Hub.
Here’s a quick script illustrating some of the requests you’ll want to make. Mainly it’s the GET
/:server_url/api/sessions, which returns the open documents and info about their state.
Thanks! I tried for a while, but I was calling sessions on the hub, instead of the proxy. That fixed it! I wasn’t using async either, which will help the performance.