|
@@ -13,6 +13,7 @@
|
|
|
"""
|
|
|
from __future__ import absolute_import
|
|
|
|
|
|
+import os
|
|
|
import threading
|
|
|
|
|
|
from functools import partial
|
|
@@ -29,6 +30,8 @@ from .hub import DummyLock
|
|
|
logger = get_logger(__name__)
|
|
|
debug, info, error = logger.debug, logger.info, logger.error
|
|
|
|
|
|
+AUTOSCALE_KEEPALIVE = int(os.environ.get('AUTOSCALE_KEEPALIVE', 30))
|
|
|
+
|
|
|
|
|
|
class WorkerComponent(bootsteps.StartStopStep):
|
|
|
label = 'Autoscaler'
|
|
@@ -66,7 +69,7 @@ class WorkerComponent(bootsteps.StartStopStep):
|
|
|
class Autoscaler(bgThread):
|
|
|
|
|
|
def __init__(self, pool, max_concurrency,
|
|
|
- min_concurrency=0, keepalive=30, mutex=None):
|
|
|
+ min_concurrency=0, keepalive=AUTOSCALE_KEEPALIVE, mutex=None):
|
|
|
super(Autoscaler, self).__init__()
|
|
|
self.pool = pool
|
|
|
self.mutex = mutex or threading.Lock()
|