[Top][All Lists]

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

[no subject]

From: Ludovic Courtès
Date: Fri, 26 Jan 2018 09:24:04 -0500 (EST)

branch: master
commit 44f95d407c3dad0e86d31b8590b45a948242eca2
Author: Ludovic Courtès <address@hidden>
Date:   Fri Jan 26 14:06:09 2018 +0100

    base: Do not restart builds that turn out to have succeeded already.
    * src/cuirass/base.scm (restart-builds): Mark as succeeded the subset of
    VALID with at least one valid output.
 src/cuirass/base.scm | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index 574a42e..c08df23 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -388,16 +388,32 @@ updating DB accordingly."
                                   (valid-path? store drv)))
       ;; We cannot restart builds listed in STALE, so mark them as canceled.
-      (log-message "canceling ~a pending builds" (length stale))
+      (log-message "canceling ~a stale builds" (length stale))
       (for-each (lambda (build)
                   (db-update-build-status! db (assq-ref build #:derivation)
                                            (build-status canceled)))
-      ;; Those in VALID can be restarted.
-      (log-message "restarting ~a pending builds" (length valid))
-      (spawn-builds store db valid)
-      (log-message "done with restarted builds"))))
+      ;; Those in VALID can be restarted, but some of them may actually be
+      ;; done already--either because our database is outdated, or because it
+      ;; was not built by Cuirass.
+      (let-values (((done remaining)
+                    (partition (lambda (build)
+                                 (match (assq-ref build #:outputs)
+                                   (((name ((#:path . item))) _ ...)
+                                    (valid-path? store item))
+                                   (_ #f)))
+                               valid)))
+        (log-message "~a of the pending builds had actually completed"
+                     (length done))
+        (for-each (lambda (build)
+                    (db-update-build-status! db (assq-ref build #:derivation)
+                                             (build-status succeeded)))
+                  done)
+        (log-message "restarting ~a pending builds" (length remaining))
+        (spawn-builds store db remaining)
+        (log-message "done with restarted builds")))))
 (define (build-packages store db jobs)
   "Build JOBS and return a list of Build results."

reply via email to

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