marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
5.35k stars 156 forks source link

fix: Save cell execution times for session resume #1619

Closed wasimsandhu closed 2 weeks ago

wasimsandhu commented 2 weeks ago

📝 Summary

During cell execution, execution times are now saved in SessionView. On session resume (browser refresh), these execution times are displayed on initial load. Otherwise, they are calculated by the frontend as currently designed.

Fixes #1330.

🔍 Description of Changes

Cell execution time is tracked by the cell operation status. If cell goes from "queued" to "running", a start time is saved. Once it goes from "running" to "idle", the difference is calculated and saved in milliseconds.

Gaining a better understanding of how sessions and cell operations are managed, but it is still incomplete, so it's likely this is a naive approach. As always, please let me know what I'm missing. 🙂

📋 Checklist

📜 Reviewers

@mscolnick

vercel[bot] commented 2 weeks ago

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 Jun 14, 2024 6:03am
marimo-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 14, 2024 6:03am
wasimsandhu commented 2 weeks ago

Backend timestamp calculation will be a few milliseconds off from the frontend calc. Given the transience of these retained execution times, I don't think a user would notice, but it wouldn't hurt to always pass the timestamp from the backend...

Screenshot 2024-06-13 at 7 57 08 PM
github-actions[bot] commented 2 weeks ago

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