Skip to content

Commit fe881f5

Browse files
committed
ongoing
1 parent 1913439 commit fe881f5

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

services/dask-sidecar/src/simcore_service_dask_sidecar/computational_sidecar/docker_utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,14 @@ async def managed_monitor_container_log_task( # noqa: PLR0913 # pylint: disable
454454
yield monitoring_task
455455
# wait for task to complete, so we get the complete log
456456
await monitoring_task
457+
except Exception:
458+
_logger.exception(
459+
"Error while monitoring logs of container %s for service %s:%s",
460+
container.id,
461+
service_key,
462+
service_version,
463+
)
464+
raise
457465
finally:
458466
if monitoring_task:
459467
with log_context(_logger, logging.DEBUG, "cancel logs monitoring task"):

services/dask-sidecar/tests/unit/test_computational_sidecar_tasks.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,3 +889,35 @@ def test_delayed_logging_with_small_timeout_raises_exception(
889889
10, # larger timeout to avoid issues
890890
)
891891
run_computational_sidecar(**waiting_task.sidecar_params())
892+
893+
894+
@pytest.mark.parametrize(
895+
"integration_version, boot_mode", [("1.0.0", BootMode.CPU)], indirect=True
896+
)
897+
def test_run_sidecar_with_managed_monitor_container_log_task_raising(
898+
app_environment: EnvVarsDict,
899+
dask_subsystem_mock: dict[str, mock.Mock],
900+
sidecar_task: Callable[..., ServiceExampleParam],
901+
mocked_get_image_labels: mock.Mock,
902+
mocker: MockerFixture,
903+
):
904+
"""https://github.com/aio-libs/aiodocker/issues/901"""
905+
# Mock the timeout with a very small value
906+
907+
mocker.patch(
908+
"simcore_service_dask_sidecar.computational_sidecar.docker_utils.managed_monitor_container_log_task",
909+
side_effect=RuntimeError("Simulated log monitoring failure"),
910+
)
911+
912+
# Configure the task to sleep first and then generate logs
913+
waiting_task = sidecar_task(
914+
command=[
915+
"/bin/bash",
916+
"-c",
917+
'echo "Starting task"; sleep 5; echo "After sleep"',
918+
]
919+
)
920+
921+
# Execute the task and expect a timeout exception in the logs
922+
run_computational_sidecar(**waiting_task.sidecar_params())
923+
pytest.fail("TODO: check that the generic error is raised")

0 commit comments

Comments
 (0)