Skip to content

Commit e9f2f67

Browse files
committed
do not raise exception when stopping a non existent pipeline
1 parent 17a8640 commit e9f2f67

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

services/web/server/src/simcore_service_webserver/director_v2/_director_v2_service.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from pydantic import TypeAdapter
1616
from pydantic.types import PositiveInt
1717
from servicelib.aiohttp import status
18+
from servicelib.exception_utils import suppress_exceptions
1819
from servicelib.logging_errors import create_troubleshotting_log_kwargs
1920
from servicelib.logging_utils import log_decorator
2021
from simcore_postgres_database.utils_groups_extra_properties import (
@@ -112,7 +113,6 @@ async def is_pipeline_running(
112113
async 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+
)
135145
async def stop_pipeline(
136146
app: web.Application, *, user_id: PositiveInt, project_id: ProjectID
137147
):

0 commit comments

Comments
 (0)