Skip to content

Commit

Permalink
Log gateway request errors with stacktrace
Browse files Browse the repository at this point in the history
  • Loading branch information
r4victor committed Apr 30, 2024
1 parent e50202d commit 2761a90
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/dstack/_internal/server/services/gateways/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ async def register_service(session: AsyncSession, run_model: RunModel):
except SSHError:
raise ServerClientError("Gateway tunnel is not working")
except httpx.RequestError as e:
logger.debug("Gateway request failed", exc_info=True)
raise GatewayError(f"Gateway is not working: {e!r}")


Expand All @@ -382,6 +383,7 @@ async def register_replica(
)
logger.info("%s: replica is registered for service %s", fmt(job_model), run.id.hex)
except (httpx.RequestError, SSHError) as e:
logger.debug("Gateway request failed", exc_info=True)
raise GatewayError(repr(e))


Expand All @@ -400,6 +402,7 @@ async def unregister_service(session: AsyncSession, run_model: RunModel):
# ignore if service is not registered
logger.warning("%s: unregistering service: %s", fmt(run_model), e)
except (httpx.RequestError, SSHError) as e:
logger.debug("Gateway request failed", exc_info=True)
raise GatewayError(repr(e))


Expand Down Expand Up @@ -431,6 +434,7 @@ async def unregister_replica(session: AsyncSession, job_model: JobModel):
# ignore if replica is not registered
logger.warning("%s: unregistering replica from service: %s", fmt(job_model), e)
except (httpx.RequestError, SSHError) as e:
logger.debug("Gateway request failed", exc_info=True)
raise GatewayError(repr(e))


Expand Down

0 comments on commit 2761a90

Please sign in to comment.