This commit updates the super usage. Because Python 2 is not supported
anymore, super usage can be updated such that super is called without
any arguments in the default case where super is called with the class
name and self.
Note that all usage of super has not been updated - a few cases which
smelled funny have been ignored.
Prior to this change, the request timeout for a Gateway request
was synchronized with KERNEL_LAUNCH_TIMEOUT only if KLT
was greater. However, the two are closely associated and KLT
should be adjusted if the configurable request_timeout is greater.
This change ensures that the two values are synchronized to the
greater value. It changes the two configurable timeouts to default
to 40 (to match that of KLT) and removes the 2-second pad,
since that wasn't helpful and only confused the situation.
These changes were prompted by this issue: jupyter/enterprise_gateway#792
`gateway_request` in `gateway.manager` raises `tornado.web.HTTPError` exceptions,
but the callers, such as `GatewayKernelManager.get_kernel`, catch
`tornado.httpclient.HTTPError`, instead of `tornado.web.HTTPError`.
Therefore, the callers can not handle exceptions during gateway interactions.
This causes that, for example, when Jupyter Enterprise Gateway culled a kernel
by idle timeout, the gateway manager can not handle the kernel's absent appropriately.
As a result, notebook users see ambiguous "Kernel Error" and can not restart
the kernel or start a new kernel.
When notebook (with `--gateway-url` option) lost the connection to
Gateway, notebook didn't connect to Gateway again although the
websocket connection from the client was still alive.
This change recovers the connection to Gateway to prevent this anomaly.
Signed-off-by: Eunsoo Park <esevan.park@gmail.com>
I removed the mirroring 'Receiving' debug statement previously and
didn't realize there's a 'Sending' statement. This change removes
that statement.
This should be part of the 6.0 release, just not signficant enough
to warrant include in rc1.
We were missing a yield statement in the deferral of `get()` to
the superclass. This issue was occurring only when Tornado 6+
was deployed.
Also removed a debug message producing way too much information.
The connect and request timeout defaults have been updated from 20 to 60
seconds and a default value of 40 has been added for KERNEL_LAUNCH_TIMEOUT.
The code ensures that KERNEL_LAUNCH_TIMEOUT is in the env and that the
value of the request timeout is at least 2 greather than KERNEL_LAUNCH_TIMEOUT.
This PR is port of the NB2KG PRs 35 and 38.
Eliminated the Kernel and Kernelspec handlers. The Websocket (ZMQ)
channels handler still remains. This required turning a few methods
into coroutines in the Notebook server.
Renamed the Gateway config object to GatewayClient in case we want
to extend NB server (probably jupyter_server at that point) with
Gateway server functionality - so an NB server could be a Gateway
client or a server depending on launch settings.
Add code to _replace_ the channels handler rather than rely on position
within the handlers lists.
Updated mock-gateway to return the appropriate form of results.
Updated the session manager tests to use a sync ioloop to call the
now async manager methods.
Created a singleton class `Gateway` to store all configuration options
for a Gateway. This class also holds some help methods to make it easier
to use the options and determine if the gateway option is enabled.
Updated the NotebookTestBase class to allow for subclasses to infuence
the patched environment as well as command line options via argv.
Added a test to ensure various gateway configuration items can be
set via the environment or command-line.
This change alleviates a significant pain-point for consumers of Jupyter
Kernel and Enterprise Gateway projects by embedding the few classes defined
in the NB2KG server extension directly into the Notebook server. All code
resides in a separate gateway directory and the 'extension' is enabled
via a new configuration option `--gateway-url`.
Renamed classes from those used in standard NB2KG code so that Notebook
servers using the existing NB2KG extension will still work.
Added test_gateway.py to exercise overridden methods. It does this by
mocking the call that issues requests to the gateway server.
Updated the _Running a notebook server_ topic to include a description
of this feature.