Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Aug 2, 2023
1 parent 9fd54a4 commit 06f7fb3
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
3 changes: 2 additions & 1 deletion tests/app/config_paths_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

@pytest.fixture
def voila_config_file_paths_arg():
return ["--VoilaTest.config_file_paths", os.path.join(BASE_DIR, "..", "configs", "general")]
path = os.path.join(BASE_DIR, "..", "configs", "general")
return "--VoilaTest.config_file_paths=[%r]" % path


def test_config_app(voila_app):
Expand Down
4 changes: 2 additions & 2 deletions tests/app/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def voila_args_extra():
@pytest.fixture
def voila_config_file_paths_arg():
# we don't want the tests to use any configuration on the system
return []
return "--VoilaTest.config_file_paths=[]"


@pytest.fixture
Expand All @@ -35,7 +35,7 @@ def voila_args(voila_notebook, voila_args_extra, voila_config_file_paths_arg):
if os.environ.get("VOILA_TEST_DEBUG", False)
else []
)
return [voila_notebook, *voila_config_file_paths_arg, *voila_args_extra, *debug_args]
return [voila_notebook, voila_config_file_paths_arg, *voila_args_extra, *debug_args]


@pytest.fixture
Expand Down
3 changes: 2 additions & 1 deletion tests/app/nbextensions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def config(app):
@pytest.fixture
def voila_config_file_paths_arg():
# we don't want the tests to use any configuration on the system
return ["--VoilaTest.config_file_paths", os.path.abspath(os.path.join(BASE_DIR, "../configs/general"))]
path = os.path.abspath(os.path.join(BASE_DIR, "../configs/general"))
return "--VoilaTest.config_file_paths=[%r]" % path


@pytest.mark.skip(reason="TODO: update for JupyterLab extensions")
Expand Down
3 changes: 2 additions & 1 deletion tests/app/preheat_configuration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

@pytest.fixture
def voila_config_file_paths_arg():
return ["--VoilaTest.config_file_paths", os.path.join(BASE_DIR, "..", "configs", "preheat")]
path = os.path.join(BASE_DIR, "..", "configs", "preheat")
return "--VoilaTest.config_file_paths=[%r]" % path


@pytest.fixture
Expand Down
3 changes: 2 additions & 1 deletion tests/app/preheat_multiple_notebooks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

@pytest.fixture
def voila_config_file_paths_arg():
return ["--VoilaTest.config_file_paths", os.path.join(BASE_DIR, "..", "configs", "preheat")]
path = os.path.join(BASE_DIR, "..", "configs", "preheat")
return "--VoilaTest.config_file_paths=[%r]" % path


@pytest.fixture
Expand Down
9 changes: 8 additions & 1 deletion voila/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ def _(x):
return x


class ConfigsList(List):
def from_string(self, s):
return s.split(os.pathsep)


class Voila(Application):
name = "voila"
version = __version__
Expand Down Expand Up @@ -390,7 +395,7 @@ def _url(self, ip):
proto = "http"
return "%s://%s:%i%s" % (proto, ip, self.port, self.base_url)

config_file_paths = List(
config_file_paths = ConfigsList(
Unicode(), config=True, help=_("Paths to search for voila.(py|json)")
)

Expand Down Expand Up @@ -552,6 +557,8 @@ def init_settings(self) -> Dict:
if preheat_kernel and self.prelaunch_hook:
raise Exception("`preheat_kernel` and `prelaunch_hook` are incompatible")

print('--- DEBUG preheat', preheat_kernel)

kernel_manager_class = voila_kernel_manager_factory(
self.voila_configuration.multi_kernel_manager_class,
preheat_kernel,
Expand Down
5 changes: 5 additions & 0 deletions voila/voila_kernel_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def voila_kernel_manager_factory(
"""
if not preheat_kernel:

print('--- DEBUG created NON preheat manager')
class NormalKernelManager(base_class):
@property
def notebook_data(self) -> TypeDict:
Expand All @@ -67,6 +68,8 @@ def get_pool_size(self, nb: str) -> int:

else:

print('--- DEBUG created preheat manager')

class VoilaKernelManager(base_class):
"""This class adds pooling heated kernels and pre-rendered notebook
feature to a normal kernel manager. The 'pooling heated kernels'
Expand Down Expand Up @@ -241,6 +244,8 @@ def fill_if_needed(
kwargs["env"] = kernel_env

heated = len(pool)
print('--- DEBUG pool of', heated)
print('--- DEBUG kernel size', kernel_size)

def task_counter(tk):
nonlocal heated
Expand Down

0 comments on commit 06f7fb3

Please sign in to comment.