diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-01-26 14:06:09 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-01-26 14:06:09 +0100 |
commit | 44f95d407c3dad0e86d31b8590b45a948242eca2 (patch) | |
tree | 38b345bc980f22117d5fecdc27788a863d8f452a | |
parent | 047e9271268f7f35df9741950fc2ae462d551ed2 (diff) | |
download | cuirass-44f95d407c3dad0e86d31b8590b45a948242eca2.tar cuirass-44f95d407c3dad0e86d31b8590b45a948242eca2.tar.gz |
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.
-rw-r--r-- | src/cuirass/base.scm | 26 |
1 files 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))) builds))) ;; 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))) stale) - ;; 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." |