Skip to content

Commit

Permalink
Merge pull request #177 from mila-iqia/update-slurm-version-retrieving
Browse files Browse the repository at this point in the history
Fix Slurm version retrieving through sacct
  • Loading branch information
soline-b authored Nov 20, 2023
2 parents f1a2c05 + fbf9b3f commit 5bb968c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions slurm_state/parsers/slurm_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,16 @@ def get_slurm_version(self):
# return the value of the configuration
return self.cluster["slurm_version"]
else:
print("3")
# Launch the sacct or sinfo command to get its version
remote_command = f"{self.slurm_command_path} -V"
response = self.launch_slurm_command(remote_command)
assert len(response) == 1
version_regex = re.compile(r"^slurm (\d+\.\d+\.\d+)$")
if m := version_regex.match(response):
if m := version_regex.match(response[0]):
return m.group(1)
# If the version has not been identified, raise an error
raise Exception(
f'The version "{response}" has not been recognized as a Slurm version.'
f'The version "{response[0]}" has not been recognized as a Slurm version.'
)

def launch_slurm_command(self, remote_command):
Expand Down

0 comments on commit 5bb968c

Please sign in to comment.