From b1e48f222b4805012b4fd2ef5b4aa46884ee0a8d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 29 Aug 2014 14:37:58 +0200 Subject: offload: Ignore unreachable machines. Fixes . Reported by Andreas Enge . * guix/scripts/offload.scm (remote-pipe): Augment docstring. (machine-load): Return +inf.0 instead of 1 if MACHINE does not respond or responds badly. --- guix/scripts/offload.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'guix/scripts/offload.scm') diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm index 18af511ed8..c17de34acc 100644 --- a/guix/scripts/offload.scm +++ b/guix/scripts/offload.scm @@ -181,7 +181,8 @@ (define* (remote-pipe machine mode command #:key (error-port (current-error-port)) (quote? #t)) "Run COMMAND (a string list) on MACHINE, assuming an lsh gateway has been set up. When QUOTE? is true, perform shell-quotation of all the elements of -COMMAND." +COMMAND. Return either a pipe opened with MODE, or #f if the lsh client could +not be started." (define (shell-quote str) ;; Sort-of shell-quote STR so it can be passed as an argument to the ;; shell. @@ -535,7 +536,7 @@ (define (machine-load machine) (line (read-line pipe))) (close-pipe pipe) (if (eof-object? line) - 1. + +inf.0 ;MACHINE does not respond, so assume it is infinitely loaded (match (string-tokenize line) ((one five fifteen . _) (let* ((raw (string->number five)) @@ -546,7 +547,7 @@ (define (machine-load machine) (build-machine-name machine) raw normalized) normalized)) (_ - 1.))))) + +inf.0))))) ;something's fishy about MACHINE, so avoid it (define (machine-less-loaded? m1 m2) "Return #t if the load on M1 is lower than that on M2." -- cgit v1.2.3