offload: Remove the "machine choice" lock.
This lock was unnecessary and it led to a contention when many 'guix offload' processes are polling for available machines. * guix/scripts/offload.scm (machine-choice-lock-file): Remove. (choose-build-machine): Remove surrounding 'with-file-lock (machine-lock-file)'.
This commit is contained in:
parent
b12f8720f5
commit
7f4d102c2f
|
@ -453,10 +453,6 @@ of free disk space on '~a'~%")
|
|||
(build-machine-name machine)
|
||||
"." (symbol->string hint) ".lock"))
|
||||
|
||||
(define (machine-choice-lock-file)
|
||||
"Return the name of the file used as a lock when choosing a build machine."
|
||||
(string-append %state-directory "/offload/machine-choice.lock"))
|
||||
|
||||
(define (random-seed)
|
||||
(logxor (getpid) (car (gettimeofday))))
|
||||
|
||||
|
@ -479,14 +475,11 @@ of free disk space on '~a'~%")
|
|||
slot (which must later be released with 'release-build-slot'), or #f and #f."
|
||||
|
||||
;; Proceed like this:
|
||||
;; 1. Acquire the global machine-choice lock.
|
||||
;; 2. For all MACHINES, attempt to acquire a build slot, and filter out
|
||||
;; 1. For all MACHINES, attempt to acquire a build slot, and filter out
|
||||
;; those machines for which we failed.
|
||||
;; 3. Choose the best machine among those that are left.
|
||||
;; 4. Release the previously-acquired build slots of the other machines.
|
||||
;; 5. Release the global machine-choice lock.
|
||||
;; 2. Choose the best machine among those that are left.
|
||||
;; 3. Release the previously-acquired build slots of the other machines.
|
||||
|
||||
(with-file-lock (machine-choice-lock-file)
|
||||
(define machines+slots
|
||||
(filter-map (lambda (machine)
|
||||
(let ((slot (acquire-build-slot machine)))
|
||||
|
@ -539,7 +532,7 @@ on disk space (~,2f MiB free)~%"
|
|||
(release-build-slot slot)
|
||||
(loop others)))))
|
||||
(()
|
||||
(values #f #f))))))
|
||||
(values #f #f)))))
|
||||
|
||||
(define (call-with-timeout timeout drv thunk)
|
||||
"Call THUNK and leave after TIMEOUT seconds. If TIMEOUT is #f, simply call
|
||||
|
|
Loading…
Reference in New Issue