aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-12-23 14:22:46 +0000
committerChristopher Baines <mail@cbaines.net>2020-12-23 14:22:46 +0000
commita52c76f6a7d2bd57f9837625b82a695b8455d4d5 (patch)
tree791a436b7ff02e87ea87fe6f9d58970834070ab5
parent0dda534fc69eaf51043d9e5ce3639986c6dc8ced (diff)
downloadbuild-coordinator-a52c76f6a7d2bd57f9837625b82a695b8455d4d5.tar
build-coordinator-a52c76f6a7d2bd57f9837625b82a695b8455d4d5.tar.gz
Have the basic allocator prioritise builds with all build inputs
-rw-r--r--guix-build-coordinator/build-allocator.scm19
1 files changed, 17 insertions, 2 deletions
diff --git a/guix-build-coordinator/build-allocator.scm b/guix-build-coordinator/build-allocator.scm
index 6a17246..614bd0f 100644
--- a/guix-build-coordinator/build-allocator.scm
+++ b/guix-build-coordinator/build-allocator.scm
@@ -198,6 +198,19 @@
(define deferred-builds-last-count 0)
+ (define (all-inputs-built? derivation)
+ (let ((inputs (datastore-find-derivation-inputs
+ datastore
+ derivation)))
+ (every (lambda (input-details)
+ (let ((output (assq-ref input-details 'output)))
+ (any (lambda (output-build)
+ (string=? (or (assq-ref output-build 'result)
+ "unknown")
+ "success"))
+ (cached/list-builds-for-output output))))
+ inputs)))
+
(define (push-deferred-builds-to-the-back builds-list)
(let loop ((result '())
(builds builds-list)
@@ -230,8 +243,10 @@
(let-values (((ready-builds other-builds)
(partition (lambda (build)
- (hash-ref builds-ready-to-go-hash
- (assq-ref build 'uuid)))
+ (or (hash-ref builds-ready-to-go-hash
+ (assq-ref build 'uuid))
+ (all-inputs-built?
+ (assq-ref build 'derivation-name))))
builds-list)))
(append ready-builds
(push-deferred-builds-to-the-back other-builds))))