@@ -1,5 +1,7 @@
11import ./make-test.nix ({ ... }:
2−let mungekey = "mungeverryweakkeybuteasytointegratoinatest";
2+let
3+ mungekey = "mungeverryweakkeybuteasytointegratoinatest";
4+
35 slurmconfig = {
46 controlMachine = "control";
57 nodeName = ''
@@ -7,6 +9,10 @@ let mungekey = "mungeverryweakkeybuteasytointegratoinatest";
79 NodeName=node[1-3] CPUs=1 State=UNKNOWN
810 '';
911 partitionName = "debug Nodes=node[1-3] Default=YES MaxTime=INFINITE State=UP";
12+ extraConfig = ''
13+ AccountingStorageHost=dbd
14+ AccountingStorageType=accounting_storage/slurmdbd
15+ '';
1016 };
1117in {
1218 name = "slurm";
@@ -16,7 +22,7 @@ in {
1622 computeNode =
1723 { ...}:
1824 {
19− # TODO slrumd port and slurmctld port should be configurations and
25+ # TODO slurmd port and slurmctld port should be configurations and
2026 # automatically allowed by the firewall.
2127 networking.firewall.enable = false;
2228 services.slurm = {
@@ -43,6 +49,24 @@ in {
4349 } // slurmconfig;
4450 };
4551
52+ dbd =
53+ { pkgs, ... } :
54+ {
55+ networking.firewall.enable = false;
56+ services.slurm.dbdserver = {
57+ enable = true;
58+ };
59+ services.mysql = {
60+ enable = true;
61+ package = pkgs.mysql;
62+ ensureDatabases = [ "slurm_acct_db" ];
63+ ensureUsers = [{
64+ ensurePermissions = { "slurm_acct_db.*" = "ALL PRIVILEGES"; };
65+ name = "slurm";
66+ }];
67+ };
68+ };
69+
4670 node1 = computeNode;
4771 node2 = computeNode;
4872 node3 = computeNode;
@@ -54,7 +78,7 @@ in {
5478 startAll;
5579
5680 # Set up authentification across the cluster
57− foreach my $node (($submit,$control,$node1,$node2,$node3))
81+ foreach my $node (($submit,$control,$dbd,$node1,$node2,$node3))
5882 {
5983 $node->waitForUnit("default.target");
6084
@@ -63,10 +87,22 @@ in {
6387 $node->succeed("chmod 0400 /etc/munge/munge.key");
6488 $node->succeed("chown munge:munge /etc/munge/munge.key");
6589 $node->succeed("systemctl restart munged");
66− }
90+
91+ $node->waitForUnit("munged");
92+ };
6793
6894 # Restart the services since they have probably failed due to the munge init
6995 # failure
96+ subtest "can_start_slurmdbd", sub {
97+ $dbd->succeed("systemctl restart slurmdbd");
98+ $dbd->waitForUnit("slurmdbd.service");
99+ };
100+
101+ # there needs to be an entry for the current
102+ # cluster in the database before slurmctld is restarted
103+ subtest "add_account", sub {
104+ $control->succeed("sacctmgr -i add cluster default");
105+ };
70106
71107 subtest "can_start_slurmctld", sub {
72108 $control->succeed("systemctl restart slurmctld");
@@ -81,12 +117,17 @@ in {
81117 }
82118 };
83119
84− # Test that the cluster work and can distribute jobs;
120+ # Test that the cluster works and can distribute jobs;
85121
86122 subtest "run_distributed_command", sub {
87123 # Run `hostname` on 3 nodes of the partition (so on all the 3 nodes).
88124 # The output must contain the 3 different names
89125 $submit->succeed("srun -N 3 hostname | sort | uniq | wc -l | xargs test 3 -eq");
90126 };
127+
128+ subtest "check_slurm_dbd", sub {
129+ # find the srun job from above in the database
130+ $submit->succeed("sacct | grep hostname");
131+ };
91132 '';
92133})