Skip to content

enhancement: Track disk utilization in $HOME #194

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

Closed
wants to merge 1 commit into from

Conversation

holzman
Copy link

@holzman holzman commented Jun 2, 2023

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: #186

@welcome
Copy link

welcome bot commented Jun 2, 2023

Thanks for submitting your first pull request! You are awesome! 🤗

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! 👋

Welcome to the Jupyter community! 🎉

@holzman holzman changed the title Track disk utilization in $HOME enhancement: Track disk utilization in $HOME Jun 2, 2023
@krassowski
Copy link
Collaborator

#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).

@holzman
Copy link
Author

holzman commented Aug 15, 2023

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
Copy link
Author

holzman commented Aug 23, 2023

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 holzman force-pushed the disk-usage branch 2 times, most recently from cb5ede1 to da64593 Compare August 24, 2023 18:44
Similar to memory usage tracking, polls the disk used/available
in $HOME.
Copy link
Collaborator

@yuvipanda yuvipanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

If I test this on a hub that mounts NFS for $HOME directory:

>>> python -c 'import os; import psutil; print(psutil.disk_usage(os.getenv("HOME")))'
sdiskusage(total=9223372036853727232, used=2028294111232, free=9223370008559616000, percent=0.0)

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.

@holzman
Copy link
Author

holzman commented Aug 28, 2023

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.

@yuvipanda
Copy link
Collaborator

@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?

@perllaghu
Copy link
Contributor

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

@holzman
Copy link
Author

holzman commented Mar 15, 2024

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
Copy link
Author

holzman commented Jul 31, 2024

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

@holzman holzman closed this Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants