-
Notifications
You must be signed in to change notification settings - Fork 839
Fix: state resolution #7110
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
Fix: state resolution #7110
Conversation
This PR prunes logic in state resolution which eagerly marked cells as stale and enqueued a stale cell request whenever a setter was called; in the main thread, running stale cells in the main cell execution loop. Eager execution of state updates only needs to happen when running state updates in a mo.Thread object (either manually or via the mo.watch APIs). This PR updates conditions how state resolution happens based on whether the current thread is a mo.Thread. Additionally, instead of relying on the state registry to find bound names, which does not work when a state update is called in the cell that defined it, we just scan globals to find cells that have the state object in their refs (similar to what CellRunner does).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Nice! I can grab the side-effect issue to take it off your plate if needed |
Thanks @dmadisetti -- is the fix relatively simple/easy for you? If so, feel free to push it up to this PR. If not, I can look into it in my downtime. |
dmadisetti
left a comment
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.
Re triggered the tests- flaky windows one started an early failure- but looks good. Much better than mocking out the whole execution queu
| (tmp_path / "test.txt").touch() | ||
| await asyncio.sleep(0.25) | ||
| await k.run([]) | ||
| assert len(control_requests) == 1 |
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.
Nice, this is a good check too
This PR prunes logic in state resolution which eagerly marked cells as stale and enqueued a stale cell request whenever a setter was called; in the main thread, running cells made stale by a state update is handled by the main cell execution loop.
Eager execution of state updates only needs to happen when running state updates in a
mo.Threadobject (either manually or via the mo.watch APIs). This PR updates conditions how state resolution happens based on whether the current thread is amo.Thread.Additionally, instead of relying on the state registry to find bound names, which does not work when a state update is called in the cell that defined it, we just scan globals to find cells that have the state object in their refs (similar to what
CellRunnerdoes).Closes #7060
Closes #6847
Closes #5311
Closes #5139