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

Handle currentWidget in KernelWidgetTracker #206

Merged
merged 2 commits into from
Jul 28, 2023
Merged

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Jul 28, 2023

FIxes #204

The tracker now keeps track of the currentWidget. This is useful in the case of Notebook 7 where connecting to currentChanged might not be enough. Notebook 7 adds the notebook widget to the page very early, and the kernel usage component might be connecting to tracker.currentChanged after the tracker.currentChanged is emitted.

notebook-7-kernel-usage.mp4

@jtpio jtpio added the bug label Jul 28, 2023
@jtpio jtpio added this to the 1.0.0 milestone Jul 28, 2023
@jtpio jtpio marked this pull request as ready for review July 28, 2023 05:36
@mahendrapaipuri
Copy link
Contributor

@jtpio Just to get my head around this, you are saying that when we start a notebook server, the widget has been created and emitted. But only when the user opens a notebook file from the interface, tracker.currentChanged is attempting to connect but it is too late? So, we should ensure that we connect to the signal before it emits data?

@jtpio
Copy link
Member Author

jtpio commented Jul 28, 2023

I would say it's more that the notebook tracker (which keeps track of all the notebook widgets currently opened on the page - on the frontend) fires currentChanged quickly in the case of Notebook 7, and only once. And that the consumers of the currentChanged signal register their callbacks after the first currentChanged signal is emitted, which would explain why we noticed notebookChangeCallback was never called.

This was likely not an issue in JupyterLab because the UI takes more time to initialize and the signal might be emitted multiple times.

@mahendrapaipuri
Copy link
Contributor

Ok, I see. What I noticed from my tests is that the notebookChangeCallback was indeed fired but on the tab of the notebook interface (which shows list of files and directories) but there is no widget on that tab and so, it returns immediately. But this notebookChangeCallback was never fired on the new tab where actual notebook was opened.

What you told is coherent with the behavior I observed. Thanks a lot for the explanation @jtpio

@mahendrapaipuri
Copy link
Contributor

@jtpio Btw, I have noticed that IStatusBar does not exist for notebook interface. I guess we should make it optional for resourceStatusPlugin extension?

@jtpio
Copy link
Member Author

jtpio commented Jul 28, 2023

I guess we should make it optional for resourceStatusPlugin extension?

yes that would make sense. Would you like to open a PR?

@mahendrapaipuri
Copy link
Contributor

Sure, will do that!

@jtpio
Copy link
Member Author

jtpio commented Jul 28, 2023

Thanks!

@jtpio jtpio merged commit 1cf0e15 into jupyter-server:main Jul 28, 2023
@jtpio jtpio deleted the fix-nb7 branch July 28, 2023 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notebook 7: kernel usage is missing
2 participants