diff options
author | Christopher Baines <mail@cbaines.net> | 2024-06-19 14:16:22 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-06-19 17:03:08 +0100 |
commit | f6dcb27d3fe8f20c7f4db975d5ac7a5df375a4f7 (patch) | |
tree | aeefa5c5fe79f119ebf86e90dbf8ebcb337d1e70 /guix-build-coordinator/build-allocator.scm | |
parent | 07dc4f9ac99aa6def909f25c792207e4154180f6 (diff) | |
download | build-coordinator-f6dcb27d3fe8f20c7f4db975d5ac7a5df375a4f7.tar build-coordinator-f6dcb27d3fe8f20c7f4db975d5ac7a5df375a4f7.tar.gz |
Move the allocation plan in to memory
Rather than using an in memory SQLite table, since I think this might be
causing issues when opening new SQLite reader threads.
Diffstat (limited to 'guix-build-coordinator/build-allocator.scm')
-rw-r--r-- | guix-build-coordinator/build-allocator.scm | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/guix-build-coordinator/build-allocator.scm b/guix-build-coordinator/build-allocator.scm index 58e5301..cf916cf 100644 --- a/guix-build-coordinator/build-allocator.scm +++ b/guix-build-coordinator/build-allocator.scm @@ -418,31 +418,28 @@ setup-failures-hash)) (let ((result - (append-map + (map (lambda (agent-id) (log "considering builds for" agent-id) (let ((builds-sorted-by-derived-priority (sort-list (filter (filter-builds-for-agent agent-id) builds) (build-sorting-function-for-agent agent-id)))) - (if (null? builds-sorted-by-derived-priority) - '() - (let ((final-ordered-builds - (concatenate - (map sort-priority-sublist - (limit-processed-sublists - (break-builds-in-to-priority-sublists - builds-sorted-by-derived-priority)))))) - (let ((builds-for-agent - (limit-planned-builds final-ordered-builds))) - (map (lambda (build-id ordering) - (list build-id - agent-id - ordering)) - (map (lambda (build) - (assq-ref build 'uuid)) - builds-for-agent) - (iota (length builds-for-agent)))))))) + (cons + agent-id + (if (null? builds-sorted-by-derived-priority) + '() + (let ((final-ordered-builds + (concatenate + (map sort-priority-sublist + (limit-processed-sublists + (break-builds-in-to-priority-sublists + builds-sorted-by-derived-priority)))))) + (let ((builds-for-agent + (limit-planned-builds final-ordered-builds))) + (map (lambda (build) + (assq-ref build 'uuid)) + builds-for-agent))))))) (map (lambda (agent) (assq-ref agent 'uuid)) agents)))) @@ -584,7 +581,7 @@ counts))) (let ((result - (append-map + (map (lambda (agent-id) (log "considering builds for" agent-id) (let* ((filter-proc @@ -606,18 +603,7 @@ (loop count build-ids (cdr potential-build-ids)))))))) - (if (null? build-ids) - '() - (let ((build-ids-count - (length build-ids))) - (map (lambda (build-id ordering) - (list build-id - agent-id - ordering)) - build-ids - (iota build-ids-count - build-ids-count - -1)))))) + (cons agent-id build-ids))) (map (lambda (agent) (assq-ref agent 'uuid)) agents)))) |