Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add preheated kernel for execution to speedup the computation #114

Closed
pplonski opened this issue Jun 28, 2022 · 2 comments
Closed

add preheated kernel for execution to speedup the computation #114

pplonski opened this issue Jun 28, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@pplonski
Copy link
Contributor

pplonski commented Jun 28, 2022

It should be possible to add preheated kernels for executing notebook. Please check the following discussions:

@pplonski pplonski self-assigned this Jul 15, 2022
@pplonski pplonski added the enhancement New feature or request label Jul 15, 2022
@pplonski pplonski pinned this issue Jul 15, 2022
@pplonski
Copy link
Contributor Author

Very simple demo:

process1.py

import nbformat
import json
from jupyter_client import MultiKernelManager
from nbconvert.preprocessors import ExecutePreprocessor

mkm = MultiKernelManager()
mkm.start_kernel(kernel_name="python3", kernel_id="some-kernel")
km = mkm.get_kernel("some-kernel") # the kernel connection file is not created

print(km.get_connection_info())

nb1 = nbformat.v4.new_notebook()

nb1["cells"] = [nbformat.v4.new_code_cell("a = 13")]

ep = ExecutePreprocessor()
ep.preprocess(nb1, km=km)

print(nb1.cells)

process2.py

from jupyter_client import BlockingKernelClient
client = BlockingKernelClient()
client.load_connection_file('./kernel-some-kernel.json')
client.start_channels()

print(client)
client.execute_interactive("a+=1")
client.execute_interactive("print(a)")

KernelManager cant accept existing running kernel. There are two ways:

  • write customer KernelManager
  • write custom provisioner

@pplonski
Copy link
Contributor Author

This is fixed in Mercury V2.

We keep the active Python session in the worker. V2 ix ~ x20 faster than V1.

@pplonski pplonski unpinned this issue Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant