You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to start a background thread or open a persistent connection to a server. Usually, in python, the way to do these things cleanly is to use a context manager.
Suggested solution
In Marimo, what I'd like to do is basically say "run the rest of the computation within this context manager" so that if any of the descendants of a cell are run, the context is not broken but if the cell or its parents are edited, the context manager first exits and then restarts. Something like
do things
with my_background_thread():
mo.descend()
where mo.descend only returns if this cell or its parents are edited.
Alternative
Some other way to set contexts that are torn down at the right time
Additional context
No response
The text was updated successfully, but these errors were encountered:
Description
I want to start a background thread or open a persistent connection to a server. Usually, in python, the way to do these things cleanly is to use a context manager.
Suggested solution
In Marimo, what I'd like to do is basically say "run the rest of the computation within this context manager" so that if any of the descendants of a cell are run, the context is not broken but if the cell or its parents are edited, the context manager first exits and then restarts. Something like
where mo.descend only returns if this cell or its parents are edited.
Alternative
Some other way to set contexts that are torn down at the right time
Additional context
No response
The text was updated successfully, but these errors were encountered: