Mentions légales du service

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

head-node: Turn GC jobs into Shepherd timers.

* head-node.scm (garbage-collector-service): New procedure.
(%garbage-collector-services): New variable.
<top level>: Remove ‘gc-jobs’ and use ‘%garbage-collector-services’
instead.
parent 76b98d12
No related branches found
No related tags found
No related merge requests found
...@@ -57,12 +57,41 @@ export CUIRASS_LOGGING_LEVEL=${CUIRASS_LOGGING_LEVEL:-debug}\n" ...@@ -57,12 +57,41 @@ export CUIRASS_LOGGING_LEVEL=${CUIRASS_LOGGING_LEVEL:-debug}\n"
;; We have 24 cores. ;; We have 24 cores.
(extra-options '("--max-jobs=2" "--cores=6")))))) (extra-options '("--max-jobs=2" "--cores=6"))))))
(define garbage-collector-jobs ;; TODO: Share with 'build-node.scm'.
;; Collect garbage at 5AM every day, and make sure we're on track at 3PM. (define (garbage-collector-service name calendar free-space)
(list #~(job '(next-hour '(5)) "Return a Shepherd timer called NAME that collects garbage according to
"guix gc -F 25G -d 2m") CALENDAR, a gexp, and ensures at least FREE-SPACE GiB are available."
#~(job '(next-hour '(15)) (simple-service
"guix gc -F 15G"))) name shepherd-root-service-type
(list (shepherd-service
(provision (list name))
(requirement '(user-processes))
(modules '((shepherd service timer)))
(start #~(make-timer-constructor
#$calendar
(command '("/run/current-system/profile/bin/guix" "gc"
"-F" #$(format #f "~aG" free-space)
"-d" "2m"))
#:wait-for-termination? #t))
(stop #~(make-timer-destructor))
(documentation "Run the garbage collector (GC).")
(actions
(list (shepherd-action
(name 'trigger)
(documentation "GC!")
(procedure #~trigger-timer))))))))
(define %garbage-collector-services
;; Collect garbage several times a day, with bigger collections twice a
;; day.
(list (garbage-collector-service 'gc-quick
#~(calendar-event #:minutes '(30)
#:hours '#$(iota 24))
20)
(garbage-collector-service 'gc
#~(calendar-event #:minutes '(0)
#:hours '(5 15))
60)))
(define (guix-channel branch) (define (guix-channel branch)
#~(channel #~(channel
...@@ -496,9 +525,6 @@ export CUIRASS_LOGGING_LEVEL=${CUIRASS_LOGGING_LEVEL:-debug}\n" ...@@ -496,9 +525,6 @@ export CUIRASS_LOGGING_LEVEL=${CUIRASS_LOGGING_LEVEL:-debug}\n"
(platforms (lookup-qemu-platforms "arm" (platforms (lookup-qemu-platforms "arm"
"aarch64")))) "aarch64"))))
(simple-service 'gc-jobs mcron-service-type
garbage-collector-jobs)
(service cuirass-service-type (service cuirass-service-type
(cuirass-configuration (cuirass-configuration
(cuirass cuirass-latest/debug) (cuirass cuirass-latest/debug)
...@@ -541,4 +567,6 @@ export CUIRASS_LOGGING_LEVEL=${CUIRASS_LOGGING_LEVEL:-debug}\n" ...@@ -541,4 +567,6 @@ export CUIRASS_LOGGING_LEVEL=${CUIRASS_LOGGING_LEVEL:-debug}\n"
;; Stop Cuirass when disk space is low. ;; Stop Cuirass when disk space is low.
(service disk-space-watchdog-service-type (service disk-space-watchdog-service-type
(list (* 1 GiB) (* 1 GiB)))) (list (* 1 GiB) (* 1 GiB))))
%garbage-collector-services
%custom-base-services))) %custom-base-services)))
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