summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <bschubert15@bloomberg.net>2019-11-11 18:51:35 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-11-13 16:01:32 +0000
commitecc1f607aa186192e707552f309d78708fd68159 (patch)
tree9416341236dd216fbed71a4f08c1534aa35ed65f
parentd20f90b265647d3dd98e65bf201ad87b7960018d (diff)
downloadbuildstream-ecc1f607aa186192e707552f309d78708fd68159.tar.gz
scheduler.py: Extract timeout to kill as a global variable
-rw-r--r--src/buildstream/_scheduler/scheduler.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/buildstream/_scheduler/scheduler.py b/src/buildstream/_scheduler/scheduler.py
index ba81a48bf..86e3af021 100644
--- a/src/buildstream/_scheduler/scheduler.py
+++ b/src/buildstream/_scheduler/scheduler.py
@@ -34,6 +34,9 @@ from .._message import Message, MessageType
from ..plugin import Plugin
+_MAX_TIMEOUT_TO_KILL_CHILDREN = 20 # in seconds
+
+
# A decent return code for Scheduler.run()
class SchedStatus(FastEnum):
SUCCESS = 0
@@ -530,8 +533,8 @@ class Scheduler():
for job_ in self._active_jobs:
job_.kill()
- # Schedule all jobs to be killed if they have not exited in 20 sec
- self.loop.call_later(20, kill_jobs)
+ # Schedule all jobs to be killed if they have not exited after timeout
+ self.loop.call_later(_MAX_TIMEOUT_TO_KILL_CHILDREN, kill_jobs)
for job in self._active_jobs:
job.terminate()