Skip to content
This repository has been archived by the owner on Feb 18, 2023. It is now read-only.

Fix too frequent queries from frontend and too long timeout on backend #24

Merged
merged 3 commits into from
Dec 14, 2022

Conversation

krassowski
Copy link
Contributor

@krassowski krassowski commented Dec 12, 2022

Related to #23:

  • fixes "No. of requests being sent on notebook tab change"
  • fixes "Polling for shutdown kernel"
  • alleviates "Requests go into the pending state when the kernel is busy"
  • indirectly alleviates "UX (Minor)"

In server logs I see a message "Could not destroy zmq context for". This is a potential memory leak. I did not attempt to investigate further given the suggestion in #22 (the backend is more likely to be refactored when merging into jupyter-resource-usage and this may go away then).

There were three issues:
- the `notebookTracker.currentChanged` signal was being connected
  on each re-render of React widget and re-renders were triggered
  by update to state that was defined in the callback leading to
  O(n^2) accumulation of callbacks.
- the `kernelChanged` signal was being connected on each change of
  the notebook leading to O(n) accumulation of callbacks.
- the sidebar panel could have been created multiple times if
  invoked from command palette - O(1) accumulation of callbacks.
@krassowski krassowski added the bug Something isn't working label Dec 12, 2022
@krassowski krassowski merged commit 22f4c31 into Quansight:main Dec 14, 2022
davidbrochart added a commit to davidbrochart/jupyter-resource-usage that referenced this pull request Dec 14, 2022
davidbrochart added a commit to jupyter-server/jupyter-resource-usage that referenced this pull request Dec 15, 2022
* initial commit

* add Makefile

* refactor react state

* add a timer with react hook to ensure the panel is refreshed - fixes Quansight/jupyterlab-kernel-usage#6

* panel content for #4 and #7

* new icon fixes #3

* ensure minimal ipykernel version - fixes #8

* format cpu to 1 decimal - fixes #2

* better format the memory numbers - fixes #1

* bump version to 0.2.0

* better format for the memory

* bump versoin to 0.3.0

* update preview image

* lint

* tune the panel layout

* show a message is kernel usage is not available

* Add PID

* readme: add ipykernel requirement - closes #8

* release: 0.4.0

* remove old kernel poll

* don't throw timeout exception

* remove logging

* Pool only the active kernel and if the sidebar is visible

* lint

* polish the ui and add cpu_count

* release: 0.5.0

* Fix issues related to fronted querying too often.

There were three issues:
- the `notebookTracker.currentChanged` signal was being connected
  on each re-render of React widget and re-renders were triggered
  by update to state that was defined in the callback leading to
  O(n^2) accumulation of callbacks.
- the `kernelChanged` signal was being connected on each change of
  the notebook leading to O(n) accumulation of callbacks.
- the sidebar panel could have been created multiple times if
  invoked from command palette - O(1) accumulation of callbacks.

* Limit the backend timeout to 1+2+3=6 seconds total

* Clear kernel ID if disposed

* Merge jupyterlab-kernel-usage

* Add ipykernel dependency

* Update README

* Pin ipykernel>=6.11.0

* Remove jupyterlab-kernel-usage

* Include changes from Quansight/jupyterlab-kernel-usage#24

* Lint

* Remove @jupyterlab/launcher dependency

Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>

* Review

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: Eric Charles <eric@datalayer.io>
Co-authored-by: krassowski <5832902+krassowski@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@krassowski krassowski mentioned this pull request Dec 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant