File tree 1 file changed +10
-5
lines changed
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -49,11 +49,16 @@ def monitor_judge(judge_name):
49
49
now = datetime .now ()
50
50
if (now - started_at ) > timedelta (seconds = 30 ):
51
51
if not is_waiting (judge_name ):
52
- pid = int (subprocess .check_output (["docker top {} | tail -n 1" .format (judge_name )], shell = True ).split ()[1 ])
53
- if judge_name in MARKED_JUDGES and pid == MARKED_JUDGES [judge_name ]:
54
- restart_judge (judge_name )
55
- else :
56
- mark_judge (judge_name , pid )
52
+ try :
53
+ pid = int (subprocess .check_output (["docker top {} | tail -n 1" .format (judge_name )], shell = True ).split ()[1 ])
54
+ if judge_name in MARKED_JUDGES and pid == MARKED_JUDGES [judge_name ]:
55
+ restart_judge (judge_name )
56
+ else :
57
+ mark_judge (judge_name , pid )
58
+ except (IndexError , ValueError ) as error :
59
+ # IndexError occurs if the container is restarting when processing the command docker top
60
+ # ValueError occurs if the container has not yet (or more?) running process
61
+ print "{} occured" .format (error )
57
62
else :
58
63
if judge_name in MARKED_JUDGES :
59
64
unmark_judge (judge_name )
You can’t perform that action at this time.
0 commit comments