A lightweight, multi-tenant, scalable and secure gateway that enables Jupyter Notebooks to share resources across distributed clusters such as Apache Spark, Kubernetes and others.
When trying to instantiate a docker-based kernel with the gateway I started receiving the following errors in my logs:
[D 2023-05-05 13:38:51.410 EnterpriseGatewayApp] RemoteMappingKernelManager.start_kernel: tfdocker-2.9, kernel_username: guest
[D 2023-05-05 13:38:51.411 EnterpriseGatewayApp] Instantiating kernel 'docker-TF-2.9' with process proxy: enterprise_gateway.services.processproxies.docker_swarm.DockerProcessProxy
[D 230505 13:38:51 config:21] Trying paths: ['/home/blair/.docker/config.json', '/home/blair/.dockercfg']
[D 230505 13:38:51 config:25] Found file at path: /home/blair/.docker/config.json
[D 230505 13:38:51 auth:180] Found 'auths' section
[D 230505 13:38:51 auth:140] Found entry (registry='https://index.docker.io/v1/', username='bsdz')
[D 230505 13:38:51 auth:190] Found 'credHelpers' section
[E 230505 13:38:51 web:1798] Uncaught exception POST /api/kernels (192.168.251.219)
HTTPServerRequest(protocol='http', host='192.168.251.219:8887', method='POST', uri='/api/kernels', version='HTTP/1.1', remote_ip='192.168.251.219')
Traceback (most recent call last):
File "/jl/.venv/lib/python3.10/site-packages/tornado/web.py", line 1713, in _execute
result = await result
File "/jl/.venv/lib/python3.10/site-packages/enterprise_gateway/services/kernels/handlers.py", line 102, in post
await super().post()
File "/jl/.venv/lib/python3.10/site-packages/jupyter_server/services/kernels/handlers.py", line 60, in post
kernel_id = await ensure_async(
File "/jl/.venv/lib/python3.10/site-packages/jupyter_server/utils.py", line 182, in ensure_async
result = await obj
File "/jl/.venv/lib/python3.10/site-packages/enterprise_gateway/services/kernels/remotemanager.py", line 225, in start_kernel
kernel_id = await super().start_kernel(*args, **kwargs)
File "/jl/.venv/lib/python3.10/site-packages/jupyter_server/services/kernels/kernelmanager.py", line 218, in start_kernel
kernel_id = await ensure_async(self.pinned_superclass.start_kernel(self, **kwargs))
File "/jl/.venv/lib/python3.10/site-packages/jupyter_server/utils.py", line 182, in ensure_async
result = await obj
File "/jl/.venv/lib/python3.10/site-packages/jupyter_client/multikernelmanager.py", line 483, in start_kernel
await fut
File "/jl/.venv/lib/python3.10/site-packages/jupyter_client/multikernelmanager.py", line 460, in _add_kernel_when_ready
await kernel_awaitable
File "/jl/.venv/lib/python3.10/site-packages/enterprise_gateway/services/kernels/remotemanager.py", line 501, in start_kernel
self._get_process_proxy()
File "/jl/.venv/lib/python3.10/site-packages/enterprise_gateway/services/kernels/remotemanager.py", line 757, in _get_process_proxy
self.process_proxy = process_proxy_class(
TypeError: Can't instantiate abstract class DockerProcessProxy with abstract method get_error_states
[E 230505 13:38:51 web:2271] 500 POST /api/kernels (192.168.0.2) 41.95ms
[W 2023-05-05 13:38:51.452 ServerApp] 500 POST /api/sessions?1683290331394 (::1): HTTP 500: Internal Server Error (Error attempting to connect to Gateway server url 'http://192.168.0.2:8887'. Ensure gateway url is valid and the Gateway instance is running.)
[W 2023-05-05 13:38:51.452 ServerApp] wrote error: "HTTP 500: Internal Server Error (Error attempting to connect to Gateway server url 'http://192.168.0.2:8887'. Ensure gateway url is valid and the Gateway instance is running.)"
Reproduce
One can reproduce the error by simply attempting to instantiate DockerProcessProxy in a python console, i.e.
Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import enterprise_gateway
>>> enterprise_gateway.__version__
'3.2.2'
>>> from enterprise_gateway.services.processproxies.docker_swarm import DockerProcessProxy
>>> DockerProcessProxy()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Can't instantiate abstract class DockerProcessProxy with abstract method get_error_states
It looks like the get_error_states method might have been missed for the class. I'm happy to raise a PR with the small change if I get some pointers on what the error states should be.
I note the sibling class DockerSwarmProcessProxy has the following initial/error states:
def get_initial_states(self) -> set:
"""Return list of states in lowercase indicating container is starting (includes running)."""
return {"preparing", "starting", "running"}
def get_error_states(self) -> set:
"""Returns the list of error states indicating container is shutting down or receiving error."""
return {"failed", "rejected", "complete", "shutdown", "orphaned", "remove"}
whereas DockerProcessProxy has these initial states (but no error states).
def get_initial_states(self) -> set:
"""Return list of states in lowercase indicating container is starting (includes running)."""
return {"created", "running"}
Description
When trying to instantiate a docker-based kernel with the gateway I started receiving the following errors in my logs:
Reproduce
One can reproduce the error by simply attempting to instantiate DockerProcessProxy in a python console, i.e.
It looks like the get_error_states method might have been missed for the class. I'm happy to raise a PR with the small change if I get some pointers on what the error states should be.
I note the sibling class DockerSwarmProcessProxy has the following initial/error states:
whereas DockerProcessProxy has these initial states (but no error states).
From the docker documentation I can see an enum of states:
So I suspect the error states should the compliment, i.e. restarting, removing, paused, exited, dead.
Expected behavior
The kernel should start using docker image.
Context
Troubleshoot Output