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

@@ -129,7 +129,7 @@ class DataManager(BaseActivity):
self.connection_string = mongo_connection_string
self.database = mongo_database
self.mongo_client = MongoClient(self.connection_string)
self.mongo_client: MongoClient = MongoClient(self.connection_string)
self.mongo_client.server_info()
self.metadata = metadata
@@ -176,7 +176,7 @@ class DataManager(BaseActivity):
def __del__(self):
self.shutdown()
def delivery_report(self, msg: str):
def delivery_report(self, msg):
"""
Callback for successful Kafka message delivery reports.
@@ -191,7 +191,7 @@ class DataManager(BaseActivity):
f'Record successfully produced to {msg.topic} [{msg.partition}] at offset {msg.offset}'
)
def delivery_error(self, err: str):
def delivery_error(self, err):
"""
Callback for Kafka message delivery error reports.
@@ -218,7 +218,7 @@ class DataManager(BaseActivity):
Exception: If there is an error during message delivery, it will be handled by the `delivery_error` callback.
"""
if self.export_to_kafka:
if self.export_to_kafka and self.kafka_producer:
try:
self.logger.debug(f'Publishing message to topic {topic}: {data}')
self.kafka_producer.send(topic=topic, value=data).add_callback(