slurm: impl basic configuration

+50 -19
+50 -19
nixos/modules/services/computing/slurm/slurm.nix
··· 8 # configuration file can be generated by http://slurm.schedmd.com/configurator.html 9 configFile = pkgs.writeText "slurm.conf" 10 '' 11 - ${cfg.extraConfig} 12 ''; 13 in 14 ··· 21 services.slurm = { 22 23 server = { 24 - enable = mkOption { 25 - default = false; 26 - type = types.bool; 27 - description = '' 28 - Whether to enable slurm control daemon. 29 - ''; 30 - }; 31 32 }; 33 34 client = { 35 - enable = mkOption { 36 - default = false; 37 - type = types.bool; 38 - description = '' 39 - Whether to enable slurm client daemon. 40 - ''; 41 - }; 42 43 }; 44 45 extraConfig = mkOption { ··· 50 the end of the slurm configuration file. 51 ''; 52 }; 53 - 54 }; 55 56 }; ··· 64 65 systemd.services.slurmd = mkIf (cfg.client.enable) { 66 path = with pkgs; [ slurm-llnl coreutils ]; 67 - 68 wantedBy = [ "multi-user.target" ]; 69 after = [ "systemd-tmpfiles-clean.service" ]; 70 ··· 73 ExecStart = "${pkgs.slurm-llnl}/bin/slurmd -f ${configFile}"; 74 PIDFile = "/run/slurmd.pid"; 75 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; 76 - ExecStop = "${pkgs.coreutils}/bin/kill $MAINPID"; 77 }; 78 }; 79 ··· 89 ExecStart = "${pkgs.slurm-llnl}/bin/slurmctld"; 90 PIDFile = "/run/slurmctld.pid"; 91 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; 92 - ExecStop = "${pkgs.coreutils}/bin/kill $MAINPID"; 93 }; 94 environment = { SLURM_CONF = "${configFile}"; }; 95 };
··· 8 # configuration file can be generated by http://slurm.schedmd.com/configurator.html 9 configFile = pkgs.writeText "slurm.conf" 10 '' 11 + ${optionalString (cfg.controlMachine != null) ''controlMachine=${cfg.controlMachine}''} 12 + ${optionalString (cfg.controlAddr != null) ''controlAddr=${cfg.controlAddr}''} 13 + ${optionalString (cfg.nodeName != null) ''nodeName=${cfg.nodeName}''} 14 + ${optionalString (cfg.partitionName != null) ''partitionName=${cfg.partitionName}''} 15 + ${cfg.extraConfig} 16 ''; 17 in 18 ··· 25 services.slurm = { 26 27 server = { 28 + enable = mkEnableOption "slurm control daemon"; 29 30 }; 31 32 client = { 33 + enable = mkEnableOption "slurm rlient daemon"; 34 + 35 + }; 36 + 37 + controlMachine = mkOption { 38 + type = types.nullOr types.str; 39 + default = null; 40 + example = null; 41 + description = '' 42 + The short hostname of the machine where SLURM control functions are 43 + executed (i.e. the name returned by the command "hostname -s", use "tux001" 44 + rather than "tux001.my.com"). 45 + ''; 46 + }; 47 + 48 + controlAddr = mkOption { 49 + type = types.nullOr types.str; 50 + default = cfg.controlMachine; 51 + example = null; 52 + description = '' 53 + Name that ControlMachine should be referred to in establishing a 54 + communications path. 55 + ''; 56 + }; 57 58 + nodeName = mkOption { 59 + type = types.nullOr types.str; 60 + default = null; 61 + example = "linux[1-32] CPUs=1 State=UNKNOWN"; 62 + description = '' 63 + Name that SLURM uses to refer to a node (or base partition for BlueGene 64 + systems). Typically this would be the string that "/bin/hostname -s" 65 + returns. Note that now you have to write node's parameters after the name. 66 + ''; 67 + }; 68 + 69 + partitionName = mkOption { 70 + type = types.nullOr types.str; 71 + default = null; 72 + example = "debug Nodes=linux[1-32] Default=YES MaxTime=INFINITE State=UP"; 73 + description = '' 74 + Name by which the partition may be referenced. Note that now you have 75 + to write patrition's parameters after the name. 76 + ''; 77 }; 78 79 extraConfig = mkOption { ··· 84 the end of the slurm configuration file. 85 ''; 86 }; 87 }; 88 89 }; ··· 97 98 systemd.services.slurmd = mkIf (cfg.client.enable) { 99 path = with pkgs; [ slurm-llnl coreutils ]; 100 + 101 wantedBy = [ "multi-user.target" ]; 102 after = [ "systemd-tmpfiles-clean.service" ]; 103 ··· 106 ExecStart = "${pkgs.slurm-llnl}/bin/slurmd -f ${configFile}"; 107 PIDFile = "/run/slurmd.pid"; 108 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; 109 }; 110 }; 111 ··· 121 ExecStart = "${pkgs.slurm-llnl}/bin/slurmctld"; 122 PIDFile = "/run/slurmctld.pid"; 123 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; 124 }; 125 environment = { SLURM_CONF = "${configFile}"; }; 126 };