-
Notifications
You must be signed in to change notification settings - Fork 883
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
viz: stop running and disable buttons when model.running is False #2332
viz: stop running and disable buttons when model.running is False #2332
Conversation
Performance benchmarks:
|
Looks good to me! |
How/when should/can I use this? |
Oh sorry I should've provided more context. The current solara viz keeps calling model.step() and updating plots, even when the model stops itself, in models such as the Schelling example: def step(self):
# model logic
...
if self.happy == len(self.agents):
self.running = False This PR stops the frontend when model.running becomes False, and disables the play and step buttons. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, sounds like an useful feature!
@quaquel want do you think about the whole |
A currently underdeveloped feature that needs to be implemented better. It is used with |
Merged! Pls feel free to change the label if anyone thinks there's a better one. |
It's a bug fix. The old JupyterViz does check the model.running: mesa/mesa/experimental/jupyter_viz.py Lines 231 to 234 in 7addec3
|
This PR stops calling
model.step()
from the frontend whenmodel.running
isFalse
. Play and step buttons are also disabled.