Add support for local pipeline executions when server uses Enterprise Gateway #983
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds support for running local pipelines against a server configured to use Enterprise Gateway for its kernel management. These changes include the following:
Autodetection of Enterprise Gateway
The local pipeline processor, because it's running in the notebook server, uses the server's configuration information to detect whether or not a gateway server is configured. If a gateway is configured, it invokes Papermill indicating that the
HTTPKernelManager
class be used to manage the underlying NBClient kernel.ElyraEngine
A new Papermill engine has been added named
ElyraEngine
. This engine passes the Notebook node'senv
andcwd
values to the kernel (regardless of the kernel's location). This engine derives directly fromNBClientEngine
and is essentially the same engine used today, with some additional support for conveying parameters to the underlying kernel manager.HTTPKernelManager
HTTPKernelManager
is a kernel manager (derived fromAsyncKernelManager
) that forwards all kernel manager requests to the associated gateway server (when configured). Because it leverages theGatewayClient
class andgateway_request
function built into the notebook server,HTTPKernelManager
cannot be invoked outside of the server process. This limitation can be mitigated if deemed necessary.HTTPKernelClient
This kernel client class (derived from
AsyncKernelClient
) is responsible for emulating kernel message requests and responses. Each of the 5 kernel channels is associated with aChannelQueue
class that derives from the built-inQueue
class. The channelsend()
methods forward the message to the underlying websocket shared across the channels. The message is processed on the gateway server and its response is returned back to the local server where the response is routed to the appropriate channel queue. The channel'sget_msg()
method, then pulls responses from its corresponding queue - thereby completing the message sequence.When channels are started a response router thread is started prior to their instantiation. This thread's sole purpose is to receive messages (responses) from the websocket opened against the gateway server, routing each response to the appropriate channel queue based on the response's 'channel' indicator. The response router thread is terminated when the channels are stopped following the kernel's shutdown.
Resolves #961, #164
Developer's Certificate of Origin 1.1