Skip to content

Webserver: handle 500s from director-v2 gracefully #2202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any, Dict, List, Optional, Set, Tuple, Union
from uuid import UUID

from aiohttp import ClientTimeout, web
from aiohttp import ClientError, ClientTimeout, web
from models_library.projects_pipeline import ComputationTask
from pydantic.types import PositiveInt
from servicelib.application_setup import ModuleCategory, app_module_setup
Expand Down Expand Up @@ -60,9 +60,10 @@ async def _request_director_v2(
payload: Dict = await resp.json()
return payload

except TimeoutError as err:
raise web.HTTPServiceUnavailable(
reason="director service is currently unavailable"
except (ClientError, TimeoutError) as err:
raise _DirectorServiceError(
web.HTTPServiceUnavailable.status_code,
reason="director-v2 service is unavailable",
) from err


Expand Down