Skip to content

Commit 820551c

Browse files
authored
Add missing events to gateway client (#1288)
1 parent 8c2987f commit 820551c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

jupyter_server/gateway/gateway_client.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,9 @@ async def gateway_request(endpoint: str, **kwargs: ty.Any) -> HTTPResponse:
767767
rhc = RetryableHTTPClient()
768768
try:
769769
response = await rhc.fetch(endpoint, **kwargs)
770+
GatewayClient.instance().emit(
771+
data={STATUS_KEY: SUCCESS_STATUS, STATUS_CODE_KEY: 200, MESSAGE_KEY: "success"}
772+
)
770773
# Trap a set of common exceptions so that we can inform the user that their Gateway url is incorrect
771774
# or the server is not running.
772775
# NOTE: We do this here since this handler is called during the server's startup and subsequent refreshes
@@ -808,6 +811,15 @@ async def gateway_request(endpoint: str, **kwargs: ty.Any) -> HTTPResponse:
808811
f"The Gateway server specified in the gateway_url '{GatewayClient.instance().url}' doesn't "
809812
f"appear to be valid. Ensure gateway url is valid and the Gateway instance is running.",
810813
) from e
814+
except Exception as e:
815+
GatewayClient.instance().emit(
816+
data={STATUS_KEY: ERROR_STATUS, STATUS_CODE_KEY: 505, MESSAGE_KEY: str(e)}
817+
)
818+
logging.getLogger("ServerApp").error(
819+
f"Exception while trying to launch kernel via Gateway URL {GatewayClient.instance().url} , {e}",
820+
e,
821+
)
822+
raise e
811823

812824
if GatewayClient.instance().accept_cookies:
813825
# Update cookies on GatewayClient from server if configured.

0 commit comments

Comments
 (0)