Skip to content
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

Add disk stat functions #42248

Merged
merged 18 commits into from
Oct 30, 2021
Merged

Add disk stat functions #42248

merged 18 commits into from
Oct 30, 2021

Conversation

li1
Copy link
Contributor

@li1 li1 commented Sep 14, 2021

This PR exposes the uv_fs_statfs() libuv 1.31 function to obtain available, used, and total disk.

It closes #37038.

base/file.jl Outdated Show resolved Hide resolved
base/file.jl Outdated Show resolved Hide resolved
Copy link
Member

@NHDaly NHDaly left a comment

Choose a reason for hiding this comment

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

Cool, lgtm other than the requests in my comments! :) Thanks for the PR

test/file.jl Outdated Show resolved Hide resolved
base/file.jl Outdated Show resolved Hide resolved
base/file.jl Outdated Show resolved Hide resolved
@li1
Copy link
Contributor Author

li1 commented Sep 15, 2021

Should I also export the DiskStats and StatFS structs in exports.jl?

base/file.jl Outdated Show resolved Hide resolved
@fredrikekre
Copy link
Member

An alternative interface could be to have a single function, e.g. diskstat, that returns a struct with documented fields, just like the stat function does for files already.

@Sacha0
Copy link
Member

Sacha0 commented Sep 16, 2021

(Requested re-review from Fredrik regarding the interface changes, i.e. addition of diskstat alongside the disk_ functions, where I think his intent might've been to supplant the disk_ functions with the single diskstat export. To be clear, I have no opinion :).)

base/exports.jl Outdated Show resolved Hide resolved
@li1
Copy link
Contributor Author

li1 commented Sep 25, 2021

Sorry it took me so long to get back to this, PTAL!

@li1
Copy link
Contributor Author

li1 commented Sep 25, 2021

Not sure what the remaining test failures are about, any help would be much appreciated!

@Sacha0
Copy link
Member

Sacha0 commented Sep 26, 2021

From a brief look at some of the failure logs and associated buildbot histories, at least some of the failures appear likely to be unrelated (noting strings of failures on corresponding buildbots having started before the most recent builds associated with this pull request).

@Sacha0
Copy link
Member

Sacha0 commented Sep 26, 2021

To confirm, there appear to be ongoing CI issues; hopefully those will be resolved in the not too distant future, then this pull request can be rebased, and we can have another look :).

@Sacha0
Copy link
Member

Sacha0 commented Sep 27, 2021

I am not certain whether the unrelated failures that show up in some of these logs have been resolved, but folks have been working on them and most recent builds appear to be passing. Perhaps rebase / clean up the history a bit and push to get another snapshot? :)

Copy link
Sponsor Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

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

A few fixes and suggestions for you. Looks pretty good so far. The CI failures look mostly familiar from some issues last week.

base/file.jl Outdated Show resolved Hide resolved
base/file.jl Outdated Show resolved Hide resolved
base/file.jl Outdated Show resolved Hide resolved
base/file.jl Outdated Show resolved Hide resolved
base/file.jl Outdated Show resolved Hide resolved
base/file.jl Outdated Show resolved Hide resolved
test/file.jl Outdated Show resolved Hide resolved
@vtjnash vtjnash added the forget me not PRs that one wants to make sure aren't forgotten label Sep 29, 2021
base/file.jl Outdated Show resolved Hide resolved
base/file.jl Outdated Show resolved Hide resolved
@li1
Copy link
Contributor Author

li1 commented Oct 26, 2021

Sorry again for the slow progress on this PR — I've removed StatFS and instead specialized getproperty. I'm not completely happy with the Base.show overload yet — it seems a little brittle. Also e.g.

x = diskstat()
?x

won't print out the "virtual" fields total, available, used, but I don't really want to copy over the summarize code from docview.jl just to inject those fields. Maybe there's a more elegant Julian way that I'm missing?

base/file.jl Show resolved Hide resolved
base/file.jl Outdated Show resolved Hide resolved
base/file.jl Outdated Show resolved Hide resolved
Copy link
Sponsor Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

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

Can you add a line to the NEWS.md file and another line to the doc/src/base/file.md file? The rest LGTM!

test/file.jl Outdated Show resolved Hide resolved
@li1
Copy link
Contributor Author

li1 commented Oct 29, 2021

Thanks again for all the reviews, much appreciated! Added your feedback and updated the docs + NEWS.

test/file.jl Outdated Show resolved Hide resolved
base/file.jl Outdated Show resolved Hide resolved
test/file.jl Outdated Show resolved Hide resolved
@vtjnash vtjnash added filesystem Underlying file system and functions that use it merge me PR is reviewed. Merge when all tests are passing and removed needs news A NEWS entry is required for this change forget me not PRs that one wants to make sure aren't forgotten labels Oct 29, 2021
@vtjnash
Copy link
Sponsor Member

vtjnash commented Oct 29, 2021

Thanks so much for sticking with this PR. I've put the merge-me tag on, so that we either merge it soon, or there is one last chance for anyone to comment.

@NHDaly
Copy link
Member

NHDaly commented Oct 30, 2021

++ not bad for a first contribution! :) Thanks for the PR!

@fredrikekre fredrikekre merged commit 4a12d1e into JuliaLang:master Oct 30, 2021
@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Oct 31, 2021
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filesystem Underlying file system and functions that use it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can we provide something like statfs()? Get free disk space / disk utilization?
8 participants