Skip to content

Commit

Permalink
Fix CI problem of preheated kernels tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Dec 8, 2021
1 parent 02f99aa commit 7304b66
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: '16.x'

- name: Cache pip on Linux
uses: actions/cache@v2
Expand Down
4 changes: 4 additions & 0 deletions tests/app/preheat_activation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ async def test_request_before_kernel_heated(http_server_client, base_url):
time, text = await send_request(sc=http_server_client, url=base_url)
assert 'hello world' in text
assert time > NOTEBOOK_EXECUTION_TIME
await asyncio.sleep(NOTEBOOK_EXECUTION_TIME + 1)


async def test_render_time_with_preheated_kernel(http_server_client, base_url):
Expand All @@ -48,6 +49,7 @@ async def test_render_time_with_preheated_kernel(http_server_client, base_url):
wait=NOTEBOOK_EXECUTION_TIME + 2)
assert 'hello world' in text
assert time < TIME_THRESHOLD
await asyncio.sleep(NOTEBOOK_EXECUTION_TIME + 1)


async def test_render_time_with_multiple_requests(http_server_client,
Expand All @@ -65,6 +67,7 @@ async def test_render_time_with_multiple_requests(http_server_client,
time_list.append(time)

assert time_list[1] > time_list[0] # Render time for a normal kernel is bigger than a a preheated kernel
await asyncio.sleep(NOTEBOOK_EXECUTION_TIME + 1)


async def test_request_with_query(http_server_client, base_url):
Expand All @@ -77,6 +80,7 @@ async def test_request_with_query(http_server_client, base_url):
url=url,
wait=NOTEBOOK_EXECUTION_TIME + 1)
assert time < TIME_THRESHOLD
await asyncio.sleep(NOTEBOOK_EXECUTION_TIME + 1)


async def test_request_with_theme_parameter(http_server_client, base_url):
Expand Down
4 changes: 3 additions & 1 deletion tests/app/preheat_configuration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os

BASE_DIR = os.path.dirname(__file__)
NOTEBOOK_EXECUTION_TIME = 2
NOTEBOOK_EXECUTION_TIME = 3
NUMBER_PREHEATED_KERNEL = 2
TIME_THRESHOLD = 1

Expand Down Expand Up @@ -48,9 +48,11 @@ async def test_refill_kernel_asynchronously(http_server_client, base_url):
assert len(fast) > 1
assert len(slow) > 1
assert len(fast) + len(slow) == 5*NUMBER_PREHEATED_KERNEL
await asyncio.sleep(NOTEBOOK_EXECUTION_TIME + 1)


async def test_env_variable_defined_in_kernel(http_server_client, base_url):
await asyncio.sleep(NUMBER_PREHEATED_KERNEL*NOTEBOOK_EXECUTION_TIME + 1)
_, text = await send_request(sc=http_server_client, url=base_url)
assert "bar" in text
await asyncio.sleep(NOTEBOOK_EXECUTION_TIME + 1)
2 changes: 2 additions & 0 deletions tests/app/preheat_multiple_notebooks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ async def test_render_notebook_with_heated_kernel(http_server_client, base_url):

assert 'hello world' in text
assert time < TIME_THRESHOLD
await asyncio.sleep(NOTEBOOK_EXECUTION_TIME + 1)


async def test_render_blacklisted_notebook_with_nornal_kernel(http_server_client, base_url):
Expand All @@ -48,3 +49,4 @@ async def test_render_blacklisted_notebook_with_nornal_kernel(http_server_client

assert 'hello world' in text
assert time > TIME_THRESHOLD
await asyncio.sleep(NOTEBOOK_EXECUTION_TIME + 1)
2 changes: 1 addition & 1 deletion voila/voila_kernel_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async def get_rendered_notebook(
render_task: asyncio.Task = content['task']
kernel_id: str = content['kernel_id']
renderer.stop_generator = True
self.log.info('Using pre-heated kernel: %s for %s', 'kernel_id', notebook_name)
self.log.info('Using pre-heated kernel: %s for %s', kernel_id, notebook_name)
self.fill_if_needed(delay=None, notebook_name=notebook_name, **kwargs)

return render_task, renderer.rendered_cache, kernel_id
Expand Down

0 comments on commit 7304b66

Please sign in to comment.