Closed amangarg96 closed 5 years ago
Thanks for the issue. I typically see ECONNREFUSED
when attempting to hit a gateway server and EG is not running. When called from my mac where EG is located (but not running) on a different machine, I get the following:
[I 15:33:40.191 NotebookApp] Request list kernel specs at: /api/kernelspecs
[E 15:33:42.387 NotebookApp] Uncaught exception GET /api/kernelspecs (172.17.0.1)
HTTPServerRequest(protocol='http', host='localhost:9003', method='GET', uri='/api/kernelspecs', version='HTTP/1.1', remote_ip='172.17.0.1')
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1141, in run
yielded = self.gen.throw(*exc_info)
File "/opt/conda/lib/python3.6/site-packages/nb2kg/handlers.py", line 324, in get
kernel_specs = yield gen.maybe_future(ksm.list_kernel_specs())
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1141, in run
yielded = self.gen.throw(*exc_info)
File "/opt/conda/lib/python3.6/site-packages/nb2kg/managers.py", line 284, in list_kernel_specs
response = yield fetch_kg(self.kernelspecs_endpoint, method='GET')
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1141, in run
yielded = self.gen.throw(*exc_info)
File "/opt/conda/lib/python3.6/site-packages/nb2kg/managers.py", line 64, in fetch_kg
response = yield client.fetch(url, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
ConnectionRefusedError: [Errno 111] Connection refused
The errno values are different but the error is the same. I suspect that's more about mac vs. linux.
I'm assuming you've confirmed your EG server is running on ${JKG_HOST}
at port 8888 - but just in case.
Also, when you ran the similar scenario without Hub, were all other aspects (namely topology) the same?
You might also take a look at this blog post. Although its specific to kubernetes, the Hub configuration details will be similar.
Hey,
Yes, the EG server was running on ${JKG_HOST} at port 8888, and I was able to run the similar scenario without JupyterHub. (See #435 for the configuration of that setup)
One thing which is different in this setup though, is that in my current setup the JupyterHub (And the Notebook Servers spawned by JupyterHub) are running on a Mac, while the Enterprise Gateway is running on a Linux machine.
Could this be causing issues?
No, that shouldn't matter. My typical config is Notebook/NB2KG on mac and EG on linux.
So when you say the Hub config is different, have you tried just running NB on mac? Sounds like there is a topology difference between your NB/EG and Hub/EG envs and I would suggest eliminating that difference first. Might there be any kind of firewall between your systems in this env vs. the one w/o Hub?
Yes, I should try the NB-EG config with Mac first.
Let me try that and get back with the observations.
@amangarg96 - did you make any progress on this?
Fyi, I ran into another instance of ConnectionRefusedError but this one was relative to errno 61 (rather than 111). Since I'm running in different conda envs, I wonder if the errno differences are due to different underlying packages.
Hey, as discussed I tested the NB-EG config first and it was running successfully.
But when I tried running JupyterHub, I got the following error -
[C 2018-10-26 12:13:53.576 JupyterHub app:1861] Failed to start proxy
Traceback (most recent call last):
File "/Users/aman.garg/anaconda2/envs/jupyterhub-nb/lib/python3.6/site-packages/jupyterhub/app.py", line 1859, in start
await self.proxy.start()
File "/Users/aman.garg/anaconda2/envs/jupyterhub-nb/lib/python3.6/site-packages/jupyterhub/proxy.py", line 596, in start
await server.wait_up(1)
File "/Users/aman.garg/anaconda2/envs/jupyterhub-nb/lib/python3.6/site-packages/jupyterhub/utils.py", line 165, in wait_for_server
timeout=timeout
File "/Users/aman.garg/anaconda2/envs/jupyterhub-nb/lib/python3.6/site-packages/jupyterhub/utils.py", line 155, in exponential_backoff
raise TimeoutError(fail_message)
TimeoutError: Server at <hostname>:8000 didn't respond in 1 seconds
I'm not able to reproduce the ConnectionRefusedError now.
Here's the full log -
sudo jupyterhub -f /Users/aman.garg/.jupyter/jupyterhub_config.py --debug
Password:
[D 2018-10-26 12:13:40.864 JupyterHub application:555] Looking for /Users/aman.garg/.jupyter/jupyterhub_config in /Users/aman.garg
[D 2018-10-26 12:13:40.874 JupyterHub application:577] Loaded config file: /Users/aman.garg/.jupyter/jupyterhub_config.py
[I 2018-10-26 12:13:40.876 JupyterHub app:1667] Using Authenticator: jupyterhub.auth.PAMAuthenticator-0.9.2
[I 2018-10-26 12:13:40.876 JupyterHub app:1667] Using Spawner: jupyterhub.spawner.LocalProcessSpawner-0.9.2
[I 2018-10-26 12:13:40.983 JupyterHub app:1014] Loading cookie_secret from /Users/aman.garg/jupyterhub_cookie_secret
[D 2018-10-26 12:13:40.988 JupyterHub app:1069] Connecting to db: sqlite:///jupyterhub.sqlite
[D 2018-10-26 12:13:41.294 JupyterHub orm:685] database schema version found: 896818069c98
[I 2018-10-26 12:13:41.299 JupyterHub proxy:431] Generating new CONFIGPROXY_AUTH_TOKEN
[W 2018-10-26 12:13:41.300 JupyterHub app:1171] No admin users, admin interface will be unavailable.
[W 2018-10-26 12:13:41.300 JupyterHub app:1172] Add any administrative users to `c.Authenticator.admin_users` in config.
[I 2018-10-26 12:13:41.300 JupyterHub app:1199] Not using whitelist. Any authenticated user will be allowed.
[D 2018-10-26 12:13:41.333 JupyterHub app:1471] Loading state for aman.garg from db
[D 2018-10-26 12:13:41.335 JupyterHub app:1487] Loaded users:
aman.garg admin
[I 2018-10-26 12:13:41.344 JupyterHub app:1849] Hub API listening on http://127.0.0.1:8081/hub/
[W 2018-10-26 12:13:41.344 JupyterHub proxy:472] Found proxy pid file: /Users/aman.garg/jupyterhub-proxy.pid
[W 2018-10-26 12:13:41.346 JupyterHub proxy:489] Proxy still running at pid=401
[W 2018-10-26 12:13:42.350 JupyterHub proxy:504] Stopped proxy at pid=401
[D 2018-10-26 12:13:42.350 JupyterHub proxy:520] Removing proxy pid file jupyterhub-proxy.pid
[W 2018-10-26 12:13:42.352 JupyterHub proxy:560] Running JupyterHub without SSL. I hope there is SSL termination happening somewhere else...
[I 2018-10-26 12:13:42.352 JupyterHub proxy:562] Starting proxy @ http://:8000
[D 2018-10-26 12:13:42.352 JupyterHub proxy:563] Proxy cmd: ['configurable-http-proxy', '--ip', '', '--port', '8000', '--api-ip', '127.0.0.1', '--api-port', '8001', '--error-target', 'http://127.0.0.1:8081/hub/error']
[D 2018-10-26 12:13:42.357 JupyterHub proxy:512] Writing proxy pid file: jupyterhub-proxy.pid
12:13:43.103 - info: [ConfigProxy] Proxying http://*:8000 to (no default)
12:13:43.106 - info: [ConfigProxy] Proxy API at http://127.0.0.1:8001/api/routes
[C 2018-10-26 12:13:53.576 JupyterHub app:1861] Failed to start proxy
Traceback (most recent call last):
File "/Users/aman.garg/anaconda2/envs/jupyterhub-nb/lib/python3.6/site-packages/jupyterhub/app.py", line 1859, in start
await self.proxy.start()
File "/Users/aman.garg/anaconda2/envs/jupyterhub-nb/lib/python3.6/site-packages/jupyterhub/proxy.py", line 596, in start
await server.wait_up(1)
File "/Users/aman.garg/anaconda2/envs/jupyterhub-nb/lib/python3.6/site-packages/jupyterhub/utils.py", line 165, in wait_for_server
timeout=timeout
File "/Users/aman.garg/anaconda2/envs/jupyterhub-nb/lib/python3.6/site-packages/jupyterhub/utils.py", line 155, in exponential_backoff
raise TimeoutError(fail_message)
TimeoutError: Server at blr-af-dbl48h2.fkipl.flipkart.com:8000 didn't respond in 1 seconds
[D 2018-10-26 12:13:53.593 JupyterHub application:647] Exiting application: jupyterhub
This strikes me as a Hub issue only and you're unable to start an NB server (as I'm sure you're aware). Unfortunately, I'm not familiar with troubleshooting Hub, so you might need to run this particular scenario passed folks in Hub. Their gitter channel is fairly active, so that's probably your best bet.
Thanks, I'll get in touch with JupyterHub guys for this issue.
I have started working on the JupyterHub and Enterprise Gateway again, and I am running into the same ConnectionRefusedError: [Errno 61] Connection refused
error with the same configuration.
However, when I ran the Jupyter Enterprise Gateway on the local (the same machine where JupyterHub is running and Notebook Servers are being launched) and pointed KG_URL to that, it's working.
And again, the same configuration without JupyterHub is working fine too.
Hey, I just realized that when I was running JEG on my local, it was using the default KG_URL (127.0.0.1:8888). When I ran the JEG on a different port (locally), I still got ConnectionRefusedError: [Errno 61] Connection refused
As @kevin-bates mentioned, the error was because the NB server was attempting to hit a gateway server and EG wasn't running.
Maybe the environment variable KG_URL is not getting passed to NB server.
I'll try passing the KG_URL=<FQDN of Gateway Endpoint>
through JupyterHub instead.
Passing the environment variable through JupyterHub's config file (jupyterhub_config.py) solved the issue.
To pass the environment variable, I added KG_URL in c.Spawner.env_keep
and then launched Jupyterhub.
I'm trying to use nb2kg with JupyterHub to launch kernels on Spark using Jupyter Enterprise Gateway.
JupyterHub spawns Notebook Servers locally using the LocalSpawner class, while Jupyter Enterprise Gateway runs on a different server.
KG_URL was set as:
export KG_URL=http://${JKG_HOST}:8888
nb2kg serverextension was activated by:
jupyter serverextension enable --py nb2kg --sys-prefix
On starting JupyterHub and login in, I'm directed to the notebook server but cannot see any of the kernels.
Jupyter Hub shows the following log:
What could be the issue for connection getting refused? My setup is working for individual notebook servers, this issue only arises when launching notebook server using JupyterHub