SIENTIAPDE-1174
Update requirements and refactor manager classes to remove pod_id - Updated the sientia-dataops-library dependency version to 1.3.8 in requirements.txt. - Refactored IngestorManager, OpcManager, and ResourceManager classes to remove pod_id from their initialization and internal handling, enhancing code clarity and consistency. - Adjusted unit tests to reflect the removal of pod_id, ensuring they remain functional and accurate.
This commit is contained in:
@@ -16,14 +16,15 @@ class ResourceManager(BaseActivity):
|
||||
port: int,
|
||||
lease_ttl: int,
|
||||
heartbeat_ttl: int,
|
||||
pod_id: str,
|
||||
metadata: dict,
|
||||
logger: Logger,
|
||||
notification_handler: NotificationHandler,
|
||||
username: str | None = None,
|
||||
password: str | None = None,
|
||||
) -> None:
|
||||
self.pod_id = pod_id
|
||||
BaseActivity.__init__(self, logger=logger,
|
||||
notification_handler=notification_handler,
|
||||
set_error_counter=True)
|
||||
try:
|
||||
self.redis = Redis(
|
||||
host=host,
|
||||
@@ -35,7 +36,7 @@ class ResourceManager(BaseActivity):
|
||||
self.redis.ping()
|
||||
metrics.REDIS_CONNECTION_STATUS.labels(pod_id=self.pod_id).set(1)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to connect to Redis: {e}")
|
||||
self.logger.error(f"Failed to connect to Redis: {e}")
|
||||
metrics.REDIS_CONNECTION_STATUS.labels(pod_id=self.pod_id).set(0)
|
||||
raise
|
||||
|
||||
@@ -43,10 +44,6 @@ class ResourceManager(BaseActivity):
|
||||
self.heartbeat_ttl = heartbeat_ttl
|
||||
self.metadata = metadata
|
||||
|
||||
BaseActivity.__init__(self, logger=logger,
|
||||
notification_handler=notification_handler,
|
||||
set_error_counter=True)
|
||||
|
||||
def _execute_redis_op(self, operation_name: str, func, *args, **kwargs):
|
||||
"""Wrapper to execute Redis operations and record metrics."""
|
||||
start_time = time()
|
||||
|
||||
Reference in New Issue
Block a user