Skip to content
This repository was archived by the owner on Feb 17, 2022. It is now read-only.

Commit 0deb543

Browse files
committed
Add a configuration parameter for setting escalation wait times per-task.
1 parent e11ed5b commit 0deb543

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/main/python/apache/aurora/executor/thermos_task_runner.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050

5151

5252
class ThermosTaskRunner(TaskRunner):
53-
ESCALATION_WAIT = Amount(5, Time.SECONDS)
5453
EXIT_STATE_MAP = {
5554
TaskState.ACTIVE: StatusResult('Runner died while task was active.', mesos_pb2.TASK_LOST),
5655
TaskState.FAILED: StatusResult('Task failed.', mesos_pb2.TASK_FAILED),
@@ -113,6 +112,10 @@ def __init__(self,
113112
except ThermosTaskWrapper.InvalidTask as e:
114113
raise TaskError('Failed to load task: %s' % e)
115114

115+
# Only attempt to extract information after task validation.
116+
self._escalation_wait = Amount(
117+
self._task.escalation_wait().get(), Time.SECONDS)
118+
116119
def _terminate_http(self):
117120
if 'health' not in self._ports:
118121
return
@@ -121,13 +124,13 @@ def _terminate_http(self):
121124

122125
# pass 1
123126
http_signaler.quitquitquit()
124-
self._clock.sleep(self.ESCALATION_WAIT.as_(Time.SECONDS))
127+
self._clock.sleep(self._escalation_wait.as_(Time.SECONDS))
125128
if self.status is not None:
126129
return True
127130

128131
# pass 2
129132
http_signaler.abortabortabort()
130-
self._clock.sleep(self.ESCALATION_WAIT.as_(Time.SECONDS))
133+
self._clock.sleep(self._escalation_wait.as_(Time.SECONDS))
131134
if self.status is not None:
132135
return True
133136

src/main/python/apache/thermos/config/schema_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ class Task(Struct):
7474
# > 0 is max concurrent processes.
7575
finalization_wait = Default(Integer, 30) # the amount of time in seconds we allocate to run the
7676
# finalization schedule.
77+
escalation_wait = Default(Integer, 5) # The amount of time in seconds to wait after running
78+
# the /quitquitquit and /abortabortabort handlers.
7779

7880
# TODO(jon): remove/replace with proper solution to MESOS-3546
7981
user = String

0 commit comments

Comments
 (0)