summary refs log tree commit diff
path: root/nixos/modules/services/computing
diff options
context:
space:
mode:
authorArseniy Seroka <ars.seroka@gmail.com>2015-03-02 00:48:20 +0300
committerArseniy Seroka <ars.seroka@gmail.com>2015-03-07 00:26:57 +0300
commit30e6f1b4eaed19848e0e76b550be04320e7ae8b3 (patch)
treefcc02b5e1a2d82b674993a3c35c2c4ad638b45ae /nixos/modules/services/computing
parent0b1cc3cd5198afd07a918d206e3b73ad4ac42930 (diff)
downloadnixlib-30e6f1b4eaed19848e0e76b550be04320e7ae8b3.tar
nixlib-30e6f1b4eaed19848e0e76b550be04320e7ae8b3.tar.gz
nixlib-30e6f1b4eaed19848e0e76b550be04320e7ae8b3.tar.bz2
nixlib-30e6f1b4eaed19848e0e76b550be04320e7ae8b3.tar.lz
nixlib-30e6f1b4eaed19848e0e76b550be04320e7ae8b3.tar.xz
nixlib-30e6f1b4eaed19848e0e76b550be04320e7ae8b3.tar.zst
nixlib-30e6f1b4eaed19848e0e76b550be04320e7ae8b3.zip
slurm: impl basic configuration
Diffstat (limited to 'nixos/modules/services/computing')
-rw-r--r--nixos/modules/services/computing/slurm/slurm.nix69
1 files changed, 50 insertions, 19 deletions
diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix
index 9c8261c6df13..019d7fbb16cd 100644
--- a/nixos/modules/services/computing/slurm/slurm.nix
+++ b/nixos/modules/services/computing/slurm/slurm.nix
@@ -8,7 +8,11 @@ let
   # configuration file can be generated by http://slurm.schedmd.com/configurator.html
   configFile = pkgs.writeText "slurm.conf" 
     ''
-    ${cfg.extraConfig}
+      ${optionalString (cfg.controlMachine != null) ''controlMachine=${cfg.controlMachine}''}
+      ${optionalString (cfg.controlAddr != null) ''controlAddr=${cfg.controlAddr}''}
+      ${optionalString (cfg.nodeName != null) ''nodeName=${cfg.nodeName}''}
+      ${optionalString (cfg.partitionName != null) ''partitionName=${cfg.partitionName}''}
+      ${cfg.extraConfig}
     '';
 in
 
@@ -21,27 +25,57 @@ in
     services.slurm = {
 
       server = {
-        enable = mkOption {
-          default = false;
-          type = types.bool;
-          description = ''
-            Whether to enable slurm control daemon.
-          '';
-        };
+        enable = mkEnableOption "slurm control daemon";
 
       };
       
       client = {
-        enable = mkOption {
-          default = false;
-          type = types.bool;
-          description = ''
-            Whether to enable slurm client daemon.
-          '';
-        };
+        enable = mkEnableOption "slurm rlient daemon";
 
       };
 
+      controlMachine = mkOption {
+        type = types.nullOr types.str;
+        default = null;
+        example = null;
+        description = ''
+          The short hostname of the machine where SLURM control functions are
+          executed (i.e. the name returned by the command "hostname -s", use "tux001"
+          rather than "tux001.my.com").
+        '';
+      };
+
+      controlAddr = mkOption {
+        type = types.nullOr types.str;
+        default = cfg.controlMachine;
+        example = null;
+        description = ''
+          Name that ControlMachine should be referred to in establishing a
+          communications path.
+        '';
+      };
+
+      nodeName = mkOption {
+        type = types.nullOr types.str;
+        default = null;
+        example = "linux[1-32] CPUs=1 State=UNKNOWN";
+        description = ''
+          Name that SLURM uses to refer to a node (or base partition for BlueGene
+          systems). Typically this would be the string that "/bin/hostname -s"
+          returns. Note that now you have to write node's parameters after the name.
+        '';
+      };
+
+      partitionName = mkOption {
+        type = types.nullOr types.str;
+        default = null;
+        example = "debug Nodes=linux[1-32] Default=YES MaxTime=INFINITE State=UP";
+        description = ''
+          Name by which the partition may be referenced. Note that now you have
+          to write patrition's parameters after the name.
+        '';
+      };
+
       extraConfig = mkOption {
         default = ""; 
         type = types.lines;
@@ -50,7 +84,6 @@ in
           the end of the slurm configuration file.
         '';
       };
-
     };
 
   };
@@ -64,7 +97,7 @@ in
 
     systemd.services.slurmd = mkIf (cfg.client.enable) {
       path = with pkgs; [ slurm-llnl coreutils ];
-      
+
       wantedBy = [ "multi-user.target" ];
       after = [ "systemd-tmpfiles-clean.service" ];
 
@@ -73,7 +106,6 @@ in
         ExecStart = "${pkgs.slurm-llnl}/bin/slurmd -f ${configFile}";
         PIDFile = "/run/slurmd.pid";
         ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
-        ExecStop = "${pkgs.coreutils}/bin/kill $MAINPID";
       };
     };
 
@@ -89,7 +121,6 @@ in
         ExecStart = "${pkgs.slurm-llnl}/bin/slurmctld";
         PIDFile = "/run/slurmctld.pid";
         ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
-        ExecStop = "${pkgs.coreutils}/bin/kill $MAINPID";
       };
       environment = { SLURM_CONF = "${configFile}"; };
     };