From 79c9dbfb40d5123f18ed64485265d8bc19209091 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Sat, 15 Sep 2018 13:09:36 +0200 Subject: nixos/slurm: add slurmdbd to module * New options "services.slurm.dbdserver.[enable,config]" * Add slurmdbd to test slurm.nix --- nixos/modules/services/computing/slurm/slurm.nix | 55 +++++++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'nixos/modules/services/computing') diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix index 9dbb6a4d0d93..77b9c40577a3 100644 --- a/nixos/modules/services/computing/slurm/slurm.nix +++ b/nixos/modules/services/computing/slurm/slurm.nix @@ -29,12 +29,19 @@ let ${cfg.extraPlugstackConfig} ''; - cgroupConfig = pkgs.writeTextDir "cgroup.conf" '' ${cfg.extraCgroupConfig} ''; + slurmdbdConf = pkgs.writeTextDir "slurmdbd.conf" + '' + DbdHost=${cfg.dbdserver.dbdHost} + SlurmUser=${cfg.user} + StorageType=accounting_storage/mysql + ${cfg.dbdserver.extraConfig} + ''; + # slurm expects some additional config files to be # in the same directory as slurm.conf etcSlurm = pkgs.symlinkJoin { @@ -65,6 +72,27 @@ in }; }; + dbdserver = { + enable = mkEnableOption "SlurmDBD service"; + + dbdHost = mkOption { + type = types.str; + default = config.networking.hostName; + description = '' + Hostname of the machine where slurmdbd + is running (i.e. name returned by hostname -s). + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Extra configuration for slurmdbd.conf + ''; + }; + }; + client = { enable = mkEnableOption "slurm client daemon"; }; @@ -208,6 +236,8 @@ in used when procTrackType=proctrack/cgroup. ''; }; + + }; }; @@ -244,7 +274,10 @@ in ''; }; - in mkIf (cfg.enableStools || cfg.client.enable || cfg.server.enable) { + in mkIf ( cfg.enableStools || + cfg.client.enable || + cfg.server.enable || + cfg.dbdserver.enable ) { environment.systemPackages = [ wrappedSlurm ]; @@ -301,6 +334,24 @@ in ''; }; + systemd.services.slurmdbd = mkIf (cfg.dbdserver.enable) { + path = with pkgs; [ wrappedSlurm munge coreutils ]; + + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" "munged.service" "mysql.service" ]; + requires = [ "munged.service" "mysql.service" ]; + + # slurm strips the last component off the path + environment.SLURM_CONF = "${slurmdbdConf}/slurm.conf"; + + serviceConfig = { + Type = "forking"; + ExecStart = "${cfg.package}/bin/slurmdbd"; + PIDFile = "/run/slurmdbd.pid"; + ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; + }; + }; + }; } -- cgit 1.4.1