hots 2.0.2__tar.gz → 2.1.0__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 (55) hide show
  1. hots-2.1.0/PKG-INFO +298 -0
  2. hots-2.1.0/README.md +248 -0
  3. hots-2.1.0/VERSION.txt +1 -0
  4. hots-2.1.0/hots/__init__.py +30 -0
  5. {hots-2.0.2 → hots-2.1.0}/hots/cli.py +6 -3
  6. hots-2.1.0/hots/config/loader.py +308 -0
  7. hots-2.1.0/hots/config/sample_config_file.json +97 -0
  8. hots-2.1.0/hots/config/sample_config_kafka.json +69 -0
  9. hots-2.1.0/hots/core/app.py +275 -0
  10. hots-2.1.0/hots/core/instance.py +187 -0
  11. hots-2.1.0/hots/core/interfaces.py +209 -0
  12. hots-2.1.0/hots/evaluation/evaluator.py +747 -0
  13. hots-2.1.0/hots/plugins/__init__.py +108 -0
  14. {hots-2.0.2 → hots-2.1.0}/hots/plugins/clustering/builder.py +19 -69
  15. {hots-2.0.2 → hots-2.1.0}/hots/plugins/clustering/custom_spectral.py +14 -14
  16. {hots-2.0.2 → hots-2.1.0}/hots/plugins/clustering/hierarchical.py +10 -9
  17. {hots-2.0.2 → hots-2.1.0}/hots/plugins/clustering/kmeans.py +13 -18
  18. {hots-2.0.2 → hots-2.1.0}/hots/plugins/clustering/spectral.py +10 -9
  19. {hots-2.0.2 → hots-2.1.0}/hots/plugins/connector/file_connector.py +48 -49
  20. hots-2.1.0/hots/plugins/connector/kafka_connector.py +211 -0
  21. {hots-2.0.2 → hots-2.1.0}/hots/plugins/optimization/factory.py +7 -8
  22. {hots-2.0.2 → hots-2.1.0}/hots/plugins/optimization/pyomo_model.py +150 -123
  23. {hots-2.0.2 → hots-2.1.0}/hots/plugins/problem/placement.py +294 -210
  24. {hots-2.0.2 → hots-2.1.0}/hots/utils/logging_config.py +6 -4
  25. hots-2.1.0/hots/utils/plot_kpis.py +71 -0
  26. {hots-2.0.2 → hots-2.1.0}/hots/utils/tools.py +10 -20
  27. hots-2.1.0/hots/visualization/plot.py +590 -0
  28. hots-2.1.0/hots.egg-info/PKG-INFO +298 -0
  29. {hots-2.0.2 → hots-2.1.0}/hots.egg-info/SOURCES.txt +3 -0
  30. hots-2.1.0/hots.egg-info/requires.txt +27 -0
  31. {hots-2.0.2 → hots-2.1.0}/pyproject.toml +45 -33
  32. hots-2.1.0/tests/test_packaging.py +44 -0
  33. hots-2.0.2/PKG-INFO +0 -258
  34. hots-2.0.2/README.md +0 -208
  35. hots-2.0.2/VERSION.txt +0 -1
  36. hots-2.0.2/hots/__init__.py +0 -11
  37. hots-2.0.2/hots/config/loader.py +0 -119
  38. hots-2.0.2/hots/core/app.py +0 -187
  39. hots-2.0.2/hots/core/instance.py +0 -81
  40. hots-2.0.2/hots/core/interfaces.py +0 -74
  41. hots-2.0.2/hots/evaluation/evaluator.py +0 -435
  42. hots-2.0.2/hots/plugins/__init__.py +0 -67
  43. hots-2.0.2/hots/plugins/connector/kafka_connector.py +0 -80
  44. hots-2.0.2/hots/visualization/plot.py +0 -11
  45. hots-2.0.2/hots.egg-info/PKG-INFO +0 -258
  46. hots-2.0.2/hots.egg-info/requires.txt +0 -31
  47. hots-2.0.2/tests/test_packaging.py +0 -25
  48. {hots-2.0.2 → hots-2.1.0}/LICENSE.txt +0 -0
  49. {hots-2.0.2 → hots-2.1.0}/hots/plugins/problem/__init__.py +0 -0
  50. {hots-2.0.2 → hots-2.1.0}/hots/utils/signals.py +0 -0
  51. {hots-2.0.2 → hots-2.1.0}/hots.egg-info/dependency_links.txt +0 -0
  52. {hots-2.0.2 → hots-2.1.0}/hots.egg-info/entry_points.txt +0 -0
  53. {hots-2.0.2 → hots-2.1.0}/hots.egg-info/not-zip-safe +0 -0
  54. {hots-2.0.2 → hots-2.1.0}/hots.egg-info/top_level.txt +0 -0
  55. {hots-2.0.2 → hots-2.1.0}/setup.cfg +0 -0
