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

feat: stop jdaviz/voila when the browser window closes #2791

Merged

Conversation

maartenbreddels
Copy link
Collaborator

Description

This feature closes jdaviz (voila) when a kernel closes, which should happen when a browser page/tab is closed.

Voila itself does not have this feature, although jupyter-server has something along these lines, but only polls every 60 seconds:
https://github.com/jupyter-server/jupyter_server/blob/de6d9047fa414859856198b7b2dfe80e60edd010/jupyter_server/serverapp.py#L2547

This change makes it immediate, but requires monkey patching. This API has been stable from the start of Voila when we wrote it, so I am not too worried that is will break, and I also believe Voila is pinned.

Checklist for package maintainer(s)

This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a milestone set? Set this to bugfix milestone if this is a bug fix and needs to be released ASAP; otherwise, set this to the next major release milestone. Bugfix milestone also needs an accompanying backport label.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

Copy link

codecov bot commented Apr 9, 2024

Codecov Report

Attention: Patch coverage is 0% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 88.71%. Comparing base (f1ba4a6) to head (920b616).
Report is 28 commits behind head on main.

Files Patch % Lines
jdaviz/cli.py 0.00% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2791      +/-   ##
==========================================
- Coverage   88.72%   88.71%   -0.01%     
==========================================
  Files         110      110              
  Lines       16353    16557     +204     
==========================================
+ Hits        14509    14689     +180     
- Misses       1844     1868      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kecnry kecnry added this to the 3.10 milestone Apr 10, 2024
Copy link
Contributor

@pllim pllim left a comment

Choose a reason for hiding this comment

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

Tested on Windows 11. I launched CLI from a terminal. Able to use Imviz. When I closed the tab, the terminal got freed up, i.e., I didn't have to Control+C to get out of the server. So I think this works. Thanks!

@kecnry
Copy link
Member

kecnry commented Apr 11, 2024

Maybe we should consider this a bugfix and get it in 3.9.1?

@pllim pllim modified the milestones: 3.10, 3.9.1 Apr 11, 2024
@pllim pllim added bug Something isn't working 💤 backport-v3.9.x on-merge: backport to v3.9.x labels Apr 11, 2024
Copy link
Collaborator

@rosteen rosteen left a comment

Choose a reason for hiding this comment

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

I tested this successfully on Mac, I'm ok with the monkey patching to get this working. Thanks!

@kecnry kecnry force-pushed the feat_shutdown_on_browser_close branch from 1f285c8 to 920b616 Compare April 11, 2024 19:58
@kecnry
Copy link
Member

kecnry commented Apr 11, 2024

rebased and added a changelog entry for 3.9.1. Should be good to merge as soon as CI runs/passes.

@kecnry kecnry marked this pull request as ready for review April 11, 2024 19:59
@kecnry kecnry merged commit 1d571eb into spacetelescope:main Apr 12, 2024
14 of 16 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/jdaviz that referenced this pull request Apr 12, 2024
kecnry pushed a commit that referenced this pull request Apr 12, 2024
…oses (#2799)

Co-authored-by: Maarten Breddels <maartenbreddels@gmail.com>
gibsongreen pushed a commit to gibsongreen/jdaviz that referenced this pull request Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 💤 backport-v3.9.x on-merge: backport to v3.9.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants