From fca0455c5987c95bbde68ae73afe8b0811b29b72 Mon Sep 17 00:00:00 2001 From: JEAN-FRANCOIS GUILLAUME Date: Fri, 18 Nov 2022 16:23:14 +0100 Subject: [PATCH] updating slurm* services --- glicid/services/parallel.scm | 46 +++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/glicid/services/parallel.scm b/glicid/services/parallel.scm index 3285894..19af28d 100644 --- a/glicid/services/parallel.scm +++ b/glicid/services/parallel.scm @@ -1,6 +1,8 @@ (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 records) #:use-module (ice-9 match) @@ -91,6 +93,24 @@ ) ) +; +; Shared slurm account +; + +(define %slurm-accounts + (list + (user-group (name "slurm") (system? #t)) + (user-account + (name "slurm") + (group "slurm") + (system? #t) + (comment "slurm server user") + (home-directory "/var/spool/slurm") + (shell (file-append bash "/bin/bash")) + ) + ) +) + ; ; slurmdbd ; @@ -123,6 +143,8 @@ "-D" ) #:log-file #$log-file + #:user (passwd:uid (getpwnam "slurm")) + #:group (passwd:gid (getpwnam "slurm")) )) (stop #~(make-kill-destructor)) ) @@ -135,10 +157,15 @@ (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils)) + ;(chmod "0600" "/etc/slurm/slurmdbd.conf") (mkdir-p "/var/log/slurm") (mkdir-p "/var/lib/slurm-archives") (mkdir-p "/var/lib/slurm") - ;(chmod "0600" "/etc/slurm/slurmdbd.conf") + (mkdir-p "/var/spool/slurmctld") + (chown "/var/log/slurm" (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"))) #t ) ) @@ -150,6 +177,7 @@ (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)) ) ) (description "Run slurmdbd") @@ -189,6 +217,8 @@ "-f" #$slurmctld-conf ) #:log-file #$log-file + #:user (passwd:uid (getpwnam "slurm")) + #:group (passwd:gid (getpwnam "slurm")) )) (stop #~(make-kill-destructor)) ) @@ -204,6 +234,11 @@ (mkdir-p "/var/log/slurm") (mkdir-p "/var/lib/slurm-archives") (mkdir-p "/var/lib/slurm") + (mkdir-p "/var/spool/slurmctld") + (chown "/var/log/slurm" (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"))) #t ) ) @@ -215,6 +250,7 @@ (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") @@ -287,6 +323,8 @@ ) #:log-file #$log-file + #:user (passwd:uid (getpwnam "slurm")) + #:group (passwd:gid (getpwnam "slurm")) )) (stop #~(make-kill-destructor)) ) @@ -302,6 +340,11 @@ (mkdir-p "/var/log/slurm") (mkdir-p "/var/lib/slurm-archives") (mkdir-p "/var/lib/slurm") + (mkdir-p "/var/spool/slurmctld") + (chown "/var/log/slurm" (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"))) #t ) ) @@ -313,6 +356,7 @@ (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")