in azure-slurm/slurmcc/topology.py [0:0]
def check_ibstatus(self) -> None:
"""
Checks the availability of the 'ibstatus' command on the first host in self.hosts.
This method runs a Python command to check if 'ibstatus' is available on the first host.
If 'ibstatus' is not found, it logs an error message and exits the program.
If 'ibstatus' is found, it logs a debug message indicating its availability.
Returns:
None
Raises:
SystemExit: If 'ibstatus' is not available on the first host.
"""
cmd ="python3 -c \"import shutil; print(shutil.which('ibstatus'))\""
try:
output = slutil.srun([self.hosts[0]],cmd, partition=self.partition)
path=output.stdout.strip()
log.debug(path)
except slutil.SrunExitCodeException as e:
log.error("Error running check_ibstatus command on host %s",self.hosts[0])
if e.stderr_content:
log.error(e.stderr_content)
log.error(e.stderr)
sys.exit(e.returncode)
except subprocesslib.TimeoutExpired:
sys.exit(1)
if path=="None":
log.error("The 'ibstatus' command is not available")
sys.exit(1)
else:
log.debug("The 'ibstatus' command is available.")
return 0