Skip to content
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

fix: check kernel id before delete and upgrade ws #1375

Closed
wants to merge 1 commit into from
Closed
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
16 changes: 16 additions & 0 deletions enterprise_gateway/services/kernels/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,22 @@ def get(self, kernel_id: str):
model = km.kernel_model(kernel_id)
self.finish(json.dumps(model, default=date_default))

@web.authenticated
async def delete(self, kernel_id):
"""Remove a kernel."""
self.kernel_manager.check_kernel_id(kernel_id=kernel_id)
await super().delete(kernel_id=kernel_id)


class ZMQChannelsHandler(jupyter_server_handlers.ZMQChannelsHandler):
"""Extends the kernel websocket handler."""

async def get(self, kernel_id):
"""Handle a get request for a kernel."""
# Synchronize Kernel and check if it exists.
self.kernel_manager.check_kernel_id(kernel_id=kernel_id)
await super().get(kernel_id=kernel_id)


default_handlers: list[tuple] = []
for path, cls in jupyter_server_handlers.default_handlers:
Expand Down
Loading