1515from pydantic import TypeAdapter
1616from pydantic .types import PositiveInt
1717from servicelib .aiohttp import status
18+ from servicelib .exception_utils import suppress_exceptions
1819from servicelib .logging_errors import create_troubleshotting_log_kwargs
1920from servicelib .logging_utils import log_decorator
2021from simcore_postgres_database .utils_groups_extra_properties import (
@@ -112,7 +113,6 @@ async def is_pipeline_running(
112113async def get_computation_task (
113114 app : web .Application , user_id : UserID , project_id : ProjectID
114115) -> ComputationTask | None :
115-
116116 try :
117117 dv2_computation = await DirectorV2RestClient (app ).get_computation (
118118 project_id = project_id , user_id = user_id
@@ -131,7 +131,17 @@ async def get_computation_task(
131131 return None
132132
133133
134+ def _skip_if_pipeline_not_found (exception : BaseException ) -> bool :
135+ assert isinstance (exception , DirectorV2ServiceError ) # nosec
136+ return exception .status == status .HTTP_404_NOT_FOUND
137+
138+
134139@log_decorator (logger = _logger )
140+ @suppress_exceptions (
141+ (DirectorV2ServiceError ,),
142+ reason = "silence in case the pipeline does not exist" ,
143+ predicate = _skip_if_pipeline_not_found ,
144+ )
135145async def stop_pipeline (
136146 app : web .Application , * , user_id : PositiveInt , project_id : ProjectID
137147):
0 commit comments