hots 2.0.0__tar.gz → 2.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. {hots-2.0.0/hots.egg-info → hots-2.0.2}/PKG-INFO +1 -1
  2. hots-2.0.2/VERSION.txt +1 -0
  3. {hots-2.0.0 → hots-2.0.2}/hots/core/app.py +7 -7
  4. {hots-2.0.0 → hots-2.0.2}/hots/core/instance.py +0 -2
  5. {hots-2.0.0 → hots-2.0.2}/hots/plugins/clustering/builder.py +2 -0
  6. {hots-2.0.0 → hots-2.0.2}/hots/plugins/connector/file_connector.py +8 -1
  7. {hots-2.0.0 → hots-2.0.2}/hots/plugins/optimization/pyomo_model.py +2 -1
  8. {hots-2.0.0 → hots-2.0.2}/hots/plugins/problem/placement.py +2 -1
  9. {hots-2.0.0 → hots-2.0.2/hots.egg-info}/PKG-INFO +1 -1
  10. {hots-2.0.0 → hots-2.0.2}/pyproject.toml +3 -0
  11. hots-2.0.0/VERSION.txt +0 -1
  12. {hots-2.0.0 → hots-2.0.2}/LICENSE.txt +0 -0
  13. {hots-2.0.0 → hots-2.0.2}/README.md +0 -0
  14. {hots-2.0.0 → hots-2.0.2}/hots/__init__.py +0 -0
  15. {hots-2.0.0 → hots-2.0.2}/hots/cli.py +0 -0
  16. {hots-2.0.0 → hots-2.0.2}/hots/config/loader.py +0 -0
  17. {hots-2.0.0 → hots-2.0.2}/hots/core/interfaces.py +0 -0
  18. {hots-2.0.0 → hots-2.0.2}/hots/evaluation/evaluator.py +0 -0
  19. {hots-2.0.0 → hots-2.0.2}/hots/plugins/__init__.py +0 -0
  20. {hots-2.0.0 → hots-2.0.2}/hots/plugins/clustering/custom_spectral.py +0 -0
  21. {hots-2.0.0 → hots-2.0.2}/hots/plugins/clustering/hierarchical.py +0 -0
  22. {hots-2.0.0 → hots-2.0.2}/hots/plugins/clustering/kmeans.py +0 -0
  23. {hots-2.0.0 → hots-2.0.2}/hots/plugins/clustering/spectral.py +0 -0
  24. {hots-2.0.0 → hots-2.0.2}/hots/plugins/connector/kafka_connector.py +0 -0
  25. {hots-2.0.0 → hots-2.0.2}/hots/plugins/optimization/factory.py +0 -0
  26. {hots-2.0.0 → hots-2.0.2}/hots/plugins/problem/__init__.py +0 -0
  27. {hots-2.0.0 → hots-2.0.2}/hots/utils/logging_config.py +0 -0
  28. {hots-2.0.0 → hots-2.0.2}/hots/utils/signals.py +0 -0
  29. {hots-2.0.0 → hots-2.0.2}/hots/utils/tools.py +0 -0
  30. {hots-2.0.0 → hots-2.0.2}/hots/visualization/plot.py +0 -0
  31. {hots-2.0.0 → hots-2.0.2}/hots.egg-info/SOURCES.txt +0 -0
  32. {hots-2.0.0 → hots-2.0.2}/hots.egg-info/dependency_links.txt +0 -0
  33. {hots-2.0.0 → hots-2.0.2}/hots.egg-info/entry_points.txt +0 -0
  34. {hots-2.0.0 → hots-2.0.2}/hots.egg-info/not-zip-safe +0 -0
  35. {hots-2.0.0 → hots-2.0.2}/hots.egg-info/requires.txt +0 -0
  36. {hots-2.0.0 → hots-2.0.2}/hots.egg-info/top_level.txt +0 -0
  37. {hots-2.0.0 → hots-2.0.2}/setup.cfg +0 -0
  38. {hots-2.0.0 → hots-2.0.2}/tests/test_packaging.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hots
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: HOTS: dynamic microservice placement via clustering + optimization
5
5
  Author-email: Smile R&D team <rnd@smile.fr>
6
6
  License-Expression: MIT
hots-2.0.2/VERSION.txt ADDED
@@ -0,0 +1 @@
1
+ 2.0.2
@@ -5,6 +5,7 @@
5
5
  import importlib
6
6
  import logging
7
7
  import time
8
+ from pathlib import Path
8
9
  from typing import Optional
9
10
 
10
11
  from hots.config.loader import AppConfig
@@ -57,7 +58,7 @@ class App:
57
58
 
58
59
  # State that persists across iterations
59
60
  self.prev_snapshot: Optional[EvalSnapshot] = None
60
- self.metrics_history = []
61
+ self.results_file: Path = config.reporting.metrics_file
61
62
 
62
63
  setup_signal_handlers(self.shutdown)
63
64
 
@@ -113,7 +114,7 @@ class App:
113
114
  loop_nb = 1
114
115
  while True:
115
116
  if self.config.time_limit is not None and time.time() >= end_time:
116
- self.shutdown()
117
+ break
117
118
  logging.info('Starting loop #%d', loop_nb)
118
119
  df_new = self.connector.load_next()
