SIENTIAPDE-1273
Implement drift monitoring configuration and update formatters to support drift workflows. Add drift function to orchestrator utilities and enhance tests for drift functionality.
This commit is contained in:
@@ -44,8 +44,12 @@ metadata = {
|
||||
'orchestrator.activities.formatters.minimal_retrain',
|
||||
return_value={'test_minimal_retrain': 'test_minimal_retrain'},
|
||||
)
|
||||
@patch(
|
||||
'orchestrator.activities.formatters.drift',
|
||||
return_value={'test_drift': 'test_drift'},
|
||||
)
|
||||
async def test_process_schedules(
|
||||
mock_minimal_retrain, mock_predictions_batch, mock_scouter, formatters
|
||||
mock_drift, mock_minimal_retrain, mock_predictions_batch, mock_scouter, formatters
|
||||
):
|
||||
input_data = {
|
||||
'pipelines': [
|
||||
@@ -70,6 +74,13 @@ async def test_process_schedules(
|
||||
'model_id': 'test_model_id',
|
||||
'updated_at': '2021-01-03',
|
||||
},
|
||||
{
|
||||
'schedule_name': 'test_schedule_name4',
|
||||
'workflow_type': 'drift',
|
||||
'model_name': 'test_model_name',
|
||||
'model_id': 'test_model_id',
|
||||
'updated_at': '2021-01-04',
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -88,11 +99,17 @@ async def test_process_schedules(
|
||||
'test_minimal_retrain': 'test_minimal_retrain',
|
||||
'updated_at': '2021-01-03',
|
||||
},
|
||||
'test_schedule_name4': {
|
||||
'test_drift': 'test_drift',
|
||||
'updated_at': '2021-01-04',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
mock_scouter.assert_called_once_with(input_data['pipelines'][0])
|
||||
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])
|
||||
|
||||
|
||||
@mark.asyncio
|
||||
|
||||
@@ -3,6 +3,7 @@ from unittest.mock import call, patch
|
||||
from orchestrator.utils.orchestrator_functions import (
|
||||
build_tag_config,
|
||||
common_config,
|
||||
drift,
|
||||
gather_read_tags,
|
||||
minimal_retrain,
|
||||
overlap_filter_config,
|
||||
@@ -35,6 +36,36 @@ def test_common_config():
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_drift():
|
||||
config = {
|
||||
'workflow_type': 'drift',
|
||||
'schedule_name': 'test_schedule',
|
||||
'model_id': 'test_model_id',
|
||||
'model': {'name': 'test_model_name', 'model_config': {'test_config': 'test_config'}},
|
||||
'interval_minutes': 120,
|
||||
'drift_metrics': ['kolmogorov_smirnov', 'jensen_shannon'],
|
||||
}
|
||||
result = drift(config)
|
||||
expected = {
|
||||
'workflow_type': 'drift',
|
||||
'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',
|
||||
'source_table_name': 'laborious_data',
|
||||
'target_table_name': 'drift_metrics',
|
||||
'interval': 120,
|
||||
'drift_metrics': ['kolmogorov_smirnov', 'jensen_shannon'],
|
||||
'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