SIENTIAPDE-1318

Refactor project structure and update configurations

- Deleted the empty `__init__.py` file to clean up the project structure.
- Renamed the project from "laborious" to "ingestor" in `pyproject.toml`, updating the description accordingly.
- Improved type hints and conditional checks in the `Ingestor`, `DataManager`, `IngestorManager`, and `OpcManager` classes for better code clarity and type safety.
- Enhanced error handling and assertions in various methods to ensure robustness.
- Updated unit tests to reflect changes in class names and error handling improvements.
This commit is contained in:
vitor-aignosi
2025-10-17 14:54:39 -03:00
parent e2462af31c
commit e19b57d4b1
11 changed files with 73 additions and 65 deletions

View File

@@ -72,10 +72,10 @@ class IngestorManager(BaseActivity):
notification_handler: NotificationHandler,
export_to_kafka: bool = False,
):
redis_host = redis_data.get('host')
redis_port = redis_data.get('port')
redis_username = redis_data.get('username', None)
redis_password = redis_data.get('password', None)
redis_host: str = redis_data['host']
redis_port: int = int(redis_data['port'])
redis_username: str | None = redis_data.get('username', None)
redis_password: str | None = redis_data.get('password', None)
self.data_manager = DataManager(
kafka_servers=kafka_servers,
@@ -86,7 +86,7 @@ class IngestorManager(BaseActivity):
logger=logger,
notification_handler=notification_handler,
)
self.opc_managers = {}
self.opc_managers: dict = {}
self.resource_manager = ResourceManager(
host=redis_host,
port=redis_port,
@@ -100,8 +100,8 @@ class IngestorManager(BaseActivity):
)
self.number_of_slots = 0
self.poll_interval = poll_interval
self.managed_tags = {}
self.opc_servers = {}
self.managed_tags: dict = {}
self.opc_servers: dict = {}
self.metadata = metadata
@@ -457,8 +457,7 @@ class IngestorManager(BaseActivity):
- Logs informational messages for updated slot configurations.
"""
removed_slots = []
update = {}
removed_slots: list[str] = []
for slot, _slot_config in self.managed_tags.items():
self.resource_manager.renew_tag_lease(slot)
update = self.resource_manager.get_tag_slot(slot)