SIENTIAPDE-1231
Enhance validation script and refactor code in various modules - Updated the validation script to include automatic code formatting and linting fixes using Ruff. - Removed the `clean_tmp_files` method from the Gates class to streamline functionality. - Simplified conditional checks in the OpcRepository for better clarity and error handling. - Added model ID to the minimal retrain workflow for improved tracking. - Introduced new test cases for error handling in MLFlow and storage operations, ensuring robustness in repository interactions.
This commit is contained in:
@@ -304,7 +304,7 @@ class MLFlowRepository:
|
||||
if model_type == 'predict':
|
||||
model = self.load_predict_model(model_name, flavor)
|
||||
|
||||
elif model_type == 'transform':
|
||||
else:
|
||||
model = self.load_transform_model(model_name, flavor)
|
||||
|
||||
return model, artifact_path
|
||||
|
||||
@@ -92,14 +92,11 @@ class OpcRepository:
|
||||
- Session Timeout: 10,000,000 ms
|
||||
"""
|
||||
|
||||
if not all([self.cert_path, self.private_key_path]):
|
||||
if self.cert_path is None or self.private_key_path is None:
|
||||
raise ValueError(
|
||||
'Certificate and private key paths must be provided for secure connection.'
|
||||
)
|
||||
|
||||
if self.cert_path is None or self.private_key_path is None:
|
||||
raise ValueError('Certificate and private key paths cannot be None')
|
||||
|
||||
cert = Path(self.cert_path)
|
||||
private_key = Path(self.private_key_path)
|
||||
server_cert = Path(self.server_cert_path) if self.server_cert_path else None
|
||||
@@ -316,14 +313,8 @@ class OpcRepository:
|
||||
start_time = time.time()
|
||||
|
||||
try:
|
||||
if self.client is None:
|
||||
return False, {
|
||||
'notification_id': f'OPC_WRITE_GET_NODE_ERROR_{self.id}',
|
||||
'message': 'Client is not initialized',
|
||||
'block': 'opc_repository',
|
||||
'level': NotificationLevel.ERROR,
|
||||
}
|
||||
node_obj = self.client.get_node(node)
|
||||
# ignored because self.validate_connection is called before, so we know self.client is not None
|
||||
node_obj = self.client.get_node(node) # type: ignore[union-attr]
|
||||
except Exception as e:
|
||||
trace = traceback.format_exc()
|
||||
logger.custom_error(trace, metadata.get('schedule_name', 'N/A'))
|
||||
|
||||
Reference in New Issue
Block a user