Fix interruption of long processes.

This commit is contained in:
Nicolas Setton
2018-06-29 13:38:48 -04:00
parent d14ec2fcb1
commit a5dfe8f511

View File

@@ -53,8 +53,10 @@ class SeparateProcess(object):
def _monitor_timeout(self):
"""Monitor the running process, interrupting it if it takes too long"""
while not self.processes_running:
while self.processes_running:
if time.time() - self.time > TIMEOUT_SECONDS:
with open(self.output_file, 'ab') as f:
f.write("<interrupted after timeout>")
# The current process took too long, kill it
self.p.kill()
time.sleep(1.0)