guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/05: hydra: Invalidate derivation caches after each architecture evalu


From: Ludovic Courtès
Subject: 04/05: hydra: Invalidate derivation caches after each architecture evaluation.
Date: Wed, 13 Dec 2017 17:12:10 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 34797d8afc3c5f1211a4baf1161de640fc630a2e
Author: Ludovic Courtès <address@hidden>
Date:   Wed Dec 13 15:01:07 2017 +0100

    hydra: Invalidate derivation caches after each architecture evaluation.
    
    This reduces max RSS from 1.3G to 1.0G.
    
    * guix/derivations.scm (invalidate-derivation-caches!): New procedure.
    * build-aux/hydra/gnu-system.scm (hydra-jobs): Use it.  Add 'format'
    call.
---
 build-aux/hydra/gnu-system.scm |  7 +++++++
 guix/derivations.scm           | 10 ++++++++++
 2 files changed, 17 insertions(+)

diff --git a/build-aux/hydra/gnu-system.scm b/build-aux/hydra/gnu-system.scm
index d9b9c55..5aaac52 100644
--- a/build-aux/hydra/gnu-system.scm
+++ b/build-aux/hydra/gnu-system.scm
@@ -334,6 +334,13 @@ valid."
   (parameterize ((%graft? #f))
     ;; Return one job for each package, except bootstrap packages.
     (append-map (lambda (system)
+                  (format (current-error-port)
+                          "evaluating for '~a' (heap size: ~a MiB)...~%"
+                          system
+                          (round
+                           (/ (assoc-ref (gc-stats) 'heap-size)
+                              (expt 2. 20))))
+                  (invalidate-derivation-caches!)
                   (case subset
                     ((all)
                      ;; Build everything, including replacements.
diff --git a/guix/derivations.scm b/guix/derivations.scm
index 38cefb6..97f96d9 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -90,6 +90,7 @@
             derivation-path->output-paths
             derivation
             raw-derivation
+            invalidate-derivation-caches!
 
             map-derivation
 
@@ -841,6 +842,15 @@ output should not be used."
       (hash-set! %derivation-cache file drv*)
       drv*)))
 
+(define (invalidate-derivation-caches!)
+  "Invalidate internal derivation caches.  This is mostly useful for
+long-running processes that know what they're doing.  Use with care!"
+  ;; Typically this is meant to be used by Cuirass and Hydra, which can clear
+  ;; caches when they start evaluating packages for another architecture.
+  (invalidate-memoization! derivation->bytevector)
+  (invalidate-memoization! derivation-path->base16-hash)
+  (hash-clear! %derivation-cache))
+
 (define* (map-derivation store drv mapping
                          #:key (system (%current-system)))
   "Given MAPPING, a list of pairs of derivations, return a derivation based on



reply via email to

[Prev in Thread] Current Thread [Next in Thread]