hots-2.1.0/PKG-INFO ADDED
@@ -0,0 +1,298 @@
1
+ Metadata-Version: 2.4
2
+ Name: hots
3
+ Version: 2.1.0
4
+ Summary: HOTS: dynamic microservice placement via clustering + optimization
5
+ Author-email: Smile R&D team <rnd@smile.fr>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Smile-SA/hots
8
+ Project-URL: Documentation, https://hots.readthedocs.io/en/latest/
9
+ Project-URL: Source, https://github.com/Smile-SA/hots
10
+ Project-URL: Issues, https://github.com/Smile-SA/hots/issues
11
+ Project-URL: Changelog, https://hots.readthedocs.io/en/latest/history.html
12
+ Keywords: Resource,Optimisation,Clustering,Planning
13
+ Platform: any
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: Implementation :: CPython
19
+ Classifier: Development Status :: 3 - Alpha
20
+ Classifier: Operating System :: POSIX
21
+ Classifier: Framework :: Matplotlib
22
+ Classifier: Intended Audience :: Science/Research
23
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
24
+ Requires-Python: >=3.11
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE.txt
27
+ Requires-Dist: click>=8.0
28
+ Requires-Dist: matplotlib
29
+ Requires-Dist: networkx
30
+ Requires-Dist: numpy
31
+ Requires-Dist: pandas
32
+ Requires-Dist: psutil
33
+ Requires-Dist: pyomo
34
+ Requires-Dist: pydantic>=2.6
35
+ Requires-Dist: scikit-learn
36
+ Requires-Dist: scipy
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest; extra == "dev"
39
+ Requires-Dist: ruff; extra == "dev"
40
+ Provides-Extra: doc
41
+ Requires-Dist: sphinx>=8; extra == "doc"
42
+ Requires-Dist: sphinx-rtd-theme>=2; extra == "doc"
43
+ Provides-Extra: kafka
44
+ Requires-Dist: confluent-kafka>=2.3; extra == "kafka"
45
+ Provides-Extra: testing
46
+ Requires-Dist: pytest; extra == "testing"
47
+ Provides-Extra: parquet
48
+ Requires-Dist: pyarrow>=14; extra == "parquet"
49
+ Dynamic: license-file
50
+
51
+ <h1 align="center">
52
+ <img src="https://github.com/Smile-SA/hots/raw/main/doc/source/_static/hots_logo.png" width="250">
53
+ </h1><br>
54
+
55
+ > Hybrid Optimization for Time Series (HOTS)
56
+ > HOTS solves problems presented as time series using machine learning and optimization methods.
57
+ > The library supports multiple resource related problems (placement, allocation), presented as one or more metrics.
58
+
59
+ ## Requirements for running HOTS
60
+
61
+ HOTS works on any platform with Python 3.11 and up.
62
+
63
+ The dev Python version must be used to install the package (for example install the package
64
+ python3.12-dev in order to use Python 3.12).
65
+
66
+ A solver needs to be installed for using HOTS. HOTS uses GLPK by default, which is not a Python
67
+ package: install it with your system's package manager before using HOTS (on Debian or Ubuntu,
68
+ `sudo apt install glpk-utils libglpk-dev`).
69
+
70
+ In order to run HOTS with the streaming platform Kafka, you need the `kafka` extra (see below),
71
+ and a running Kafka broker.
72
+
73
+ ## Installing HOTS
74
+
75
+ From PyPI:
76
+
77
+ ```bash
78
+ pip install hots # file connector only
79
+ pip install "hots[kafka]" # with the Kafka connector
80
+ hots --version
81
+ ```
82
+
83
+ For development, a Makefile is provided, which creates a virtual environment and installs HOTS
84
+ from the checkout. You can do :
85
+
86
+ ```bash
87
+ make
88
+ ```
89
+
90
+ ## Configuration file
91
+
92
+ HOTS is configured via a single JSON file that you pass to the CLI.
93
+
94
+ A minimal example using the file connector looks like this:
95
+
96
+ ```json
97
+ {
98
+ "time_limit": null,
99
+ "data": {
100
+ "tick_field": "timestamp",
101
+ "individual_field": "container_id",
102
+ "host_field": "machine_id",
103
+ "metrics": ["cpu"]
104
+ },
105
+ "clustering": {
106
+ "method": "kmeans",
107
+ "nb_clusters": 3,
108
+ "parameters": {
109
+ "nb_clusters": 3
110
+ }
111
+ },
112
+ "optimization": {
113
+ "backend": "pyomo",
114
+ "parameters": {
115
+ "solver": "glpk",
116
+ "verbose": 0
117
+ }
118
+ },
119
+ "problem": {
120
+ "type": "placement",
121
+ "parameters": {
122
+ "initial_placement": 0,
123
+ "tol": 0.1,
124
+ "tol_move": 0.5
125
+ }
126
+ },
127
+ "connector": {
128
+ "type": "file",
129
+ "parameters": {
130
+ "data_folder": "./tests/data/thesis_ex_10",
131
+ "file_name": "container_usage.csv",
132
+ "tick_increment": 2,
133
+ "window_duration": 3,
134
+ "sep_time": 3,
135
+ "outfile": "./out/moves.log"
136
+ }
137
+ },
138
+ "logging": {
139
+ "level": "INFO",
140
+ "filename": "./out/hots.log",
141
+ "fmt": "%(asctime)s %(levelname)s: %(message)s"
142
+ },
143
+ "reporting": {
144
+ "results_folder": "./out",
145
+ "metrics_file": "./out/metrics.csv",
146
+ "plots_folder": "./out/plots"
147
+ }
148
+ }
149
+ ```
150
+
151
+ The `data` section names the columns of your time series. These describe the
152
+ *data*, not the transport, so every component reads them from there and you can
153
+ swap connectors without touching them. Only one entry in `metrics` is supported
154
+ today — the pipeline optimizes a single metric, and a longer list is rejected at
155
+ load time rather than silently ignored.
156
+
157
+ > **Backward compatibility:** these four keys may still be given inside
158
+ > `connector.parameters` instead, as in older configs; they are then used to
159
+ > populate `data` automatically. Declaring the same key in both places with
160
+ > *different* values is a config error.
161
+
162
+ For a Kafka-based setup, the structure is the same but the `connector` section uses `"type": "kafka"`
163
+ (see `hots/config/sample_config_kafka.json`):
164
+
165
+ ```json
166
+ "connector": {
167
+ "type": "kafka",
168
+ "parameters": {
169
+ "bootstrap.servers": "localhost:9092",
170
+ "topic_data": "hots_data",
171
+ "topic_moves": "hots_moves",
172
+ "consumer_conf": {
173
+ "bootstrap.servers": "localhost:9092",
174
+ "group.id": "hots",
175
+ "auto.offset.reset": "earliest"
176
+ },
177
+ "tick_increment": 10,
178
+ "window_duration": 3,
179
+ "sep_time": 30,
180
+ "batch_size": 10,
181
+ "poll_timeout": 1.0,
182
+ "bootstrap_timeout_seconds": 120,
183
+ "node_capacities": {"vm1": 2.0, "vm2": 2.0, "vm3": 2.0}
184
+ }
185
+ }
186
+ ```
187
+
188
+ | Parameter | Description |
189
+ | --- | --- |
190
+ | `bootstrap.servers` | Kafka broker HOTS publishes moves to. |
191
+ | `topic_data` | Topic HOTS reads telemetry from. |
192
+ | `topic_moves` | Topic HOTS publishes its moves to. |
193
+ | `consumer_conf` | [librdkafka consumer settings](https://github.com/confluentinc/librdkafka/blob/master/CONFIGURATION.md) for reading `topic_data`; `group.id` is required. |
194
+ | `sep_time` | HOTS reads telemetry until it reaches this tick before it computes its first placement. |
195
+ | `batch_size` | A streaming iteration stops reading once it has this many telemetry rows (one row per container sample). |
196
+ | `poll_timeout` | Seconds to wait for a message. During the run, an iteration that receives nothing in this time **ends the run**: set it above the producer's publish interval. |
197
+ | `bootstrap_timeout_seconds` | Seconds to wait for the first `sep_time` ticks before failing. Default 120. |
198
+ | `node_capacities` | Capacity of each host for the metric in `data.metrics`. When absent, the largest observed load of each host during bootstrap is used instead. |
199
+
200
+ See the User manual in the documentation for the other sections.
201
+
202
+ ## Running HOTS on a live environment
203
+
204
+ The Kafka connector exchanges two kinds of messages. It reads **telemetry** batches,
205
+ `{"v": 1, "containers": [{"timestamp", "container_id", "machine_id", "<metric>"}, ...]}`, from
206
+ `topic_data`, and writes one **move** per message,
207
+ `{"v": 1, "container_name", "old_host", "new_host", "time"}`, to `topic_moves`. The examples in
208
+ `tests/contracts/fixtures/` define this contract.
209
+
210
+ HOTS doesn't observe or move workloads itself:
211
+
212
+ - [hots-connector](https://github.com/Smile-SA/hots-connector) produces the telemetry from
213
+ Prometheus and applies the moves on Docker or Kubernetes;
214
+ - the [mums benchmark platform](https://github.com/Smile-SA/mums) runs HOTS and hots-connector
215
+ together against a Kubernetes cluster, and compares the result with other placement methods.
216
+
217
+ ## Running HOTS
218
+
219
+ ### Via Python
220
+
221
+ The application can be used simply by running :
222
+
223
+ ```bash
224
+ hots --config path/to/config.json
225
+ ```
226
+
227
+ Make sure to activate the virtual environment before running HOTS with :
228
+
229
+ ```bash
230
+ source venv/bin/activate
231
+ ```
232
+
233
+ The only mandatory argument is the path to the JSON configuration file.
234
+ You can inspect available options with:
235
+
236
+ ```bash
237
+ hots --help
238
+ ```
239
+
240
+ Example configs are provided in the package (`hots/config/sample_config_file.json` and
241
+ `hots/config/sample_config_kafka.json`). The small dataset the file example reads,
242
+ `tests/data/thesis_ex_10`, is in the source repository, and the path is relative to the working
243
+ directory. From a checkout, you can quickly test your installation with:
244
+
245
+ ```bash
246
+ hots --config hots/config/sample_config_file.json
247
+ ```
248
+
249
+ ### Via Docker
250
+
251
+ A Docker container can be easily built for running `hots`, using the `Dockerfile` provided in the package.
252
+ If you are not used to Docker, you can follow the installation guideline here : https://docs.docker.com/engine/install/, and the post-install process here (Linux) : https://docs.docker.com/engine/install/linux-postinstall/.
253
+
254
+ As soon as Docker is setup, you can run the following commands (being at the root of the directory, with the Dockerfile) :
255
+
256
+ ```bash
257
+ docker build -t hots .
258
+ ```
259
+
260
+ The image runs `hots` by default, so arguments go straight to it:
261
+
262
+ ```bash
263
+ docker run --rm hots --version
264
+ ```
265
+
266
+ To get a shell instead, in which you can follow the same steps as for Python:
267
+
268
+ ```bash
269
+ docker run -it --rm --entrypoint /bin/bash hots
270
+ ```
271
+
272
+ ## Credits
273
+
274
+ Authors:
275
+
276
+ - Etienne Leclercq - Software design, lead developer
277
+ - Jonathan Rivalan - Product owner, Lead designer
278
+ - Mufaddal Enayath Hussain
279
+ - Marco Mariani
280
+ - Gilles Lenfant
281
+ - Soobash Daiboo
282
+ - Kang Du
283
+ - Amaury Sauret
284
+ - SMILE R&D
285
+
286
+ As HOTS was created during a PhD, credits have to be given to academic supervisors, Céline Rouveirol and Frédéric Roupin, involved in the algorithm thinking.
287
+
288
+ ## Links
289
+
290
+ - [Project home](https://github.com/Smile-SA/hots)
291
+ - [File issues (bugs, ...)](https://github.com/Smile-SA/hots/issues)
292
+ - [PyPi package](https://pypi.org/project/hots/)
293
+ - [Documentation](https://hots.readthedocs.io/en/latest/)
294
+ - [PhD document](https://theses.hal.science/tel-03997934)
295
+
296
+ ## License
297
+
298
+ This software is provided under the terms of the MIT license you can read in the `LICENSE.txt` file of the repository or the package.
hots-2.1.0/README.md ADDED
@@ -0,0 +1,248 @@
1
+ <h1 align="center">
2
+ <img src="https://github.com/Smile-SA/hots/raw/main/doc/source/_static/hots_logo.png" width="250">
3
+ </h1><br>
4
+
5
+ > Hybrid Optimization for Time Series (HOTS)
6
+ > HOTS solves problems presented as time series using machine learning and optimization methods.
7
+ > The library supports multiple resource related problems (placement, allocation), presented as one or more metrics.
8
+
9
+ ## Requirements for running HOTS
10
+
11
+ HOTS works on any platform with Python 3.11 and up.
12
+
13
+ The dev Python version must be used to install the package (for example install the package
14
+ python3.12-dev in order to use Python 3.12).
15
+
16
+ A solver needs to be installed for using HOTS. HOTS uses GLPK by default, which is not a Python
17
+ package: install it with your system's package manager before using HOTS (on Debian or Ubuntu,
18
+ `sudo apt install glpk-utils libglpk-dev`).
19
+
20
+ In order to run HOTS with the streaming platform Kafka, you need the `kafka` extra (see below),
21
+ and a running Kafka broker.
22
+
23
+ ## Installing HOTS
24
+
25
+ From PyPI:
26
+
27
+ ```bash
28
+ pip install hots # file connector only
29
+ pip install "hots[kafka]" # with the Kafka connector
30
+ hots --version
31
+ ```
32
+
33
+ For development, a Makefile is provided, which creates a virtual environment and installs HOTS
34
+ from the checkout. You can do :
35
+
36
+ ```bash
37
+ make
38
+ ```
39
+
40
+ ## Configuration file
41
+
42
+ HOTS is configured via a single JSON file that you pass to the CLI.
43
+
44
+ A minimal example using the file connector looks like this:
45
+
46
+ ```json
47
+ {
48
+ "time_limit": null,
49
+ "data": {
50
+ "tick_field": "timestamp",
51
+ "individual_field": "container_id",
52
+ "host_field": "machine_id",
53
+ "metrics": ["cpu"]
54
+ },
55
+ "clustering": {
56
+ "method": "kmeans",
57
+ "nb_clusters": 3,
58
+ "parameters": {
59
+ "nb_clusters": 3
60
+ }
61
+ },
62
+ "optimization": {
63
+ "backend": "pyomo",
64
+ "parameters": {
65
+ "solver": "glpk",
66
+ "verbose": 0
67
+ }
68
+ },
69
+ "problem": {
70
+ "type": "placement",
71
+ "parameters": {
72
+ "initial_placement": 0,
73
+ "tol": 0.1,
74
+ "tol_move": 0.5
75
+ }
76
+ },
77
+ "connector": {
78
+ "type": "file",
79
+ "parameters": {
80
+ "data_folder": "./tests/data/thesis_ex_10",
81
+ "file_name": "container_usage.csv",
82
+ "tick_increment": 2,
83
+ "window_duration": 3,
84
+ "sep_time": 3,
85
+ "outfile": "./out/moves.log"
86
+ }
87
+ },
88
+ "logging": {
89
+ "level": "INFO",
90
+ "filename": "./out/hots.log",
91
+ "fmt": "%(asctime)s %(levelname)s: %(message)s"
92
+ },
93
+ "reporting": {
94
+ "results_folder": "./out",
95
+ "metrics_file": "./out/metrics.csv",
96
+ "plots_folder": "./out/plots"
97
+ }
98
+ }
99
+ ```
100
+
101
+ The `data` section names the columns of your time series. These describe the
102
+ *data*, not the transport, so every component reads them from there and you can
103
+ swap connectors without touching them. Only one entry in `metrics` is supported
104
+ today — the pipeline optimizes a single metric, and a longer list is rejected at
105
+ load time rather than silently ignored.
106
+
107
+ > **Backward compatibility:** these four keys may still be given inside
108
+ > `connector.parameters` instead, as in older configs; they are then used to
109
+ > populate `data` automatically. Declaring the same key in both places with
110
+ > *different* values is a config error.
111
+
112
+ For a Kafka-based setup, the structure is the same but the `connector` section uses `"type": "kafka"`
113
+ (see `hots/config/sample_config_kafka.json`):
114
+
115
+ ```json
116
+ "connector": {
117
+ "type": "kafka",
118
+ "parameters": {
119
+ "bootstrap.servers": "localhost:9092",
120
+ "topic_data": "hots_data",
121
+ "topic_moves": "hots_moves",
122
+ "consumer_conf": {
123
+ "bootstrap.servers": "localhost:9092",
124
+ "group.id": "hots",
125
+ "auto.offset.reset": "earliest"
126
+ },
127
+ "tick_increment": 10,
128
+ "window_duration": 3,
129
+ "sep_time": 30,
130
+ "batch_size": 10,
131
+ "poll_timeout": 1.0,
132
+ "bootstrap_timeout_seconds": 120,
133
+ "node_capacities": {"vm1": 2.0, "vm2": 2.0, "vm3": 2.0}
134
+ }
135
+ }
136
+ ```
137
+
138
+ | Parameter | Description |
139
+ | --- | --- |
140
+ | `bootstrap.servers` | Kafka broker HOTS publishes moves to. |
141
+ | `topic_data` | Topic HOTS reads telemetry from. |
142
+ | `topic_moves` | Topic HOTS publishes its moves to. |
143
+ | `consumer_conf` | [librdkafka consumer settings](https://github.com/confluentinc/librdkafka/blob/master/CONFIGURATION.md) for reading `topic_data`; `group.id` is required. |
144
+ | `sep_time` | HOTS reads telemetry until it reaches this tick before it computes its first placement. |
145
+ | `batch_size` | A streaming iteration stops reading once it has this many telemetry rows (one row per container sample). |
146
+ | `poll_timeout` | Seconds to wait for a message. During the run, an iteration that receives nothing in this time **ends the run**: set it above the producer's publish interval. |
147
+ | `bootstrap_timeout_seconds` | Seconds to wait for the first `sep_time` ticks before failing. Default 120. |
148
+ | `node_capacities` | Capacity of each host for the metric in `data.metrics`. When absent, the largest observed load of each host during bootstrap is used instead. |
149
+
150
+ See the User manual in the documentation for the other sections.
151
+
152
+ ## Running HOTS on a live environment
153
+
154
+ The Kafka connector exchanges two kinds of messages. It reads **telemetry** batches,
155
+ `{"v": 1, "containers": [{"timestamp", "container_id", "machine_id", "<metric>"}, ...]}`, from
156
+ `topic_data`, and writes one **move** per message,
157
+ `{"v": 1, "container_name", "old_host", "new_host", "time"}`, to `topic_moves`. The examples in
158
+ `tests/contracts/fixtures/` define this contract.
159
+
160
+ HOTS doesn't observe or move workloads itself:
161
+
162
+ - [hots-connector](https://github.com/Smile-SA/hots-connector) produces the telemetry from
163
+ Prometheus and applies the moves on Docker or Kubernetes;
164
+ - the [mums benchmark platform](https://github.com/Smile-SA/mums) runs HOTS and hots-connector
165
+ together against a Kubernetes cluster, and compares the result with other placement methods.
166
+
167
+ ## Running HOTS
168
+
169
+ ### Via Python
170
+
171
+ The application can be used simply by running :
172
+
173
+ ```bash
174
+ hots --config path/to/config.json
175
+ ```
176
+
177
+ Make sure to activate the virtual environment before running HOTS with :
178
+
179
+ ```bash
180
+ source venv/bin/activate
181
+ ```
182
+
183
+ The only mandatory argument is the path to the JSON configuration file.
184
+ You can inspect available options with:
185
+
186
+ ```bash
187
+ hots --help
188
+ ```
189
+
190
+ Example configs are provided in the package (`hots/config/sample_config_file.json` and
191
+ `hots/config/sample_config_kafka.json`). The small dataset the file example reads,
192
+ `tests/data/thesis_ex_10`, is in the source repository, and the path is relative to the working
193
+ directory. From a checkout, you can quickly test your installation with:
194
+
195
+ ```bash
196
+ hots --config hots/config/sample_config_file.json
197
+ ```
198
+
199
+ ### Via Docker
200
+
201
+ A Docker container can be easily built for running `hots`, using the `Dockerfile` provided in the package.
202
+ If you are not used to Docker, you can follow the installation guideline here : https://docs.docker.com/engine/install/, and the post-install process here (Linux) : https://docs.docker.com/engine/install/linux-postinstall/.
203
+
204
+ As soon as Docker is setup, you can run the following commands (being at the root of the directory, with the Dockerfile) :
205
+
206
+ ```bash
207
+ docker build -t hots .
208
+ ```
209
+
210
+ The image runs `hots` by default, so arguments go straight to it:
211
+
212
+ ```bash
213
+ docker run --rm hots --version
214
+ ```
215
+
216
+ To get a shell instead, in which you can follow the same steps as for Python:
217
+
218
+ ```bash
219
+ docker run -it --rm --entrypoint /bin/bash hots
220
+ ```
221
+
222
+ ## Credits
223
+
224
+ Authors:
225
+
226
+ - Etienne Leclercq - Software design, lead developer
227
+ - Jonathan Rivalan - Product owner, Lead designer
228
+ - Mufaddal Enayath Hussain
229
+ - Marco Mariani
230
+ - Gilles Lenfant
231
+ - Soobash Daiboo
232
+ - Kang Du
233
+ - Amaury Sauret
234
+ - SMILE R&D
235
+
236
+ As HOTS was created during a PhD, credits have to be given to academic supervisors, Céline Rouveirol and Frédéric Roupin, involved in the algorithm thinking.
237
+
238
+ ## Links
239
+
240
+ - [Project home](https://github.com/Smile-SA/hots)
241
+ - [File issues (bugs, ...)](https://github.com/Smile-SA/hots/issues)
242
+ - [PyPi package](https://pypi.org/project/hots/)
243
+ - [Documentation](https://hots.readthedocs.io/en/latest/)
244
+ - [PhD document](https://theses.hal.science/tel-03997934)
245
+
246
+ ## License
247
+
248
+ This software is provided under the terms of the MIT license you can read in the `LICENSE.txt` file of the repository or the package.
hots-2.1.0/VERSION.txt ADDED
@@ -0,0 +1 @@
1
+ 2.1.0
@@ -0,0 +1,30 @@
1
+ """Expose the package version."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from importlib.metadata import PackageNotFoundError, version
6
+ from pathlib import Path
7
+
8
+
9
+ def _read_dist_version() -> str | None:
10
+ """Version of the installed distribution (VERSION.txt at build time)."""
11
+ try:
12
+ return version("hots")
13
+ except PackageNotFoundError:
14
+ return None
15
+
16
+
17
+ def _read_version_txt() -> str | None:
18
+ """VERSION.txt of a source checkout that isn't installed.
19
+
20
+ Returns None if not found/readable.
21
+ """
22
+ # repo layout: <root>/hots/__init__.py and <root>/VERSION.txt
23
+ p = Path(__file__).resolve().parent.parent / "VERSION.txt"
24
+ try:
25
+ return p.read_text(encoding="utf-8").strip()
26
+ except OSError:
27
+ return None
28
+
29
+
30
+ __version__ = _read_dist_version() or _read_version_txt() or "0.0.0"
@@ -8,11 +8,14 @@ from hots.utils.logging_config import setup_logging
8
8
 
9
9
 
10
10
  @click.command()
11
+ @click.version_option(package_name="hots")
11
12
  @click.option(
12
- '--config', '-c', 'config_path',
13
+ "--config",
14
+ "-c",
15
+ "config_path",
13
16
  required=True,
14
17
  type=click.Path(exists=True),
15
- help='Path to the JSON config file'
18
+ help="Path to the JSON config file",
16
19
  )
17
20
  def main(config_path):
18
21
  """Load the configuration and run the HOTS application."""
@@ -28,5 +31,5 @@ def main(config_path):
28
31
  app.run()
29
32
 
30
33
 
31
- if __name__ == '__main__':
34
+ if __name__ == "__main__":
32
35
  main()