Skip to content

Commit d945043

Browse files
author
Vasileios Karakasis
committed
Fine tune Slurm tests
- Also make hostname pattern check more precise to avoid false matches with the output from job report
1 parent 0fe5835 commit d945043

File tree

1 file changed

+28
-37
lines changed

1 file changed

+28
-37
lines changed

cscs-checks/system/slurm/slurm.py

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,68 +2,60 @@
22
import reframe.utility.sanity as sn
33

44

5-
# Base class for Slurm simple binary tests
65
class SlurmSimpleBaseCheck(rfm.RunOnlyRegressionTest):
6+
'''Base class for Slurm simple binary tests'''
7+
78
def __init__(self):
8-
super().__init__()
99
self.valid_systems = ['daint:gpu', 'daint:mc',
1010
'dom:gpu', 'dom:mc',
1111
'kesch:cn', 'kesch:pn']
1212
self.valid_prog_environs = ['PrgEnv-cray']
13-
self.tags = {'slurm', 'maintenance', 'ops', 'production'}
13+
self.tags = {'slurm', 'maintenance', 'ops',
14+
'production', 'single-node'}
1415
self.num_tasks_per_node = 1
1516
if self.current_system.name == 'kesch':
1617
self.exclusive_access = True
1718

1819
self.maintainers = ['RS', 'VK']
1920

20-
@rfm.run_before('setup')
21-
def setup_slurm(self):
22-
if self.num_tasks == 1:
23-
self.tags.add('single-node')
24-
25-
# Base class for Slurm tests that require compiling some code
26-
2721

2822
class SlurmCompiledBaseCheck(rfm.RegressionTest):
23+
'''Base class for Slurm tests that require compiling some code'''
24+
2925
def __init__(self):
30-
super().__init__()
3126
self.valid_systems = ['daint:gpu', 'daint:mc',
3227
'dom:gpu', 'dom:mc',
3328
'kesch:cn', 'kesch:pn']
3429
self.valid_prog_environs = ['PrgEnv-cray']
35-
self.tags = {'slurm', 'maintenance', 'ops', 'production'}
30+
self.tags = {'slurm', 'maintenance', 'ops',
31+
'production', 'single-node'}
3632
self.num_tasks_per_node = 1
3733
if self.current_system.name == 'kesch':
3834
self.exclusive_access = True
3935

4036
self.maintainers = ['RS', 'VK']
4137

42-
@rfm.run_before('setup')
43-
def setup_slurm(self):
44-
if self.num_tasks == 1:
45-
self.tags.add('single-node')
46-
4738

4839
@rfm.simple_test
4940
class HostnameCheck(SlurmSimpleBaseCheck):
5041
def __init__(self):
5142
super().__init__()
5243
self.executable = '/bin/hostname'
53-
self.hostname_string = {
54-
'kesch:cn': r'keschcn-\d{4}\b',
55-
'kesch:pn': r'keschpn-\d{4}\b',
56-
'daint:gpu': r'nid\d{5}\b',
57-
'daint:mc': r'nid\d{5}\b',
58-
'dom:gpu': r'nid\d{5}\b',
59-
'dom:mc': r'nid\d{5}\b',
44+
self.hostname_patt = {
45+
'kesch:cn': r'^keschcn-\d{4}$',
46+
'kesch:pn': r'^keschpn-\d{4}$',
47+
'daint:gpu': r'^nid\d{5}$',
48+
'daint:mc': r'^nid\d{5}$',
49+
'dom:gpu': r'^nid\d{5}$',
50+
'dom:mc': r'^nid\d{5}$',
6051
}
6152

62-
@rfm.run_after('setup')
63-
def setup_slurm(self):
64-
num_matches = sn.count(sn.findall(
65-
self.hostname_string[self.current_partition.fullname],
66-
self.stdout))
53+
@rfm.run_before('sanity')
54+
def set_sanity_patterns(self):
55+
partname = self.current_partition.fullname
56+
num_matches = sn.count(
57+
sn.findall(self.hostname_patt[partname], self.stdout)
58+
)
6759
self.sanity_patterns = sn.assert_eq(self.num_tasks, num_matches)
6860

6961

@@ -78,6 +70,7 @@ def __init__(self):
7870
self.executable = '/bin/echo'
7971
self.executable_opts = ['$MY_VAR']
8072
self.variables = {'MY_VAR': 'TEST123456!'}
73+
self.tags.remove('single-node')
8174
num_matches = sn.count(sn.findall(r'TEST123456!', self.stdout))
8275
self.sanity_patterns = sn.assert_eq(self.num_tasks, num_matches)
8376

@@ -106,8 +99,8 @@ def __init__(self):
10699
self.stdout, 'mem', float)
107100
self.sanity_patterns = sn.assert_bounded(mem_obtained, 122.0, 128.0)
108101

109-
@rfm.run_after('setup')
110-
def setup_slurm(self):
102+
@rfm.run_before('run')
103+
def set_memory_limit(self):
111104
self.job.options += ['--mem=120000']
112105

113106

@@ -151,10 +144,8 @@ def __init__(self):
151144
self.executable = 'cat /proc/cray_xt/cname'
152145
self.sanity_patterns = sn.assert_found(r'c0-0.*', self.stdout)
153146

154-
# we override setup function to pass additional
155-
# options to Slurm
156-
@rfm.run_after('setup')
157-
def setup_slurm(self):
147+
@rfm.run_before('run')
148+
def set_slurm_constraint(self):
158149
self.job.options = ['--constraint=c0-0']
159150

160151

@@ -170,6 +161,6 @@ def __init__(self):
170161
r'(exceeded memory limit)|(Out Of Memory)', self.stderr
171162
)
172163

173-
@rfm.run_after('setup')
174-
def setup_slurm(self):
164+
@rfm.run_before('run')
165+
def set_memory_limit(self):
175166
self.job.options += ['--mem=2000']

0 commit comments

Comments
 (0)