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

Increase culling test idle timeout #388

Merged
merged 1 commit into from
Jan 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions tests/services/kernels/test_cull.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ def jp_argv(request):
return ["--ServerApp.kernel_manager_class=jupyter_server.services.kernels.kernelmanager." + request.param]


CULL_TIMEOUT = 10 if platform.python_implementation() == 'PyPy' else 2
CULL_TIMEOUT = 10 if platform.python_implementation() == 'PyPy' else 5
CULL_INTERVAL = 1


@pytest.fixture
def jp_server_config():
return Config({
'ServerApp': {
'MappingKernelManager': {
'cull_idle_timeout': CULL_TIMEOUT,
'cull_interval': 1,
'cull_interval': CULL_INTERVAL,
'cull_connected': False
}
}
Expand Down Expand Up @@ -56,18 +58,19 @@ async def test_culling(jp_fetch, jp_ws_fetch):


async def get_cull_status(kid, jp_fetch):
frequency = 0.5
culled = False
for i in range(20): # Need max of 2x culling PERIOD ensure culling timeout exceeded
for _ in range(int((CULL_TIMEOUT + CULL_INTERVAL)/frequency)): # Timeout + Interval will ensure cull
try:
r = await jp_fetch(
'api', 'kernels', kid,
method='GET'
)
kernel = json.loads(r.body.decode())
json.loads(r.body.decode())
except HTTPClientError as e:
assert e.code == 404
culled = True
break
else:
await asyncio.sleep(CULL_TIMEOUT / 10.)
return culled
await asyncio.sleep(frequency)
return culled