Merge branch 'feature/SIENTIAPDE-1972-gateway-write-read' into feature/SIENTIAPDE-1972-gateway-wiring
# Conflicts: # README.md # requirements.txt
This commit is contained in:
@@ -19,7 +19,7 @@ class Ingestor(SientiaMonitoring):
|
||||
- Managing slot leases for load balancing across multiple instances
|
||||
- Connecting to and monitoring OPC UA servers
|
||||
- Subscribing to OPC tags and collecting real-time data
|
||||
- Persisting data to MongoDB
|
||||
- Distributing data to MongoDB
|
||||
- Providing health monitoring and metrics collection
|
||||
|
||||
The ingestor uses a slot-based architecture where each slot represents
|
||||
@@ -146,7 +146,7 @@ class Ingestor(SientiaMonitoring):
|
||||
else:
|
||||
# Subscribe to acquired slots
|
||||
if self.ingestor_manager:
|
||||
self.ingestor_manager.update_opc_servers()
|
||||
await self.ingestor_manager.update_opc_servers()
|
||||
await self.ingestor_manager.subscribe_to_tags(acquired)
|
||||
|
||||
async def prepare_ingestor(self):
|
||||
|
||||
@@ -48,9 +48,6 @@ class DataManager(SientiaMonitoring):
|
||||
"""
|
||||
Initializes the DataManager instance with a MongoDB connection.
|
||||
|
||||
This constructor establishes a connection to MongoDB and verifies server
|
||||
availability.
|
||||
|
||||
Args:
|
||||
mongo_connection_string (str): MongoDB connection string
|
||||
mongo_database (str): MongoDB database name
|
||||
@@ -90,10 +87,6 @@ class DataManager(SientiaMonitoring):
|
||||
def shutdown(self):
|
||||
"""
|
||||
Gracefully shuts down the DataManager and closes all connections.
|
||||
|
||||
This method ensures proper cleanup of the MongoDB client connection,
|
||||
logging any errors that occur during shutdown while ensuring all
|
||||
resources are properly released.
|
||||
"""
|
||||
try:
|
||||
self.mongo_repository.close()
|
||||
@@ -105,11 +98,11 @@ class DataManager(SientiaMonitoring):
|
||||
|
||||
async def publish(self, topic: str, data: dict) -> None:
|
||||
"""
|
||||
Persists a message to the specified MongoDB collection.
|
||||
Persists a message to MongoDB.
|
||||
|
||||
Args:
|
||||
topic (str): The name of the MongoDB collection to persist to.
|
||||
data (dict): The message data to be inserted.
|
||||
topic (str): The name of the MongoDB collection to which the message will be written.
|
||||
data (dict): The message data to be stored.
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import asyncio
|
||||
import traceback
|
||||
from copy import deepcopy
|
||||
|
||||
@@ -188,9 +187,6 @@ class IngestorManager(SientiaMonitoring):
|
||||
await server.shutdown()
|
||||
self.data_manager.shutdown()
|
||||
|
||||
def __del__(self):
|
||||
asyncio.run(self.shutdown())
|
||||
|
||||
async def remove_server(self, server: str):
|
||||
"""
|
||||
Removes an OPC server from the ingestor.
|
||||
|
||||
@@ -112,9 +112,6 @@ class OpcManager(SientiaMonitoring):
|
||||
f'nodes={self.nodes}, subscriptions={self.subscriptions}'
|
||||
)
|
||||
|
||||
def __del__(self):
|
||||
asyncio.run(self.shutdown())
|
||||
|
||||
async def shutdown(self):
|
||||
"""
|
||||
Comprehensive cleanup method for graceful shutdown.
|
||||
@@ -162,6 +159,7 @@ class OpcManager(SientiaMonitoring):
|
||||
cert = str(Path(self.cert_path)) if self.cert_path else None
|
||||
private_key = str(Path(self.private_key_path)) if self.private_key_path else None
|
||||
server_cert = str(Path(self.server_cert_path)) if self.server_cert_path else None
|
||||
assert cert is not None and private_key is not None
|
||||
|
||||
if self.client:
|
||||
self.client.application_uri = self.server_uri
|
||||
@@ -209,7 +207,7 @@ class OpcManager(SientiaMonitoring):
|
||||
assert self.client is not None # Informa ao mypy que client não é None
|
||||
|
||||
self.client.name = self.pod_id
|
||||
self.client.application_name = self.pod_id
|
||||
self.client.description = self.pod_id
|
||||
pod_uri = self.pod_id.replace('-', ':')
|
||||
self.client.application_uri = pod_uri
|
||||
self.client.product_uri = pod_uri
|
||||
|
||||
Reference in New Issue
Block a user