tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
slurm service: add tests
Lancelot SIX
10 years ago
4994f0f7
ca4c3547
+80
1 changed file
expand all
collapse all
unified
split
nixos
tests
slurm.nix
+80
nixos/tests/slurm.nix
···
1
1
+
import ./make-test.nix ({ pkgs, ... }:
2
2
+
let mungekey = "mungeverryweakkeybuteasytointegratoinatest";
3
3
+
slurmconfig = {
4
4
+
client.enable = true;
5
5
+
controlMachine = "control";
6
6
+
nodeName = ''
7
7
+
control
8
8
+
NodeName=node[1-3] CPUs=1 State=UNKNOWN
9
9
+
'';
10
10
+
partitionName = "debug Nodes=node[1-3] Default=YES MaxTime=INFINITE State=UP";
11
11
+
};
12
12
+
in {
13
13
+
name = "slurm";
14
14
+
15
15
+
nodes =
16
16
+
let
17
17
+
computeNode =
18
18
+
{ config, pkgs, ...}:
19
19
+
{
20
20
+
# TODO slrumd port and slurmctld port should be configurations and
21
21
+
# automatically allowed by the firewall.
22
22
+
networking.firewall.enable = false;
23
23
+
services.munge.enable = true;
24
24
+
services.slurm = slurmconfig;
25
25
+
};
26
26
+
in {
27
27
+
control =
28
28
+
{ config, pkgs, ...}:
29
29
+
{
30
30
+
networking.firewall.enable = false;
31
31
+
services.munge.enable = true;
32
32
+
services.slurm = {
33
33
+
server.enable = true;
34
34
+
} // slurmconfig;
35
35
+
};
36
36
+
node1 = computeNode;
37
37
+
node2 = computeNode;
38
38
+
node3 = computeNode;
39
39
+
};
40
40
+
41
41
+
testScript =
42
42
+
''
43
43
+
startAll;
44
44
+
45
45
+
# Set up authentification across the cluster
46
46
+
foreach my $node (($control,$node1,$node2,$node3))
47
47
+
{
48
48
+
$node->waitForUnit("default.target");
49
49
+
50
50
+
$node->succeed("mkdir /etc/munge");
51
51
+
$node->succeed("echo '${mungekey}' > /etc/munge/munge.key");
52
52
+
$node->succeed("chmod 0400 /etc/munge/munge.key");
53
53
+
$node->succeed("systemctl restart munged");
54
54
+
}
55
55
+
56
56
+
# Restart the services since they have probably failed due to the munge init
57
57
+
# failure
58
58
+
59
59
+
subtest "can_start_slurmctld", sub {
60
60
+
$control->succeed("systemctl restart slurmctld");
61
61
+
$control->waitForUnit("slurmctld.service");
62
62
+
};
63
63
+
64
64
+
subtest "can_start_slurmd", sub {
65
65
+
foreach my $node (($control,$node1,$node2,$node3))
66
66
+
{
67
67
+
$node->succeed("systemctl restart slurmd.service");
68
68
+
$node->waitForUnit("slurmd");
69
69
+
}
70
70
+
};
71
71
+
72
72
+
# Test that the cluster work and can distribute jobs;
73
73
+
74
74
+
subtest "run_distributed_command", sub {
75
75
+
# Run `hostname` on 3 nodes of the partition (so on all the 3 nodes).
76
76
+
# The output must contain the 3 different names
77
77
+
$control->succeed("srun -N 3 hostname | sort | uniq | wc -l | xargs test 3 -eq");
78
78
+
};
79
79
+
'';
80
80
+
})