File tree Expand file tree Collapse file tree 6 files changed +13
-21
lines changed
packages/service-library/src/servicelib
fastapi/long_running_tasks
director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core
dynamic-sidecar/tests/unit Expand file tree Collapse file tree 6 files changed +13
-21
lines changed Original file line number Diff line number Diff line change 11import asyncio
22from asyncio .log import logger
3+ from collections .abc import AsyncIterator
34from contextlib import asynccontextmanager
4- from typing import Any , AsyncIterator , Final
5+ from typing import Any , Final
56
67from pydantic import PositiveFloat
78
@@ -87,7 +88,7 @@ async def periodic_task_result(
8788 - `status_poll_interval` optional: when waiting for a task to finish,
8889 how frequent should the server be queried
8990
90- raises: `TaskClientResultError ` if the task finished with an error instead of
91+ raises: `Exception ` if the task finished with an error instead of
9192 the expected result
9293 raises: `asyncio.TimeoutError` NOTE: the remote task will also be removed
9394 """
Original file line number Diff line number Diff line change 2727from yarl import URL
2828
2929from ...long_running_tasks ._constants import DEFAULT_POLL_INTERVAL_S , HOUR
30- from ...long_running_tasks ._errors import TaskClientResultError
3130from ...long_running_tasks ._models import (
3231 ClientConfiguration ,
3332 LRTask ,
@@ -159,7 +158,6 @@ async def long_running_task_request(
159158 "ProgressCallback" ,
160159 "ProgressMessage" ,
161160 "ProgressPercent" ,
162- "TaskClientResultError" ,
163161 "TaskId" ,
164162 "TaskResult" ,
165163 "periodic_task_result" ,
Original file line number Diff line number Diff line change @@ -46,8 +46,3 @@ class GenericClientError(BaseLongRunningError):
4646 msg_template : str = (
4747 "Unexpected error while '{action}' for '{task_id}': status={status} body={body}"
4848 )
49-
50-
51- class TaskClientResultError (BaseLongRunningError ):
52- code : str = "long_running_task.client.task_raised_error"
53- msg_template : str = "{message}"
Original file line number Diff line number Diff line change 2020from models_library .user_preferences import FrontendUserPreference
2121from models_library .users import UserID
2222from servicelib .fastapi .http_client_thin import BaseHttpClientError
23- from servicelib .fastapi .long_running_tasks .client import (
24- ProgressCallback ,
25- TaskClientResultError ,
26- )
23+ from servicelib .fastapi .long_running_tasks .client import ProgressCallback
2724from servicelib .fastapi .long_running_tasks .server import TaskProgress
2825from servicelib .logging_utils import log_context
2926from servicelib .rabbitmq import RabbitMQClient
@@ -138,7 +135,7 @@ async def service_remove_containers(
138135 await sidecars_client .stop_service (
139136 scheduler_data .endpoint , progress_callback = progress_callback
140137 )
141- except ( BaseHttpClientError , TaskClientResultError ) as e :
138+ except BaseHttpClientError as e :
142139 _logger .info (
143140 (
144141 "Could not remove service containers for %s. "
@@ -373,7 +370,7 @@ async def attempt_pod_removal_and_data_saving(
373370 scheduler_data .dynamic_sidecar .were_state_and_outputs_saved = True
374371
375372 _logger .info ("dynamic-sidecar saved: state and output ports" )
376- except ( BaseHttpClientError , TaskClientResultError ) as e :
373+ except BaseHttpClientError as e :
377374 _logger .error ( # noqa: TRY400
378375 (
379376 "Could not contact dynamic-sidecar to save service "
Original file line number Diff line number Diff line change 3030from pytest_simcore .helpers .monkeypatch_envs import EnvVarsDict
3131from servicelib .fastapi .long_running_tasks .client import (
3232 Client ,
33- TaskClientResultError ,
3433 TaskId ,
3534 periodic_task_result ,
3635)
4645from simcore_service_dynamic_sidecar .models .shared_store import SharedStore
4746from simcore_service_dynamic_sidecar .modules .inputs import enable_inputs_pulling
4847from simcore_service_dynamic_sidecar .modules .outputs ._context import OutputsContext
49- from simcore_service_dynamic_sidecar .modules .outputs ._manager import OutputsManager
48+ from simcore_service_dynamic_sidecar .modules .outputs ._manager import (
49+ OutputsManager ,
50+ UploadPortsFailedError ,
51+ )
5052
5153FAST_STATUS_POLL : Final [float ] = 0.1
5254CREATE_SERVICE_CONTAINERS_TIMEOUT : Final [float ] = 60
@@ -682,7 +684,7 @@ async def _test_code() -> None:
682684 if not mock_port_keys :
683685 await _test_code ()
684686 else :
685- with pytest .raises (TaskClientResultError ) as exec_info :
687+ with pytest .raises (UploadPortsFailedError ) as exec_info :
686688 await _test_code ()
687689 assert f"the node id { missing_node_uuid } was not found" in f"{ exec_info .value } "
688690
Original file line number Diff line number Diff line change 3434from pytest_simcore .helpers .monkeypatch_envs import EnvVarsDict , setenvs_from_dict
3535from servicelib .fastapi .long_running_tasks .client import (
3636 Client ,
37- TaskClientResultError ,
3837 TaskId ,
3938 periodic_task_result ,
4039)
@@ -262,7 +261,7 @@ async def test_user_services_fail_to_start(
262261 with_compose_down : bool ,
263262 mock_user_services_fail_to_start : None ,
264263):
265- with pytest .raises (TaskClientResultError ):
264+ with pytest .raises (RuntimeError ):
266265 async with periodic_task_result (
267266 client = client ,
268267 task_id = await _get_task_id_create_service_containers (
@@ -318,7 +317,7 @@ async def test_user_services_fail_to_stop_or_save_data(
318317 # in case of manual intervention multiple stops will be sent
319318 _EXPECTED_STOP_MESSAGES = 4
320319 for _ in range (_EXPECTED_STOP_MESSAGES ):
321- with pytest .raises (TaskClientResultError ):
320+ with pytest .raises (RuntimeError ):
322321 async with periodic_task_result (
323322 client = client ,
324323 task_id = await _get_task_id_docker_compose_down (httpx_async_client ),
You can’t perform that action at this time.
0 commit comments