From 5d77b3c76adb79cfc2d290f0cdea64bd64d03e63 Mon Sep 17 00:00:00 2001 From: JEAN-FRANCOIS GUILLAUME Date: Tue, 10 Jan 2023 11:17:38 +0100 Subject: [PATCH] never use guix reformater again --- glicid/services/parallel.scm | 278 ++++++++++++----------------------- 1 file changed, 93 insertions(+), 185 deletions(-) diff --git a/glicid/services/parallel.scm b/glicid/services/parallel.scm index 02a416f..a0d0ede 100644 --- a/glicid/services/parallel.scm +++ b/glicid/services/parallel.scm @@ -1,45 +1,42 @@ (define-module (glicid services parallel) - #:use-module (gnu packages bash) - #:use-module (gnu services) - #:use-module (gnu services shepherd) - #:use-module (gnu system shadow) - #:use-module (guix) - #:use-module (guix build utils) - #:use-module (guix records) - #:use-module (ice-9 match) - #:use-module (gnu packages parallel) - #:use-module (glicid system file-systems) - #:use-module (glicid utils) - #:export (munged-configuration munged-configuration? - munged-service - munged-service-type - slurmdbd-configuration - slurmdbd-configuration? - slurmdbd-service - slurmdbd-service-type - slurmctld-configuration - slurmctld-configuration? - slurmctld-service - slurmctld-service-type - slurmd-configuration - slurmd-configuration? - slurmd-service - slurmd-service-type - %slurm-group - %slurm-account - %slurm-accounts)) + #:use-module (gnu packages bash) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (gnu system shadow) + #:use-module (guix) + #:use-module (guix build utils) + #:use-module (guix records) + #:use-module (ice-9 match) + #:use-module (gnu packages parallel) + #:use-module (glicid system file-systems) + #:use-module (glicid utils) + #:export (munged-configuration munged-configuration? + munged-service + munged-service-type + slurmdbd-configuration + slurmdbd-configuration? + slurmdbd-service + slurmdbd-service-type + slurmctld-configuration + slurmctld-configuration? + slurmctld-service + slurmctld-service-type + slurmd-configuration + slurmd-configuration? + slurmd-service + slurmd-service-type + %slurm-group + %slurm-account + %slurm-accounts)) ; ; Munged ; (define-record-type* munged-configuration make-munged-configuration - munged-configuration? - (munge munge-configuration-munge - (default munge)) - (key-file munged-key-file - (default (file-append munge "/etc/munge/munged.key"))) - (log-file munged-log-file - (default "/var/log/munged.log"))) + munged-configuration? + (munge munge-configuration-munge (default munge)) + (key-file munged-key-file (default (file-append munge "/etc/munge/munged.key"))) + (log-file munged-log-file (default "/var/log/munged.log"))) (define munged-service (match-lambda @@ -48,12 +45,9 @@ (documentation "Run munged.") (requirement '(user-processes)) (respawn? #t) - (start #~(make-forkexec-constructor (list #$(file-append - munge - "/sbin/munged") - "-F" "-f" - "--key-file" - #$key-file) + (start #~(make-forkexec-constructor (list #$(file-append munge "/sbin/munged") + "-F" "-f" + "--key-file" #$key-file) #:log-file #$log-file)) (stop #~(make-kill-destructor))))))) @@ -64,10 +58,8 @@ (define munged-service-type (service-type (name 'munged) - (extensions (list (service-extension - shepherd-root-service-type munged-service) - (service-extension activation-service-type - (const %munged-activation)))) + (extensions (list (service-extension shepherd-root-service-type munged-service) + (service-extension activation-service-type (const %munged-activation)))) (description "Run munged"))) ; @@ -96,13 +88,10 @@ ; (define-record-type* slurmdbd-configuration make-slurmdbd-configuration - slurmdbd-configuration? - (slurm slurm - (default slurm)) - (slurmdbd-conf slurmdbd-conf - (default (file-append slurm "/etc/slurm/slurmdbd.conf"))) - (log-file log-file - (default "/var/log/slurm/slurmdbd.log"))) + slurmdbd-configuration? + (slurm slurm (default slurm)) + (slurmdbd-conf slurmdbd-conf (default (file-append slurm "/etc/slurm/slurmdbd.conf"))) + (log-file log-file (default "/var/log/slurm/slurmdbd.log"))) (define slurmdbd-service (match-lambda @@ -111,17 +100,11 @@ (documentation "Run slurmdbd.") (requirement '(user-processes)) (respawn? #t) - (start #~(make-forkexec-constructor (list #$(file-append - slurm - "/sbin/slurmdbd") + (start #~(make-forkexec-constructor (list #$(file-append slurm "/sbin/slurmdbd") "-D") #:log-file #$log-file - #:user (passwd:uid - (getpwnam - "slurm")) - #:group (passwd:gid - (getpwnam - "slurm")))) + #:user (passwd:uid (getpwnam "slurm")) + #:group (passwd:gid (getpwnam "slurm")))) (stop #~(make-kill-destructor))))))) (define %slurmdbd-activation @@ -133,44 +116,24 @@ (mkdir-p "/var/spool/slurmctld") (touch "/var/log/slurm/slurmdbd.log") (touch "/var/run/slurmdbd.pid") - (chown "/var/run/slurmdbd.pid" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) - (chown "/var/log/slurm" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) - (chown "/var/log/slurm/slurmdbd.log" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) - (chown "/var/lib/slurm-archives" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) - (chown "/var/lib/slurm" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) - (chown "/var/spool/slurmctld" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) - (chown "/etc/slurm" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) + (chown "/var/run/slurmdbd.pid" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) + (chown "/var/log/slurm" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) + (chown "/var/log/slurm/slurmdbd.log" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) + (chown "/var/lib/slurm-archives" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) + (chown "/var/lib/slurm" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) + (chown "/var/spool/slurmctld" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) + (chown "/etc/slurm" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) (for-each (lambda (slurm-file) - (chown slurm-file - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) + (chown slurm-file (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) (chmod slurm-file #o600)) - (find-files "/etc/slurm/")) - #t)) + (find-files "/etc/slurm/")) #t)) (define slurmdbd-service-type (service-type (name 'slurmdbd) (extensions (list (service-extension - shepherd-root-service-type slurmdbd-service) - (service-extension activation-service-type - (const - %slurmdbd-activation)) - (service-extension account-service-type - (const %slurm-accounts)))) + shepherd-root-service-type slurmdbd-service) + (service-extension activation-service-type (const %slurmdbd-activation)) + (service-extension account-service-type (const %slurm-accounts)))) (description "Run slurmdbd"))) ; @@ -178,13 +141,10 @@ ; (define-record-type* slurmctld-configuration make-slurmctld-configuration - slurmctld-configuration? - (slurm slurm - (default slurm)) - (slurmctld-conf slurmctld-conf - (default (file-append slurm "/etc/slurm/slurmctld.conf"))) - (log-file log-file - (default "/var/log/slurm/slurmctld.log"))) + slurmctld-configuration? + (slurm slurm (default slurm)) + (slurmctld-conf slurmctld-conf (default (file-append slurm "/etc/slurm/slurmctld.conf"))) + (log-file log-file (default "/var/log/slurm/slurmctld.log"))) (define slurmctld-service (match-lambda @@ -193,20 +153,14 @@ (documentation "Run slurmctld.") (requirement '(user-processes)) (respawn? #t) - (start #~(make-forkexec-constructor (list #$(file-append - slurm - "/sbin/slurmctld") + (start #~(make-forkexec-constructor (list #$(file-append slurm "/sbin/slurmctld") "-D" "-R" "-f" #$slurmctld-conf) #:log-file #$log-file - #:user (passwd:uid - (getpwnam - "slurm")) - #:group (passwd:gid - (getpwnam - "slurm")))) + #:user (passwd:uid (getpwnam "slurm")) + #:group (passwd:gid (getpwnam "slurm")))) (stop #~(make-kill-destructor))))))) (define %slurmctld-activation @@ -218,45 +172,23 @@ (mkdir-p "/var/spool/slurmctld") (touch "/var/log/slurm/slurmctld.log") (touch "/var/run/slurmctld.pid") - (chown "/var/log/slurm" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) - (chown "/var/log/slurm/slurmctld.log" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) - (chown "/var/run/slurmctld.pid" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) - (chown "/var/lib/slurm-archives" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) - (chown "/var/lib/slurm" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) - (chown "/var/spool/slurmctld" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) - (chown "/etc/slurm" - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) + (chown "/var/log/slurm" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) + (chown "/var/log/slurm/slurmctld.log" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) + (chown "/var/run/slurmctld.pid" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) + (chown "/var/lib/slurm-archives" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) + (chown "/var/lib/slurm" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) + (chown "/var/spool/slurmctld" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) + (chown "/etc/slurm" (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) (for-each (lambda (slurm-file) - (chown slurm-file - (passwd:uid (getpwnam "slurm")) - (passwd:gid (getpwnam "slurm"))) + (chown slurm-file (passwd:uid (getpwnam "slurm")) (passwd:gid (getpwnam "slurm"))) (chmod slurm-file #o600)) - (find-files "/etc/slurm/")) - #t)) + (find-files "/etc/slurm/")) #t)) (define slurmctld-service-type (service-type (name 'slurmctld) - (extensions (list (service-extension - shepherd-root-service-type - slurmctld-service) - (service-extension activation-service-type - (const - %slurmctld-activation)) - (service-extension account-service-type - (const %slurm-accounts)))) + (extensions (list (service-extension shepherd-root-service-type slurmctld-service) + (service-extension activation-service-type (const %slurmctld-activation)) + (service-extension account-service-type (const %slurm-accounts)))) (description "Run slurmctld"))) ; @@ -264,49 +196,28 @@ ; (define-record-type* slurmd-configuration make-slurmd-configuration - slurmd-configuration? - (slurm slurm - (default slurm)) - (slurmd-conf slurmd-conf - (default (file-append slurm "/etc/slurm/slurm.conf"))) - (log-file log-file - (default "/var/log/slurm/slurmd.log")) - (slurmctld-host slurmctld-host - (default #f)) - (log-level log-level - (default #f))) + slurmd-configuration? + (slurm slurm (default slurm)) + (slurmd-conf slurmd-conf (default (file-append slurm "/etc/slurm/slurm.conf"))) + (log-file log-file (default "/var/log/slurm/slurmd.log")) + (slurmctld-host slurmctld-host (default #f)) + (log-level log-level (default #f))) (define slurmd-service (match-lambda - (($ - slurm - slurmd-conf - slurmctld-host - log-file - log-level) + (($ slurm slurmd-conf slurmctld-host log-file log-level) (list (shepherd-service (provision '(slurmd)) (documentation "Run slurmd.") (requirement '(user-processes)) (respawn? #t) - (start #~(make-forkexec-constructor (list #$(file-append - slurm - "/sbin/slurmd") + (start #~(make-forkexec-constructor (list #$(file-append slurm "/sbin/slurmd") "-D" - #$@(if - slurmctld-host - (list - (string-append - "--conf-server" - slurmctld-host)) - (list - (string-append - "-f" - slurmd-conf))) - #$@(if - log-level - (list - log-level) - '())) + #$@(if slurmctld-host + (list (string-append "--conf-server" slurmctld-host)) + (list (string-append "-f" slurmd-conf))) + #$@(if log-level + (list log-level) + '())) #:log-file #$log-file)) (stop #~(make-kill-destructor))))))) @@ -323,10 +234,7 @@ (define slurmd-service-type (service-type (name 'slurmd) - (extensions (list (service-extension - shepherd-root-service-type slurmd-service) - (service-extension activation-service-type - (const %slurmd-activation)) - (service-extension account-service-type - (const %slurm-accounts)))) + (extensions (list (service-extension shepherd-root-service-type slurmd-service) + (service-extension activation-service-type (const %slurmd-activation)) + (service-extension account-service-type (const %slurm-accounts)))) (description "Run slurmd")))