SIENTIAPDE-1255: Refactor worker to support only the train_model-queue and remove prediction workflows.
This commit is contained in:
@@ -125,7 +125,7 @@ async def test_main_success(
|
||||
namespace='test-namespace',
|
||||
runtime=ANY,
|
||||
)
|
||||
assert mock_worker.call_count == 2 # Two workers created
|
||||
assert mock_worker.call_count == 1 # Only one worker created
|
||||
mock_gather.assert_called_once()
|
||||
mock_sys_exit.assert_called_once_with(1)
|
||||
|
||||
@@ -201,7 +201,7 @@ async def test_main_exception_handling(
|
||||
@patch('model_manager.worker.worker.NotificationHandler')
|
||||
@patch('model_manager.worker.worker.start_prometheus_server')
|
||||
@patch('model_manager.worker.worker.get_logger')
|
||||
async def test_main_creates_two_workers(
|
||||
async def test_main_creates_only_one_worker(
|
||||
mock_get_logger,
|
||||
mock_start_prometheus,
|
||||
mock_notification_handler,
|
||||
@@ -213,7 +213,7 @@ async def test_main_creates_two_workers(
|
||||
mock_sys_exit,
|
||||
mock_env_vars,
|
||||
):
|
||||
"""Test that main creates two workers with correct configurations."""
|
||||
"""Test that main creates only one worker with correct configurations."""
|
||||
# Arrange
|
||||
mock_logger = MagicMock()
|
||||
mock_get_logger.return_value = mock_logger
|
||||
@@ -240,18 +240,13 @@ async def test_main_creates_two_workers(
|
||||
# Act
|
||||
await main()
|
||||
|
||||
# Assert - Verify two workers were created
|
||||
assert mock_worker.call_count == 2
|
||||
# Assert - Verify only one worker was created
|
||||
assert mock_worker.call_count == 1
|
||||
|
||||
# Verify first worker (minimal_retrain-queue)
|
||||
# Verify worker (train_model-queue)
|
||||
first_call = mock_worker.call_args_list[0]
|
||||
assert first_call[1]['task_queue'] == 'minimal_retrain-queue'
|
||||
assert 'MinimalRetrain' in str(first_call[1]['workflows'])
|
||||
|
||||
# Verify second worker (predictions_batch-queue)
|
||||
second_call = mock_worker.call_args_list[1]
|
||||
assert second_call[1]['task_queue'] == 'predictions_batch-queue'
|
||||
assert 'PredictionsBatch' in str(second_call[1]['workflows'])
|
||||
assert first_call[1]['task_queue'] == 'train_model-queue'
|
||||
assert 'TrainModel' in str(first_call[1]['workflows'])
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user