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

feat: lazy runtime #1302

Merged
merged 35 commits into from
May 6, 2024
Merged

feat: lazy runtime #1302

merged 35 commits into from
May 6, 2024

Conversation

akshayka
Copy link
Contributor

@akshayka akshayka commented May 2, 2024

This PR adds a configuration to make the runtime lazy. When enabled, running a cell marks descendants cells as stale but doesn't automatically run them.

Running a cell will still never use stale inputs: if a cell has any stale ancestors, those will be run before the cell is run.

This makes working with notebooks that run expensive computations much more ergonomic, while still preserving the semantics of the DAG and the computational reproducibility afforded by it.

Copy link

vercel bot commented May 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2024 9:57pm
marimo-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2024 9:57pm


for cid in runner.cells_to_run:
if runner.graph.is_disabled(cid):
runner.graph.cells[cid].set_stale(stale=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in "detect", could this .set_stale(stale=True) twice? probably a pre-optimization, but could force re-renders on the frontend

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could ... but I think this code path won't be hit when the mode is detect.

@@ -91,13 +91,10 @@ by your notebook's imported modules too.

Autoreloading comes in two types:

- "detect": automatically marks cells affected by module
- "lazy": automatically marks cells affected by module
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patched the config loader to make this backward compatible.

Comment on lines +137 to +139
@pytest.fixture(params=["k", "lazy_kernel"])
def any_kernel(request: Any) -> Kernel:
return request.getfixturevalue(request.param)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New fixture that runs a test twice, once with each type of kernels.

@akshayka akshayka marked this pull request as ready for review May 6, 2024 21:41
@akshayka akshayka changed the title Draft: Lazy runtime feat: lazy runtime May 6, 2024
mscolnick
mscolnick previously approved these changes May 6, 2024
Copy link
Contributor

@mscolnick mscolnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

Copy link

github-actions bot commented May 6, 2024

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.4.12-dev10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants