6
6
import osgtest .library .service as service
7
7
8
8
CLUSTER_NAME = 'osg_test'
9
- CTLD_LOG = '/var/log/slurm/slurmctld.log'
10
- SLURM_LOG = '/var/log/slurm/slurm.log'
9
+ SLURM_LOG_DIR = '/var/log/slurm/'
10
+ CTLD_LOG = SLURM_LOG_DIR + 'slurmctld.log'
11
+ SLURM_LOG = SLURM_LOG_DIR + 'slurm.log'
12
+ SLURMDBD_LOG = SLURM_LOG_DIR + 'slurmdbd.log'
11
13
SHORT_HOSTNAME = core .get_hostname ().split ('.' )[0 ]
12
14
13
15
SLURMDBD_CONFIG = """AuthType=auth/munge
14
16
DbdHost=localhost
15
- SlurmUser=slurm
16
17
DebugLevel=debug5
17
18
LogFile=/var/log/slurm/slurmdbd.log
18
19
StorageType=accounting_storage/mysql
19
- StorageLoc=%(name)s
20
- StorageUser=%(user)s
21
- StoragePass=%(pass)s
20
+ StorageLoc={name}
21
+ StorageUser={user}
22
+ StoragePass={password}
23
+ StoragePort={port}
22
24
"""
23
25
24
26
SLURM_CONFIG = """AccountingStorageHost=localhost
25
- AccountingStorageLoc=/tmp/slurm_job_accounting.txt
26
27
AccountingStorageType=accounting_storage/slurmdbd
27
28
AuthType=auth/munge
28
- ClusterName=%( cluster)s
29
- ControlMachine=%( short_hostname)s
29
+ ClusterName={ cluster}
30
+ ControlMachine={ short_hostname}
30
31
JobAcctGatherType=jobacct_gather/linux
31
32
KillWait=30
32
- NodeName=%( short_hostname)s Procs=1 RealMemory=128 State=UNKNOWN
33
- PartitionName=debug Nodes=%( short_hostname)s Default=YES MaxTime=INFINITE State=UP
33
+ NodeName={ short_hostname} Procs=1 RealMemory=128 State=UNKNOWN
34
+ PartitionName=debug Nodes={ short_hostname} Default=YES MaxTime=INFINITE State=UP
34
35
ReturnToService=2
35
- SlurmUser=slurm
36
36
SlurmctldDebug=debug5
37
37
SlurmctldTimeout=300
38
- SlurmctldLogFile=%( ctld_log)s
38
+ SlurmctldLogFile={ ctld_log}
39
39
SlurmdLogFile=/var/log/slurm/slurm.log
40
40
SlurmdDebug=debug5
41
41
StateSaveLocation=/var/spool/slurmd
@@ -64,13 +64,12 @@ def slurm_reqs(self):
64
64
65
65
def test_01_slurm_config (self ):
66
66
self .slurm_reqs ()
67
- if core .PackageVersion ('slurm' ) >= '19.05.2' :
68
- core .config ['slurm.config-dir' ] = '/etc'
69
- else :
70
- core .config ['slurm.config-dir' ] = '/etc/slurm'
67
+ core .config ['slurm.config-dir' ] = '/etc/slurm'
71
68
core .config ['slurm.config' ] = os .path .join (core .config ['slurm.config-dir' ], 'slurm.conf' )
72
69
files .write (core .config ['slurm.config' ],
73
- SLURM_CONFIG % {'short_hostname' : SHORT_HOSTNAME , 'cluster' : CLUSTER_NAME , 'ctld_log' : CTLD_LOG },
70
+ SLURM_CONFIG .format (short_hostname = SHORT_HOSTNAME ,
71
+ cluster = CLUSTER_NAME ,
72
+ ctld_log = CTLD_LOG ),
74
73
owner = 'slurm' ,
75
74
chmod = 0o644 )
76
75
core .config ['cgroup.config' ] = os .path .join (core .config ['slurm.config-dir' ], 'cgroup.conf' )
@@ -91,8 +90,8 @@ def test_01_slurm_config(self):
91
90
92
91
def test_02_start_slurmdbd (self ):
93
92
core .state ['slurmdbd.started-service' ] = False
93
+ core .state ['slurmdbd.ready' ] = False
94
94
self .slurm_reqs ()
95
- core .skip_ok_unless_installed ('slurm-slurmdbd' )
96
95
self .skip_bad_unless (mysql .is_running (), 'slurmdbd requires mysql' )
97
96
core .config ['slurmdbd.config' ] = os .path .join (core .config ['slurm.config-dir' ], 'slurmdbd.conf' )
98
97
core .config ['slurmdbd.user' ] = "'osg-test-slurm'@'localhost'"
@@ -107,38 +106,37 @@ def test_02_start_slurmdbd(self):
107
106
'slurmdb user permissions' )
108
107
mysql .check_execute ("flush privileges;" , 'reload privileges' )
109
108
110
- db_config_vals = {'name' :core .config ['slurmdbd.name' ],
111
- 'user' :core .config ['slurmdbd.user' ].split ('\' ' )[1 ],
112
- 'pass' :core .options .password }
113
109
files .write (core .config ['slurmdbd.config' ],
114
- SLURMDBD_CONFIG % db_config_vals ,
110
+ SLURMDBD_CONFIG .format (name = core .config ['slurmdbd.name' ],
111
+ user = core .config ['slurmdbd.user' ].split ('\' ' )[1 ],
112
+ password = core .options .password ,
113
+ port = mysql .PORT ),
115
114
owner = 'slurm' ,
116
115
chmod = 0o644 )
116
+
117
+ stat = core .get_stat (SLURMDBD_LOG )
117
118
service .check_start ('slurmdbd' )
119
+ sentinel = core .monitor_file (SLURMDBD_LOG , stat , 'slurmdbd version.+started' , 30.0 )
120
+ if sentinel :
121
+ core .state ['slurmdbd.ready' ] = True
118
122
119
123
# Adding the cluster to the database
120
124
command = ('sacctmgr' , '-i' , 'add' , 'cluster' , CLUSTER_NAME )
121
125
core .check_system (command , 'add slurm cluster' )
122
126
123
127
def test_03_start_slurm (self ):
124
- core .config ['slurm.service-name' ] = 'slurm'
125
- if core .el_release () >= 7 :
126
- core .config ['slurm.service-name' ] += 'd'
127
- core .config ['slurm.ctld-service-name' ] = 'slurmctld'
128
+ core .config ['slurm.service-name' ] = 'slurmd'
129
+ core .config ['slurm.ctld-service-name' ] = 'slurmctld'
128
130
core .state ['%s.started-service' % core .config ['slurm.service-name' ]] = False
129
131
self .slurm_reqs ()
130
132
self .skip_ok_if (service .is_running (core .config ['slurm.service-name' ]), 'slurm already running' )
131
133
132
134
stat = core .get_stat (CTLD_LOG )
133
135
134
- if core .el_release () >= 7 :
135
- # slurmctld is handled by /etc/init.d/slurm on EL6
136
- command = ['slurmctld' ]
137
- core .check_system (command , 'enable slurmctld' )
138
- service .check_start (core .config ['slurm.service-name' ])
139
- service .check_start (core .config ['slurm.ctld-service-name' ])
140
- else :
141
- service .check_start (core .config ['slurm.service-name' ])
136
+ command = ['slurmctld' ]
137
+ core .check_system (command , 'enable slurmctld' )
138
+ service .check_start (core .config ['slurm.service-name' ])
139
+ service .check_start (core .config ['slurm.ctld-service-name' ])
142
140
143
141
core .monitor_file (CTLD_LOG ,
144
142
stat ,
@@ -151,4 +149,3 @@ def test_03_start_slurm(self):
151
149
60.0 )
152
150
command = ['scontrol' , 'update' , 'nodename=%s' % SHORT_HOSTNAME , 'state=idle' ]
153
151
core .check_system (command , 'enable slurm node' )
154
-
0 commit comments