diff-closures: print sizes with dynamic unit#14364
Conversation
cd5e333 to
f88ba18
Compare
SuperSandro2000
left a comment
There was a problem hiding this comment.
Just applied this on 2.30 and works like a charm. Would be nice to back port this, too but no blocker if not. 🎉
|
Thanks. This supersedes #14358 it looks like |
|
Yeah, I actually did not see the other PR, most likely because removing showBytes was just a side quest while discovering renderSize after I've implemented by own function ;D Should I add the author of #14358 as co-authored? |
Feel free. Don't think @lovesegfault would object |
f88ba18 to
e1a91f7
Compare
|
Nice, I'll close my PR :) |
The `showBytes()` function was redundant with `renderSize()` as the latter automatically selects the appropriate unit (KiB, MiB, GiB, etc.) based on the value, whereas `showBytes()` always formatted as MiB regardless of size. Co-authored-by: Bernardo Meurer Costa <beme@anthropic.com>
e1a91f7 to
584a8e8
Compare
|
Successfully created backport PR for |
|
Successfully created backport PR for |
|
Successfully created backport PR for |
|
@MarcelCoding it has occurred to me that nix-output-monitor might rely on this and sure enough: https://github.com/maralorn/nix-output-monitor/blob/07169b3894ab7cb1ee01d766145ab03bf2dc7a69/lib/NOM/Parser.hs#L76-L86. Though it seems like an incredibly bad idea to parse logs meant for human consumption that's what we have at the moment. |
|
Could we have the json format printing raw data and than it's formatted late in the process? It would still break current nom but maybe more maintainable in the future. |
|
|
Anyway, I will revert the backports on release branches since it will surely break things. EDIT: Though I'm open to other ideas. In general it doesn't sound like a good place to be that inherently human readable output is treated as a de-facto stable interface. |
FTR: I totally agree. I generally regard the human-readable parsing part of nom deprecated. However this message is one of the few bits left that we can’t do without. Because this message is used verbatim in the internal-json format and there is no structured way to receive this data. That being said it wouldn’t be hard to adapt the nom parser to this change in a backwards-compatible way. |
|
Uh, I take this back. I actually think users of Only users of |
idk. I really didn’t expect nix to care for noms terrible hacks. 😆 So I wouldn’t really mind if this breaks some usages. As written above it will be mostly fine, this only affects a deprecated usage pattern. But I can extend the parser in nom and do a new release and then we are fine. We just maybe don’t want to backport the nix change to stable without backporting the nom change as well. |
Motivation
Provide human-readable units for data sizes.
12345.0 MiBnow will be rendered120.5 GiB.Things done
renderSizein all other places, but it could be that I've missed some. Feel free to point me to missing places and I'll try my best to also update these.renderSize. This is needed e.g. for the diff-closures command. (See the updated unit tests for an example.)showByteswithrenderSize.Things not done
renderActivityin the progress bar and my non-existent c/cpp experience, I wasn't able to integraterenderSizethere.Examples
Example output of a diff-closures execution:
Example output of
nix-collect-garbage:Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.