119
120
  if df_new is None:
@@ -136,9 +137,7 @@ class App:
136
137
  'Loop %d moves: %d containers', loop_nb, len(metrics['moving_containers'])
137
138
  )
138
139
 
139
- logging.info('Applying moves for loop #%d', loop_nb)
140
140
  self.connector.apply_moves(moves, tmax)
141
- logging.info('Moves applied for loop #%d', loop_nb)
142
141
 
143
142
  self.instance.metrics_history.append(metrics)
144
143
 
@@ -146,6 +145,7 @@ class App:
146
145
  tmin = tmax - (self.config.connector.parameters.get('window_duration') - 1)
147
146
  loop_nb += 1
148
147
 
148
+ self._persist_metrics()
149
149
  t_total = time.time() - t_start
150
150
  logging.info('Finished HOTS run in %.3f seconds', t_total)
151
151
 
@@ -177,9 +177,9 @@ class App:
177
177
 
178
178
  def _persist_metrics(self):
179
179
  """Append metrics to CSV and keep an in-memory history."""
180
- out = pd.DataFrame(self.metrics_history)
181
- out.to_csv(self.instance.results_file, index=False, mode='w')
182
- logging.debug('Metrics written to %s', self.instance.results_file)
180
+ out = pd.DataFrame(self.instance.metrics_history)
181
+ out.to_csv(self.results_file, index=False, mode='w')
182
+ logging.info('Metrics written to %s', self.results_file)
183
183
 
184
184
  def shutdown(self, signum=None, frame=None):
185
185
  """Handle shutdown signals gracefully."""
@@ -2,7 +2,6 @@
2
2
 
3
3
  """HOTS core functionality: manage state and data ingestion."""
4
4
 
5
- from pathlib import Path
6
5
  from typing import Any, Dict, List
7
6
 
8
7
  from hots.config.loader import AppConfig
@@ -19,7 +18,6 @@ class Instance:
19
18
  """Initialize the Instance with configuration and initial data."""
20
19
  self.config = config
21
20
  self.metrics_history: List[Dict[str, Any]] = []
22
- self.results_file: Path = config.reporting.metrics_file
23
21
 
24
22
  self.kafka_producer = None
25
23
  self.kafka_consumer = None
@@ -158,6 +158,8 @@ def change_clustering(
158
158
  """
159
159
  nb_changes = 0
160
160
 
161
+ logging.info('List of moving containers (clustering):')
162
+ logging.info(mvg_containers)
161
163
  # Work only on moved-out base set to compute centroids (don’t include movers)
162
164
  df_clust_new = clustering.clust_mat.loc[~clustering.clust_mat.index.isin(mvg_containers)]
163
165
  if df_clust_new.empty:
@@ -4,6 +4,7 @@
4
4
 
5
5
  import csv
6
6
  import json
7
+ import logging
7
8
  import queue
8
9
  from bisect import bisect_right
9
10
  from collections import defaultdict
@@ -160,11 +161,17 @@ class FileConnector(ConnectorPlugin):
160
161
  # solution may be a list of move dicts, or a model with extract_moves()
161
162
 
162
163
  if not moves:
164
+ logging.info('No move to apply.')
163
165
  return # nothing to do
164
166
 
167
+ logging.info('Applying moves for time %d', current_time)
165
168
  self.add_moves(current_time, moves)
166
169
 
167
170
  # always append during the run
168
171
  with self.outfile.open('a', encoding='utf-8') as f:
169
172
  for move in moves:
170
- f.write(json.dumps(move, ensure_ascii=False) + '\n')
173
+ move_with_time = dict(move)
174
+ move_with_time['time'] = str(current_time)
175
+ f.write(json.dumps(move_with_time, ensure_ascii=False) + '\n')
176
+
177
+ logging.info('Moves applied for time %d', current_time)
@@ -61,7 +61,8 @@ class PyomoModel(OptimizationPlugin):
61
61
  self.v_mat = v_mat
62
62
  self.dv_mat = dv_mat
63
63
 
64
- self._build_abstract_model_if_needed()
64
+ self.mdl = pe.AbstractModel()
65
+ self._build_model()
65
66
 
66
67
  # instantiate with data
67
68
  self.create_data()
@@ -278,7 +278,8 @@ class PlacementPlugin(ProblemPlugin):
278
278
  f = self._f
279
279
  moves_list: List[Dict[str, Any]] = []
280
280
  old_ids: Dict[int, Any] = {}
281
-
281
+ logging.info('List of moving containers (placement):')
282
+ logging.info(moving)
282
283
  # Step 1: Remove all moving containers and store old hosts
283
284
  for mvg_cont in moving:
284
285
  old_host = _safe_first(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hots
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: HOTS: dynamic microservice placement via clustering + optimization
5
5
  Author-email: Smile R&D team <rnd@smile.fr>
6
6
  License-Expression: MIT
@@ -123,3 +123,6 @@ testpaths = [
123
123
  "tests",
124
124
  ]
125
125
  addopts = "--verbosity=2"
126
+ markers = [
127
+ "e2e: end-to-end tests",
128
+ ]
hots-2.0.0/VERSION.txt DELETED
@@ -1 +0,0 @@
1
- 2.0.0
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes