SIENTIAPDE-1171
feat: enhance test coverage for minimal_retrain workflow - Added a new test for the minimal_retrain function to validate its configuration output. - Updated the test_process_schedules to include a new schedule entry for minimal_retrain, ensuring comprehensive testing of the workflow integration.
This commit is contained in:
@@ -34,7 +34,9 @@ metadata = {
|
|||||||
return_value={"test_scouter": "test_scouter"})
|
return_value={"test_scouter": "test_scouter"})
|
||||||
@patch("orchestrator.activities.formatters.predictions_batch",
|
@patch("orchestrator.activities.formatters.predictions_batch",
|
||||||
return_value={"test_predictions_batch": "test_predictions_batch"})
|
return_value={"test_predictions_batch": "test_predictions_batch"})
|
||||||
async def test_process_schedules(mock_predictions_batch, mock_scouter, formatters):
|
@patch("orchestrator.activities.formatters.minimal_retrain",
|
||||||
|
return_value={"test_minimal_retrain": "test_minimal_retrain"})
|
||||||
|
async def test_process_schedules(mock_minimal_retrain, mock_predictions_batch, mock_scouter, formatters):
|
||||||
input_data = {
|
input_data = {
|
||||||
"pipelines": [
|
"pipelines": [
|
||||||
{
|
{
|
||||||
@@ -50,6 +52,13 @@ async def test_process_schedules(mock_predictions_batch, mock_scouter, formatter
|
|||||||
"model_name": "test_model_name",
|
"model_name": "test_model_name",
|
||||||
"model_id": "test_model_id",
|
"model_id": "test_model_id",
|
||||||
"updated_at": "2021-01-02"
|
"updated_at": "2021-01-02"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"schedule_name": "test_schedule_name3",
|
||||||
|
"workflow_type": "minimal_retrain",
|
||||||
|
"model_name": "test_model_name",
|
||||||
|
"model_id": "test_model_id",
|
||||||
|
"updated_at": "2021-01-03"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -67,6 +76,10 @@ async def test_process_schedules(mock_predictions_batch, mock_scouter, formatter
|
|||||||
"test_schedule_name2": {
|
"test_schedule_name2": {
|
||||||
"test_predictions_batch": "test_predictions_batch",
|
"test_predictions_batch": "test_predictions_batch",
|
||||||
"updated_at": "2021-01-02"
|
"updated_at": "2021-01-02"
|
||||||
|
},
|
||||||
|
"test_schedule_name3": {
|
||||||
|
"test_minimal_retrain": "test_minimal_retrain",
|
||||||
|
"updated_at": "2021-01-03"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from unittest.mock import patch, call
|
from unittest.mock import patch, call
|
||||||
from orchestrator.utils.orchestrator_functions import (
|
from orchestrator.utils.orchestrator_functions import (
|
||||||
common_config,
|
common_config,
|
||||||
|
minimal_retrain,
|
||||||
scouter,
|
scouter,
|
||||||
predictions_batch,
|
predictions_batch,
|
||||||
overlap_filter_config,
|
overlap_filter_config,
|
||||||
@@ -31,6 +32,31 @@ def test_common_config():
|
|||||||
assert result == expected
|
assert result == expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_minimal_retrain():
|
||||||
|
config = {
|
||||||
|
"workflow_type": "minimal_retrain",
|
||||||
|
"schedule_name": "test_schedule",
|
||||||
|
"model_id": "test_model_id",
|
||||||
|
"models": {
|
||||||
|
"name": "test_model_name"
|
||||||
|
},
|
||||||
|
"query": "select * from sientia_data.laborious_data order by \"timestamp\" desc limit 30;",
|
||||||
|
}
|
||||||
|
result = minimal_retrain(config)
|
||||||
|
expected = {
|
||||||
|
"workflow_type": "minimal_retrain",
|
||||||
|
"schedule_name": "test_schedule",
|
||||||
|
"frequency": "1m",
|
||||||
|
"max_retry_policy": 1,
|
||||||
|
"model_id": "test_model_id",
|
||||||
|
"model_name": "test_model_name",
|
||||||
|
"query": "select * from sientia_data.laborious_data order by \"timestamp\" desc limit 30;",
|
||||||
|
"schema": "sientia_data",
|
||||||
|
"table_name": "log_retrain",
|
||||||
|
}
|
||||||
|
assert result == expected
|
||||||
|
|
||||||
|
|
||||||
def test_scouter():
|
def test_scouter():
|
||||||
config = {
|
config = {
|
||||||
"workflow_type": "scouter",
|
"workflow_type": "scouter",
|
||||||
|
|||||||
Reference in New Issue
Block a user