Skip to content

Commit 7b9d486

Browse files
Add a check if the clusterstarttime can't be found
1 parent 1c07952 commit 7b9d486

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

autoscaling/crontab/autoscale_slurm.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,16 @@ def getIdleTime(node):
8787
pass
8888
out = subprocess.Popen(["scontrol show node "+node+" | grep SlurmdStartTime | awk '{print $2}'"],stdout=subprocess.PIPE, stderr=subprocess.STDOUT,shell=True)
8989
stdout,stderr = out.communicate()
90-
cluster_start_time=datetime.datetime.strptime(stdout.split("\n")[0].split("=")[1],"%Y-%m-%dT%H:%M:%S")
90+
try:
91+
cluster_start_time=datetime.datetime.strptime(stdout.split("\n")[0].split("=")[1],"%Y-%m-%dT%H:%M:%S")
92+
except:
93+
print "The cluster start time of node "+node+" could not be found"
94+
print "There seems to be an issue with the command"
95+
print "scontrol show node "+node+" | grep SlurmdStartTime | awk '{print $2}'"
96+
print "Here is the output it generated"
97+
print stdout
98+
print "The cluster will be deleted"
99+
cluster_start_time=datetime.datetime.now()-datetime.timedelta(hours=24)
91100
if last_end_time is None:
92101
right_time=cluster_start_time
93102
else:

0 commit comments

Comments
 (0)