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

Culling: ensure last_activity attr exists before use #5355

Merged
merged 1 commit into from
May 25, 2020

Conversation

kevin-bates
Copy link
Member

KernelManager's last_activity attribute is added following the instance's
creation. Culling (independently) uses this attribute and should ensure
it exists prior to its use, else skip the culling check for that instance.

Fixes #5345

KernelManager's last_activity attribute is added following the instance's
creation.  Culling (independently) uses this attribute and should ensure
it exists prior to its use, else skip the culling check for that instance.

Fixes jupyter#5345
@kevin-bates kevin-bates requested a review from Zsailer May 5, 2020 15:35
Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -459,9 +459,9 @@ async def cull_kernel_if_idle(self, kernel_id):
except KeyError:
return # KeyErrors are somewhat expected since the kernel can be shutdown as the culling check is made.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -234,3 +235,49 @@ class KernelFilterTest(NotebookTestBase):
# Sanity check verifying that the configurable was properly set.
def test_config(self):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

236

@@ -234,3 +235,49 @@ class KernelFilterTest(NotebookTestBase):
# Sanity check verifying that the configurable was properly set.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

235

@@ -459,9 +459,9 @@ async def cull_kernel_if_idle(self, kernel_id):
except KeyError:
return # KeyErrors are somewhat expected since the kernel can be shutdown as the culling check is made.

self.log.debug("kernel_id=%s, kernel_name=%s, last_activity=%s",
kernel_id, kernel.kernel_name, kernel.last_activity)
if kernel.last_activity is not None:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if

def test_culling(self):
kid = self.kern_api.start().json()['id']
ws = self.kern_api.websocket(kid)
model = self.kern_api.get(kid).json()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads-up: this test has a race condition. On slower hardware the kernel is already culled by the time the model is fetched and the assertion below fails. Example build failure: https://hydra.nixos.org/build/134833130

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Matej. Yeah, I raised this suspicion in the jupyter_server meeting the other day and believe 2 seconds is a bit short. I think extending the idle timeout to 5 seconds - given this is the only test like this - will be sufficient.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kernel manager object has no attribute 'last_activity' during culling check
4 participants