Refactor error handling in Gates and OPC activities; update OPC_NAME to OPC_ID in values.yaml

This commit is contained in:
vitor-aignosi
2025-06-11 17:55:27 -03:00
parent d57ecc3041
commit fc1cd056af
3 changed files with 7 additions and 4 deletions

View File

@@ -94,6 +94,7 @@ class Gates(BaseActivity):
level=NotificationLevel.ERROR, level=NotificationLevel.ERROR,
attachment_content=trace attachment_content=trace
) )
raise e
for path_flag in path_priority: for path_flag in path_priority:
if path_flag in filter_output: if path_flag in filter_output:
@@ -157,6 +158,7 @@ class Gates(BaseActivity):
level=NotificationLevel.ERROR, level=NotificationLevel.ERROR,
attachment_content=trace attachment_content=trace
) )
raise e
for path_flag in path_priority: for path_flag in path_priority:
if path_flag in filter_output: if path_flag in filter_output:
@@ -218,6 +220,7 @@ class Gates(BaseActivity):
level=NotificationLevel.ERROR, level=NotificationLevel.ERROR,
attachment_content=trace attachment_content=trace
) )
raise e
for path_flag in path_priority: for path_flag in path_priority:
if path_flag in filter_output: if path_flag in filter_output:
@@ -229,7 +232,7 @@ class Gates(BaseActivity):
return None, 0, "" return None, 0, ""
@activity.defn(name="format_prediction") @activity.defn(name="format_prediction")
async def format_prediction(self, input_data: dict[str, Any]) -> dict[str, Any]: async def format_prediction(self, input_data: dict[str, Any]) -> dict[Any, Any]:
""" """
Formats the prediction data. Formats the prediction data.
Args: Args:
@@ -254,7 +257,7 @@ class Gates(BaseActivity):
return data.to_dict() return data.to_dict()
@activity.defn(name="format_default_prediction") @activity.defn(name="format_default_prediction")
async def format_default_prediction(self, input_data: dict[str, Any]) -> dict[str, Any]: async def format_default_prediction(self, input_data: dict[str, Any]) -> dict[Any, Any]:
""" """
Creates and formats the default prediction data, with zero value in prediction, Creates and formats the default prediction data, with zero value in prediction,
and usefull information in the other fields. and usefull information in the other fields.

View File

@@ -63,7 +63,7 @@ class OPC(BaseActivity):
level=NotificationLevel.ERROR, level=NotificationLevel.ERROR,
attachment_content=trace attachment_content=trace
) )
self.logger.error(trace) raise e
@activity.defn(name='write_opc_data') @activity.defn(name='write_opc_data')
async def write_opc_data(self, input_data: dict[str, Any]): async def write_opc_data(self, input_data: dict[str, Any]):

View File

@@ -152,7 +152,7 @@ env:
- name: MLFLOW_PASSWORD - name: MLFLOW_PASSWORD
value: "aignosi" value: "aignosi"
- name: OPC_NAME - name: OPC_ID
value: "server-1" value: "server-1"
- name: OPC_URL - name: OPC_URL
value: "opc.tcp://sientia-opc-simulator.sientia.svc.cluster.local:4840" value: "opc.tcp://sientia-opc-simulator.sientia.svc.cluster.local:4840"