-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Make
open
to spin-off UI server and to be used in CLI and not…
…ebook (#1157) closes #1002 This PR proposed to resolve the issue discussed in #1002: - `open` should provide the possibility to spin-off a UI server - `open` can therefore be used in the notebook and with the CLI - `kill` to kill all alive servers (normally we tested that we should not have some case or zombie processes). So in short, we allow for the following: ```python import skore project = skore.open("my_project") project.shutdown_web_ui() ``` ### Implementation details We launch the UI in a separate process. Why process: if we would attach to the async loop for the notebook or run in a separate thread from the main process, we might get into trouble when this main process starts to execute large computation making the UI unresponsive. So we are starting a new process with the webserver inside. For the moment, we expect to have 1 skore project associated with 1 skore UI server. So we don't allow to spin a new webserver if one already exist and is associated with a running skore project. Instead, we provide the link to the server. Also, we have a `rejoin` mechanism: if a project was closed but the UI was not, then when opening a project, we reattach the web server to it. Finally, we found with @rouk1 that you have the following use-cases: - CI/CD: you want `serve=False` when calling `open` - standalone script: You might be interested in `serve=True` and in this case, you most probably want to keep the webs server alive (so deamon + atexit is not what we want) - jupyter notebook: You might be interested in `serve=True` and you will be interested to have access to the UI the time that the notebook is alive. The current setup will kill the web server. So we added a `keep_alive` option that detect if you are in a specific environment and choose a sensible default but it can be easily overwritten. ### Notes Some of the covering is not really working with the multiprocessing because we explicitly check for the console message in the test and the coverage mentioned that we don't cover it. ### TODO - [x] write tests for the `keep_alive` option - [x] write tests for the `kill` cli
- Loading branch information
Showing
18 changed files
with
1,114 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
"""Alias top level function and class of the project submodule.""" | ||
|
||
from ._open import open | ||
from .project import Project | ||
|
||
__all__ = [ | ||
"open", | ||
"Project", | ||
] |
Oops, something went wrong.