-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make RemoteKernelManager more independent
Make RemoteKernelManager (RKM) able to be run without a (grand)parent EnterpriseGatewayApp (EGA) instance so it can be used by nbclient. The config which RKM with EGA was being referred to using traitlet lineage like `self.parent.parent.property_name`. Change both to inherit from a Configurable mixin which contains all of EGA's previous config. Link the attributes of the RKM instance with EGA if available to keep old behaviour. Modify other properties RKM uses that are not traits to become `@property`s which fall back to sane defaults if running independently. Change RKM to be able to generate a kernel id if necessary. Change ProcessProxy to use provided kernel ids. Move kernel id generation logic out of RemoteMappingKernelManager. Resolves #803
- Loading branch information
golf-player
committed
May 20, 2020
1 parent
c594cd9
commit e523fcb
Showing
11 changed files
with
574 additions
and
464 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## Standalone Remote Kernel Execution | ||
#####a.k.a "Library Mode" | ||
|
||
Remote kernels can be executed by using the `RemoteKernelManager` class directly. This enables running kernels using `ProcessProxy`s without the Enterprise Gateway Webapp. | ||
|
||
This can be useful in niche situations, for example, using [nbconvert](https://nbconvert.readthedocs.io/) or [nbclient](https://nbclient.readthedocs.io/) to execute a kernel on a remote cluster. | ||
|
||
Sample code using nbclient 0.2.0: | ||
|
||
```python | ||
import nbformat | ||
from nbclient import NotebookClient | ||
from enterprise_gateway.services.kernels.remotemanager import RemoteKernelManager | ||
|
||
with open("my_notebook.ipynb") as fp: | ||
test_notebook = nbformat.read(fp, as_version=4) | ||
|
||
client = NotebookClient(nb=test_notebook, kernel_manager_class=RemoteKernelManager) | ||
client.execute() | ||
``` | ||
|
||
The above code will execute the notebook on a kernel using the configured `ProcessProxy` (defaults to Kubernetes). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.