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

Refresh connection on App Mode #2488

Closed
peterwilli opened this issue Oct 3, 2024 · 7 comments
Closed

Refresh connection on App Mode #2488

peterwilli opened this issue Oct 3, 2024 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@peterwilli
Copy link
Contributor

Description

When running as marimo run <file>, and doing something intensive with a lot of RAM, and then refreshing the page, it will spawn a completely new session, risking human error, and loading things twice..

Suggested solution

Is it possible to get the same behaviour as in edit mode, but without showing code?

Like this:
Showing reconnection panel

Alternative

No response

Additional context

No response

@mscolnick
Copy link
Contributor

The App Mode is intended to work with multiple users having their own sessions (kind of like Streamlit). Would you want the same session shared across all users, or would you want a persistent session for an individual user?

Could you write some of the intensive work to disk? If yes, it is hard to set up? If yes again, we are soon releasing a caching decorator like @functools.cache that works across refreshes, that could help.

@peterwilli
Copy link
Contributor Author

Wow that's super fast! Thanks! I was just checking the source while waiting for an answer!

Uhm, the thing is the App Mode runs locally in my case. It is launched through an shell script and the user can then use the notebook as application.

In the application, I load an LLM (GGUF) and one user has refreshed the browser, causing the LLM to load twice. I was not aware of this because I assumed the edit mode was similar to run mode, minus the source code.

I'm not aware how I can persist this loading across sessions, except when I launch a HTTP API or something, which I rather avoid (I really like the simplicity it has now)

@mscolnick
Copy link
Contributor

Your use-case makes a lot of sense. We can consider adding --resumable-sessions (or --persist-sessions), with some sort of timeout, to the marimo run CLI.

or --single-session (which might be easier to implement, since then we don't need to keep track of which session belongs to who).

Implementation details aside: we may not get to this for a bit, so open to contributions; I'll add some GH labels if someone wants to pick this up.

@mscolnick mscolnick added enhancement New feature or request help wanted Extra attention is needed labels Oct 3, 2024
@peterwilli
Copy link
Contributor Author

I'm actually making it right now, I wasn't sure if you'd merge it but I'll post it as PR if done!

@mscolnick
Copy link
Contributor

hell yea! thanks @peterwilli, i think it would be a great addition 🙌

@peterwilli
Copy link
Contributor Author

peterwilli commented Oct 3, 2024

Here you go! #2489

No idea if done right, but it works over herem I'll await the responses in the PR

@peterwilli
Copy link
Contributor Author

Closing this issue as the PR is now in progress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants