Skip to content

Commit a8e19ae

Browse files
If SLURM not installed report 0 cores
1 parent 0fab4a4 commit a8e19ae

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

dask_jobqueue/tests/test_slurm.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@
1616

1717
def slurm_cores():
1818
"Use sinfo to get the number of available CPU cores"
19-
return int(
20-
subprocess.check_output(["sinfo", "-o", "%C"]).split()[1].decode().split("/")[1]
21-
)
19+
try:
20+
return int(
21+
subprocess.check_output(["sinfo", "-o", "%C"])
22+
.split()[1]
23+
.decode()
24+
.split("/")[1]
25+
)
26+
except FileNotFoundError:
27+
return 0
2228

2329

2430
def test_header():

0 commit comments

Comments
 (0)