added versioning

This commit is contained in:
Lucas Armand
2025-10-21 15:42:43 -07:00
parent e9ba1b03e4
commit 9a6ca5d412
3 changed files with 10 additions and 0 deletions
+4
View File
@@ -29,6 +29,8 @@ from lib.data_types import (
RequestMetrics
)
VERSION = "0.1.0"
MSG_HISTORY_LEN = 100
log = logging.getLogger(__file__)
@@ -57,6 +59,7 @@ class Backend:
log_actions: List[Tuple[LogAction, str]]
max_wait_time: float = 10.0
reqnum = -1
version = VERSION
msg_history = []
sem: Semaphore = dataclasses.field(default_factory=Semaphore)
unsecured: bool = dataclasses.field(
@@ -65,6 +68,7 @@ class Backend:
def __post_init__(self):
self.metrics = Metrics()
self.metrics._set_version(self.version)
self._total_pubkey_fetch_errors = 0
self._pubkey = self._fetch_pubkey()
self.__start_healthcheck: bool = False
+1
View File
@@ -273,6 +273,7 @@ class AutoScalerData:
"""Data that is reported to autoscaler"""
id: int
version: str
loadtime: float
cur_load: float
rej_load: float
+5
View File
@@ -27,6 +27,7 @@ def get_url() -> str:
@dataclass
class Metrics:
version: str = "0"
last_metric_update: float = 0.0
last_request_served: float = 0.0
update_pending: bool = False
@@ -120,6 +121,9 @@ class Metrics:
self.model_metrics.set_errored(error_msg)
self.system_metrics.model_is_loaded = True
def _set_version(self, version: str) -> None:
self.version = version
#######################################Private#######################################
def __send_delete_requests_and_reset(self):
@@ -154,6 +158,7 @@ class Metrics:
def compute_autoscaler_data() -> AutoScalerData:
return AutoScalerData(
id=self.id,
version=self.version,
loadtime=(self.system_metrics.model_loading_time or 0.0),
new_load=self.model_metrics.workload_processing,
cur_load=self.model_metrics.cur_load,