guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Ludovic Courtès
Date: Wed, 23 Aug 2023 17:09:10 -0400 (EDT)

branch: master
commit aeec27aedc6182b2ddcebe1886c0a8ef3daf9ee0
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Aug 23 22:46:36 2023 +0200

    evaluate: Print 'done only on actual success.
    
    Previously, evaluation failure might result in an '&inferior-exception'
    that would be swallowed by 'n-par-for-each'.  The results would be an
    evaluation mark as succeeding, but with zero registered builds.
    
    * src/cuirass/scripts/evaluate.scm (cuirass-evaluate): Use 'n-par-map'
    instead of 'n-par-for-each' and keep the results.  Print 'done only when
    the resulting list denotes success.
---
 src/cuirass/scripts/evaluate.scm | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/src/cuirass/scripts/evaluate.scm b/src/cuirass/scripts/evaluate.scm
index 2ce0294..1245a3c 100644
--- a/src/cuirass/scripts/evaluate.scm
+++ b/src/cuirass/scripts/evaluate.scm
@@ -134,23 +134,30 @@ registered in database."
                   (profile (channel-instances->profile instances))
                   (build (specification-build spec))
                   (systems (specification-systems spec)))
+             (define statuses
+               ;; Evaluate jobs on a per-system basis for two reasons.  It
+               ;; speeds up the evaluation as the evaluations can be performed
+               ;; concurrently.  It also decreases the amount of memory needed
+               ;; per evaluation process.
+               (n-par-map
+                (min (length systems) (current-processor-count))
+                (lambda (system)
+                  (with-store store
+                    (inferior-evaluation store profile
+                                         #:eval-id eval-id
+                                         #:instances instances
+                                         #:spec spec
+                                         #:build build
+                                         #:systems (list system))
+                    'success))
+                systems))
 
-             ;; Evaluate jobs on a per-system basis for two reasons.  It
-             ;; speeds up the evaluation as the evaluations can be performed
-             ;; concurrently.  It also decreases the amount of memory needed
-             ;; per evaluation process.
-             (n-par-for-each
-              (min (length systems) (current-processor-count))
-              (lambda (system)
-                (with-store store
-                  (inferior-evaluation store profile
-                                       #:eval-id eval-id
-                                       #:instances instances
-                                       #:spec spec
-                                       #:build build
-                                       #:systems (list system))))
-              systems)
-             (display 'done)))))
+             ;; Display something if and only if all the evaluations succeeded
+             ;; ('n-par-map' swallows exceptions, hence this trick.)  'cuirass
+             ;; register' equates "no message on stdout" with evaluation
+             ;; failure.
+             (when (equal? statuses (map (const 'success) systems))
+               (display 'done))))))
     (x
      (format (current-error-port) "Wrong command: ~a~%." x)
      (exit 1))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]