jupyter-resource-usage icon indicating copy to clipboard operation
jupyter-resource-usage copied to clipboard

enhancement: Track disk utilization in $HOME

Open holzman opened this issue 2 years ago • 8 comments
trafficstars

We extended j-r-u for monitoring disk usage in $HOME for our service. Looks like at least one other person was interested in something similar: https://github.com/jupyter-server/jupyter-resource-usage/issues/186

holzman avatar Jun 02 '23 19:06 holzman

Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly. welcome You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

welcome[bot] avatar Jun 02 '23 19:06 welcome[bot]

#186 suggests to only show something when usage is high. I would tend to agree that this is a nice feature but it might be important not to overwhelm user with information unless they opt-in (there is only so much space on the status bar).

krassowski avatar Aug 11 '23 21:08 krassowski

Well, my take on it is that we should use that space for tracking the resource trinity (CPU, memory, disk) regardless of if their relative values. Should I change this to include an option to enable/disable this?

holzman avatar Aug 15 '23 21:08 holzman

Ok, I added a configuration boolean, but this will only patch cleanly to 0.7.2. If the approach LGTY, I'll update it for the changes in 1.0.

holzman avatar Aug 23 '23 21:08 holzman

Unfortunately this doesn't work when $HOME is not its own volume.

This is because I think the output being reported is df -h, while what we actually need here is du -d1 -h $HOME. Unfortunately the latter takes a lot of time to run, as it has to go through each file. This makes it a fairly expensive operation.

So I agree displaying $HOME usage would be incredibly helpful - unfortunately I don't think what we have here works on most hosted systems.

Hi @yuvipanda,

Good point. I agree that du is a non-starter. Best practice for providing home areas over NFS is to make sure they're quotaed -- so what do you think of me changing the code to reporting usage/limit according to quota instead, and falling back to df if the space isn't quotaed?

I think this captures the key use case, which is to give users a heads-up if they're going to run out of room.

holzman avatar Aug 28 '23 18:08 holzman

@holzman does quota work on NFS? I had thought it does not. Also on everything other than XFS, it only supports it based on per-userid, rather than per-directory, right?

yuvipanda avatar Aug 28 '23 20:08 yuvipanda

I can assert that psutil does work on nfs mounts [at least, on volume mounts in docker images, which are quota'd NFS directories] - reporting the quota'd capacity.

I am replicating [duplicating?] this work at https://github.com/perllaghu/jupyter-resource-usage [it looks surprisingly similar :) ]

It works fine, but I have a few details I want to clarify before I can offer it

perllaghu avatar Mar 15 '24 11:03 perllaghu

Sorry to drop this - got busy and we've just been running a forked j-r-u with this patch.

As far as NFS, @yuvipanda reported different results for his hub with NFS.

How about we just add appropriate docs/warnings to the config boolean?

holzman avatar Mar 15 '24 14:03 holzman

Closing this since #233 is now merged (thanks @iandesj and @perllaghu!)

holzman avatar Jul 31 '24 15:07 holzman