[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than ab
From: |
Ludovic Courtès |
Subject: |
[bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold. |
Date: |
Sun, 23 Feb 2020 12:46:38 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Hello!
Pierre Neidhardt <address@hidden> skribis:
> Ludovic Courtès <address@hidden> writes:
>
>> Hi!
>>
>> Pierre Neidhardt <address@hidden> skribis:
>>
>>> * guix/scripts.scm (%disk-space-warning-absolute): New variable.
>>> (warn-about-disk-space): Test against %disk-space-warning-absolute.
>>> Fix error in display-hint due to extraneous 'profile' argument.
>>
>> [...]
>>
>>> +(define %disk-space-warning-absolute
>>> + ;; The decimal number of GiB of free disk space below which a warning is
>>> + ;; emitted.
>>> + (make-parameter (match (and=> (getenv "GUIX_DISK_SPACE_WARNING_ABSOLUTE")
>>> + string->number)
>>> + (#f 17.0)
>>> + (threshold threshold))))
>>
>> Perhaps we should arrange for ‘GUIX_DISK_SPACE_WARNING’ to handle both
>> cases?
>>
>> That is, we’d first try to convert it with ‘size->number’; if that
>> works, it’s an absolute measure, and if it returns #f, then pass the
>> string to ‘string->number’ and assume it’s a fraction.
>
> I thought of something similar too, but this needs discussion:
>
> - If we change the meaning of a value like "1", we are breaking backward
> compatibility.
We can assume values <= 100 are a percentage.
> - GUIX_DISK_SPACE_WARNING is currently undocumented, so I guess it's OK
> to break backward compatibility. However, it'd be nice to document it :)
Yup.
> - Currently (size->number "1.MiB") "leaves" the Guile instance on error.
> Which
> I find quite weird, I'd expect it to return #f when it cannot parse
> the input.
Fixed.
> - Currently (size->number "0.8") returns 1. If we want to use your
> suggestion, we would need to change the behaviour so that it returns
> #f.
Hmm.
> - Alternatively, since we are breaking backward compatibility anyways,
> we could parse a trailing percent sign "%" to decide whether the value
> is relative or absolute.
Right.
> Anyways, the issue was originally about dealing with both small and big
> partitions, and for this we need both a default absolute threshold and a
> default relative threshold. Does that make sense?
It does!
So how about this:
We check for a trailing “%”, and if there’s one, assume it’s a percentage.
Else, call ‘size->number’. If we get an integer < 100, assume it’s a
percentage, otherwise assume it’s an absolute size in bytes.
How does that sound?
Thanks!
Ludo’.
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Pierre Neidhardt, 2020/02/22
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Ludovic Courtès, 2020/02/22
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Pierre Neidhardt, 2020/02/22
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold.,
Ludovic Courtès <=
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Pierre Neidhardt, 2020/02/23
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Ludovic Courtès, 2020/02/23
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Pierre Neidhardt, 2020/02/23
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Ludovic Courtès, 2020/02/23
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Pierre Neidhardt, 2020/02/23
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Pierre Neidhardt, 2020/02/23
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Pierre Neidhardt, 2020/02/23
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Ludovic Courtès, 2020/02/24
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Pierre Neidhardt, 2020/02/24
- [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold., Pierre Neidhardt, 2020/02/24