Skip to content

Commit

Permalink
fix: No longer create kernels, let ExecutePreprocessor handle it.
Browse files Browse the repository at this point in the history
fixes #36
  • Loading branch information
Jacob-Stevens-Haas committed Mar 19, 2024
1 parent 5743661 commit 3e616ae
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
13 changes: 1 addition & 12 deletions mitosis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,7 @@ def _run_in_notebook(
metrics_cell = nbformat.v4.new_code_cell(source="print(results['main'])")
nb["cells"] = [setup_cell, resolve_cell, run_cell, result_cell, metrics_cell]

kernel_name = _create_kernel()
ep = ExecutePreprocessor(timeout=-1, kernel=kernel_name)
ep = ExecutePreprocessor(timeout=-1)
exception = None
metrics = None
if debug:
Expand All @@ -509,16 +508,6 @@ def _run_in_notebook(
return nb, metrics, exception


def _create_kernel():
from ipykernel import kernelapp as app

kernel_name = "".join(choice(list("0123456789"), 6)) + str(
hash(Path(sys.executable))
)
app.launch_new_instance(argv=["install", "--user", "--name", kernel_name])
return kernel_name


def _save_notebook(nb, filename, trials_folder, extension):
if extension == "html":
html_exporter = HTMLExporter({"template_file": "lab"})
Expand Down
4 changes: 0 additions & 4 deletions mitosis/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ def mock_local_f():
str(mitosis.StrictlyReproduceableDict(**{"1": lambda x: 1}))


def test_kernel_name():
mitosis._create_kernel()


@pytest.fixture
def fake_eval_param():
return mitosis.Parameter("1", "seed", 1, evaluate=True)
Expand Down

0 comments on commit 3e616ae

Please sign in to comment.