adapto 0.1.2__tar.gz → 0.1.3__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {adapto-0.1.2 → adapto-0.1.3}/PKG-INFO +1 -1
- {adapto-0.1.2 → adapto-0.1.3}/adapto/scaler.py +4 -1
- {adapto-0.1.2 → adapto-0.1.3}/adapto.egg-info/PKG-INFO +1 -1
- {adapto-0.1.2 → adapto-0.1.3}/setup.py +1 -1
- {adapto-0.1.2 → adapto-0.1.3}/tests/test_scaler.py +1 -1
- {adapto-0.1.2 → adapto-0.1.3}/LICENSE +0 -0
- {adapto-0.1.2 → adapto-0.1.3}/README.md +0 -0
- {adapto-0.1.2 → adapto-0.1.3}/adapto/__init__.py +0 -0
- {adapto-0.1.2 → adapto-0.1.3}/adapto/predictor.py +0 -0
- {adapto-0.1.2 → adapto-0.1.3}/adapto/utils.py +0 -0
- {adapto-0.1.2 → adapto-0.1.3}/adapto.egg-info/SOURCES.txt +0 -0
- {adapto-0.1.2 → adapto-0.1.3}/adapto.egg-info/dependency_links.txt +0 -0
- {adapto-0.1.2 → adapto-0.1.3}/adapto.egg-info/requires.txt +0 -0
- {adapto-0.1.2 → adapto-0.1.3}/adapto.egg-info/top_level.txt +0 -0
- {adapto-0.1.2 → adapto-0.1.3}/setup.cfg +0 -0
- {adapto-0.1.2 → adapto-0.1.3}/tests/test_predictor.py +0 -0
@@ -9,7 +9,7 @@ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(
|
|
9
9
|
|
10
10
|
|
11
11
|
class AutoScaler:
|
12
|
-
def __init__(self, scale_up_threshold=
|
12
|
+
def __init__(self, scale_up_threshold=75, scale_down_threshold=30, memory_threshold=75,
|
13
13
|
bandwidth_threshold=100000000, min_instances=1, max_instances=10, history_size=10, custom_scaling=None):
|
14
14
|
self.scale_up_threshold = scale_up_threshold
|
15
15
|
self.scale_down_threshold = scale_down_threshold
|
@@ -20,6 +20,9 @@ class AutoScaler:
|
|
20
20
|
self.max_instances = max_instances
|
21
21
|
self.previous_network = psutil.net_io_counters()
|
22
22
|
|
23
|
+
# Alias for test compatibility
|
24
|
+
self.cpu_threshold = scale_up_threshold # Fix for test cases
|
25
|
+
|
23
26
|
# Optional custom scaling function; should accept (metrics, predictions) and return 'scale_up', 'scale_down', or 'no_change'
|
24
27
|
self.custom_scaling = custom_scaling
|
25
28
|
|
@@ -5,7 +5,7 @@ class TestAutoScaler(unittest.TestCase):
|
|
5
5
|
def test_default_thresholds(self):
|
6
6
|
scaler = AutoScaler()
|
7
7
|
self.assertEqual(scaler.cpu_threshold, 75)
|
8
|
-
self.assertEqual(scaler.memory_threshold,
|
8
|
+
self.assertEqual(scaler.memory_threshold, 75)
|
9
9
|
|
10
10
|
if __name__ == '__main__':
|
11
11
|
unittest.main()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|