[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/02: hydra/services: Allow configuring full guix gc jobs.
From: |
Maxim Cournoyer |
Subject: |
01/02: hydra/services: Allow configuring full guix gc jobs. |
Date: |
Wed, 18 Jan 2023 16:31:24 -0500 (EST) |
apteryx pushed a commit to branch master
in repository maintenance.
commit c6bb774462a7f8f7ba86def8ccb0567ef3e2ac3b
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Wed Jan 18 11:25:22 2023 -0500
hydra/services: Allow configuring full guix gc jobs.
* hydra/modules/sysadmin/services.scm (gc-jobs): Document that
threshold can be #f, and remove the -F and threshold value for the
guix gc jobs in this case. Also run once instead of twice a day when
a full gc is used.
---
hydra/modules/sysadmin/services.scm | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/hydra/modules/sysadmin/services.scm
b/hydra/modules/sysadmin/services.scm
index bdc7a3f..b0cae94 100644
--- a/hydra/modules/sysadmin/services.scm
+++ b/hydra/modules/sysadmin/services.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2016-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017, 2018, 2020, 2022 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2022 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
@@ -207,19 +208,28 @@
deleted))))))))
(define (gc-jobs threshold)
- "Return the garbage collection mcron jobs."
- (list #~(job '(next-hour '(3 15))
- #$cleanup-cuirass-roots)
-
- #~(job '(next-hour '(4))
- (string-append #$guix "/bin/guix gc -F"
- #$(number->string threshold)))
-
- ;; Half a day later, make sure half of our quota is available.
- #~(job '(next-hour '(16))
- (string-append #$guix "/bin/guix gc -F"
- #$(number->string
- (quotient threshold 2))))))
+ "Return the garbage collection mcron jobs. The garbage collection
+jobs are run twice a day, when the available free space falls below
+THRESHOLD. THRESHOLD can be set to #f to run a daily full garbage
+collection instead."
+ (define (make-guix-gc-command threshold)
+ `(,(file-append guix "/bin/guix") "gc"
+ ,@(if threshold
+ (list "-F" (number->string threshold))
+ '())))
+
+ `(,#~(job '(next-hour '(3 15))
+ #$cleanup-cuirass-roots)
+
+ ,#~(job '(next-hour '(4))
+ (string-join '#$(make-guix-gc-command threshold)))
+
+ ;; Half a day later, make sure half of our quota is available.
+ ,@(if threshold
+ (list #~(job '(next-hour '(16))
+ (string-join '#$(make-guix-gc-command
+ (quotient threshold 2)))))
+ '())))
(define* (guix-daemon-config #:key (max-jobs 5) (cores 4)
(build-accounts-to-max-jobs-ratio 4)