GNU bug report logs -
#29699
[PATCH] guix: offload: Add "status" sub-command.
Previous Next
Reported by: Ricardo Wurmus <rekado <at> elephly.net>
Date: Wed, 13 Dec 2017 22:45:02 UTC
Severity: normal
Tags: patch
Done: Ricardo Wurmus <rekado <at> elephly.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29699 in the body.
You can then email your comments to 29699 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#29699
; Package
guix-patches
.
(Wed, 13 Dec 2017 22:45:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ricardo Wurmus <rekado <at> elephly.net>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Wed, 13 Dec 2017 22:45:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* guix/scripts/offload.scm (check-machine-load): New procedure.
(guix-offload): Call it when the argument is "status".
* doc/guix.texi (Daemon Offload Setup): Document it.
---
doc/guix.texi | 9 +++++++++
guix/scripts/offload.scm | 26 ++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/doc/guix.texi b/doc/guix.texi
index 92ac45b1c..6845a4271 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -1066,6 +1066,15 @@ regular expression like this:
# guix offload test machines.scm '\.gnu\.org$'
@end example
+@cindex offload status
+To display the current load of all build hosts, run this command on the
+main node:
+
+@example
+# guix offload status
+@end example
+
+
@node Invoking guix-daemon
@section Invoking @command{guix-daemon}
diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm
index ebd0bf783..40bc68b11 100644
--- a/guix/scripts/offload.scm
+++ b/guix/scripts/offload.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2017 Ricardo Wurmus <rekado <at> elephly.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -629,6 +630,19 @@ machine."
(for-each assert-node-can-import nodes names sockets)
(for-each assert-node-can-export nodes names sockets))))
+(define (check-machine-load machine-file pred)
+ "Print the load of each machine matching PRED in MACHINE-FILE."
+ (define (build-machine=? m1 m2)
+ (and (string=? (build-machine-name m1) (build-machine-name m2))
+ (= (build-machine-port m1) (build-machine-port m2))))
+
+ ;; A given build machine may appear several times (e.g., once for
+ ;; "x86_64-linux" and a second time for "i686-linux"); test them only once.
+ (let ((machines (filter pred
+ (delete-duplicates (build-machines machine-file)
+ build-machine=?))))
+ (for-each machine-load machines)))
+
;;;
;;; Entry point.
@@ -691,6 +705,18 @@ machine."
(() (values %machine-file (const #t)))
(x (leave (G_ "wrong number of arguments~%"))))))
(check-machine-availability (or file %machine-file) pred))))
+ (("status" rest ...)
+ (with-error-handling
+ (let-values (((file pred)
+ (match rest
+ ((file regexp)
+ (values file
+ (compose (cut string-match regexp <>)
+ build-machine-name)))
+ ((file) (values file (const #t)))
+ (() (values %machine-file (const #t)))
+ (x (leave (G_ "wrong number of arguments~%"))))))
+ (check-machine-load (or file %machine-file) pred))))
(("--version")
(show-version-and-exit "guix offload"))
(("--help")
--
2.15.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#29699
; Package
guix-patches
.
(Fri, 15 Dec 2017 10:43:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 29699 <at> debbugs.gnu.org (full text, mbox):
Ricardo Wurmus <rekado <at> elephly.net> skribis:
> * guix/scripts/offload.scm (check-machine-load): New procedure.
> (guix-offload): Call it when the argument is "status".
> * doc/guix.texi (Daemon Offload Setup): Document it.
Nice, LGTM!
> +(define (check-machine-load machine-file pred)
> + "Print the load of each machine matching PRED in MACHINE-FILE."
> + (define (build-machine=? m1 m2)
> + (and (string=? (build-machine-name m1) (build-machine-name m2))
> + (= (build-machine-port m1) (build-machine-port m2))))
> +
> + ;; A given build machine may appear several times (e.g., once for
> + ;; "x86_64-linux" and a second time for "i686-linux"); test them only once.
> + (let ((machines (filter pred
> + (delete-duplicates (build-machines machine-file)
> + build-machine=?))))
> + (for-each machine-load machines)))
Perhaps we could also display information from ‘uname’, as in
<https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/hydra/machine-status.scm#n118>?
Thanks!
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#29699
; Package
guix-patches
.
(Fri, 15 Dec 2017 21:07:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 29699 <at> debbugs.gnu.org (full text, mbox):
Ludovic Courtès <ludo <at> gnu.org> writes:
> Ricardo Wurmus <rekado <at> elephly.net> skribis:
>
>> * guix/scripts/offload.scm (check-machine-load): New procedure.
>> (guix-offload): Call it when the argument is "status".
>> * doc/guix.texi (Daemon Offload Setup): Document it.
>
> Nice, LGTM!
>
>> +(define (check-machine-load machine-file pred)
>> + "Print the load of each machine matching PRED in MACHINE-FILE."
>> + (define (build-machine=? m1 m2)
>> + (and (string=? (build-machine-name m1) (build-machine-name m2))
>> + (= (build-machine-port m1) (build-machine-port m2))))
>> +
>> + ;; A given build machine may appear several times (e.g., once for
>> + ;; "x86_64-linux" and a second time for "i686-linux"); test them only once.
>> + (let ((machines (filter pred
>> + (delete-duplicates (build-machines machine-file)
>> + build-machine=?))))
>> + (for-each machine-load machines)))
>
> Perhaps we could also display information from ‘uname’, as in
> <https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/hydra/machine-status.scm#n118>?
I didn’t even notice machine-status.scm! Should we just fold that into
offload.scm instead of accepting my simplistic “check-machine-load”
procedure?
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
Information forwarded
to
guix-patches <at> gnu.org
:
bug#29699
; Package
guix-patches
.
(Fri, 15 Dec 2017 22:42:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 29699 <at> debbugs.gnu.org (full text, mbox):
Ricardo Wurmus <rekado <at> elephly.net> skribis:
> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> Ricardo Wurmus <rekado <at> elephly.net> skribis:
>>
>>> * guix/scripts/offload.scm (check-machine-load): New procedure.
>>> (guix-offload): Call it when the argument is "status".
>>> * doc/guix.texi (Daemon Offload Setup): Document it.
>>
>> Nice, LGTM!
>>
>>> +(define (check-machine-load machine-file pred)
>>> + "Print the load of each machine matching PRED in MACHINE-FILE."
>>> + (define (build-machine=? m1 m2)
>>> + (and (string=? (build-machine-name m1) (build-machine-name m2))
>>> + (= (build-machine-port m1) (build-machine-port m2))))
>>> +
>>> + ;; A given build machine may appear several times (e.g., once for
>>> + ;; "x86_64-linux" and a second time for "i686-linux"); test them only once.
>>> + (let ((machines (filter pred
>>> + (delete-duplicates (build-machines machine-file)
>>> + build-machine=?))))
>>> + (for-each machine-load machines)))
>>
>> Perhaps we could also display information from ‘uname’, as in
>> <https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/hydra/machine-status.scm#n118>?
>
> I didn’t even notice machine-status.scm! Should we just fold that into
> offload.scm instead of accepting my simplistic “check-machine-load”
> procedure?
Sure, I guess it’s just a matter of adding (node-eval node '(uname)) in
‘check-machine-load’ and printing that.
Thanks,
Ludo’.
Reply sent
to
Ricardo Wurmus <rekado <at> elephly.net>
:
You have taken responsibility.
(Sat, 16 Dec 2017 20:54:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Ricardo Wurmus <rekado <at> elephly.net>
:
bug acknowledged by developer.
(Sat, 16 Dec 2017 20:54:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 29699-done <at> debbugs.gnu.org (full text, mbox):
Ludovic Courtès <ludo <at> gnu.org> writes:
> Ricardo Wurmus <rekado <at> elephly.net> skribis:
>
>> Ludovic Courtès <ludo <at> gnu.org> writes:
>>
>>> Ricardo Wurmus <rekado <at> elephly.net> skribis:
>>>
>>>> * guix/scripts/offload.scm (check-machine-load): New procedure.
>>>> (guix-offload): Call it when the argument is "status".
>>>> * doc/guix.texi (Daemon Offload Setup): Document it.
>>>
>>> Nice, LGTM!
>>>
>>>> +(define (check-machine-load machine-file pred)
>>>> + "Print the load of each machine matching PRED in MACHINE-FILE."
>>>> + (define (build-machine=? m1 m2)
>>>> + (and (string=? (build-machine-name m1) (build-machine-name m2))
>>>> + (= (build-machine-port m1) (build-machine-port m2))))
>>>> +
>>>> + ;; A given build machine may appear several times (e.g., once for
>>>> + ;; "x86_64-linux" and a second time for "i686-linux"); test them only once.
>>>> + (let ((machines (filter pred
>>>> + (delete-duplicates (build-machines machine-file)
>>>> + build-machine=?))))
>>>> + (for-each machine-load machines)))
>>>
>>> Perhaps we could also display information from ‘uname’, as in
>>> <https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/hydra/machine-status.scm#n118>?
>>
>> I didn’t even notice machine-status.scm! Should we just fold that into
>> offload.scm instead of accepting my simplistic “check-machine-load”
>> procedure?
>
> Sure, I guess it’s just a matter of adding (node-eval node '(uname)) in
> ‘check-machine-load’ and printing that.
Okay, pushed to master with commit dafc3dafe.
I renamed the procedure to “check-machine-status” because it does more
than just print the load.
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 14 Jan 2018 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 209 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.