Skip to content
Snippets Groups Projects
Commit b1fea303 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

offload: Try another machine when the "best" machine is overloaded.

* guix/scripts/offload.scm (choose-build-machine): When BEST is
  overloaded, try the other machines.
parent 4359378a
No related branches found
No related tags found
No related merge requests found
......@@ -610,22 +610,25 @@ (define (undecorate pred)
(list machine1 slot1)
(list machine2 slot2))))))))
(let ((machines+slots (sort machines+slots
(undecorate machine-less-loaded-or-faster?))))
(let loop ((machines+slots
(sort machines+slots
(undecorate machine-less-loaded-or-faster?))))
(match machines+slots
(((best slot) (others slots) ...)
;; Release slots from the uninteresting machines.
(for-each release-build-slot slots)
(((best slot) others ...)
;; Return the best machine unless it's already overloaded.
(if (< (machine-load best) 2.)
(match others
(((machines slots) ...)
;; Release slots from the uninteresting machines.
(for-each release-build-slot slots)
;; Prevent SLOT from being GC'd.
(set! %slots (cons slot %slots))
best))
(begin
;; Prevent SLOT from being GC'd.
(set! %slots (cons slot %slots))
best)
(begin
;; BEST is overloaded, so try the next one.
(release-build-slot slot)
#f)))
(loop others))))
(() #f)))))
(define* (process-request wants-local? system drv features
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment