SIENTIAPDE-1273
Implement simple metrics configuration in formatters and orchestrator utilities. Update tests to validate new simple metrics functionality and ensure proper integration with existing workflows.
This commit is contained in:
@@ -48,8 +48,17 @@ metadata = {
|
||||
'orchestrator.activities.formatters.drift',
|
||||
return_value={'test_drift': 'test_drift'},
|
||||
)
|
||||
@patch(
|
||||
'orchestrator.activities.formatters.simple_metrics',
|
||||
return_value={'test_simple_metrics': 'test_simple_metrics'},
|
||||
)
|
||||
async def test_process_schedules(
|
||||
mock_drift, mock_minimal_retrain, mock_predictions_batch, mock_scouter, formatters
|
||||
mock_simple_metrics,
|
||||
mock_drift,
|
||||
mock_minimal_retrain,
|
||||
mock_predictions_batch,
|
||||
mock_scouter,
|
||||
formatters,
|
||||
):
|
||||
input_data = {
|
||||
'pipelines': [
|
||||
@@ -81,6 +90,13 @@ async def test_process_schedules(
|
||||
'model_id': 'test_model_id',
|
||||
'updated_at': '2021-01-04',
|
||||
},
|
||||
{
|
||||
'schedule_name': 'test_schedule_name5',
|
||||
'workflow_type': 'simple_metrics',
|
||||
'model_name': 'test_model_name',
|
||||
'model_id': 'test_model_id',
|
||||
'updated_at': '2021-01-05',
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -103,6 +119,10 @@ async def test_process_schedules(
|
||||
'test_drift': 'test_drift',
|
||||
'updated_at': '2021-01-04',
|
||||
},
|
||||
'test_schedule_name5': {
|
||||
'test_simple_metrics': 'test_simple_metrics',
|
||||
'updated_at': '2021-01-05',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -110,6 +130,7 @@ async def test_process_schedules(
|
||||
mock_predictions_batch.assert_called_once_with(input_data['pipelines'][1])
|
||||
mock_minimal_retrain.assert_called_once_with(input_data['pipelines'][2])
|
||||
mock_drift.assert_called_once_with(input_data['pipelines'][3])
|
||||
mock_simple_metrics.assert_called_once_with(input_data['pipelines'][4])
|
||||
|
||||
|
||||
@mark.asyncio
|
||||
|
||||
@@ -18,8 +18,7 @@ metadata = {
|
||||
|
||||
|
||||
@fixture
|
||||
@patch('orchestrator.activities.temporal_manager.Client.connect')
|
||||
def temporal_manager(connect_mock):
|
||||
def temporal_manager():
|
||||
temporal_manager = TemporalManager(
|
||||
host='localhost:7233',
|
||||
scouter_namespace='scouter',
|
||||
|
||||
@@ -10,6 +10,7 @@ from orchestrator.utils.orchestrator_functions import (
|
||||
predictions_batch,
|
||||
process_path_priority,
|
||||
scouter,
|
||||
simple_metrics,
|
||||
)
|
||||
|
||||
|
||||
@@ -66,6 +67,36 @@ def test_drift():
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_simple_metrics():
|
||||
config = {
|
||||
'workflow_type': 'simple_metrics',
|
||||
'schedule_name': 'test_schedule',
|
||||
'model_id': 'test_model_id',
|
||||
'model': {'name': 'test_model_name', 'model_config': {'test_config': 'test_config'}},
|
||||
'interval_minutes': 120,
|
||||
'metrics': ['rmse', 'mse'],
|
||||
}
|
||||
result = simple_metrics(config)
|
||||
expected = {
|
||||
'workflow_type': 'simple_metrics',
|
||||
'schedule_name': 'test_schedule',
|
||||
'frequency': '1m',
|
||||
'offset': '0m',
|
||||
'max_retry_policy': 1,
|
||||
'model_id': 'test_model_id',
|
||||
'model_name': 'test_model_name',
|
||||
'model_config': {'test_config': 'test_config'},
|
||||
'schema': 'sientia_data',
|
||||
'predictions_table_name': 'predictions',
|
||||
'data_table_name': 'laborious_data',
|
||||
'interval_minutes': 120,
|
||||
'metrics': ['rmse', 'mse'],
|
||||
'execution_timeout_seconds': 300,
|
||||
'task_timeout_seconds': 300,
|
||||
}
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_minimal_retrain():
|
||||
config = {
|
||||
'workflow_type': 'minimal_retrain',
|
||||
|
||||
Reference in New Issue
Block a user