Skip to content

Conversation

@kjgoodrick
Copy link
Contributor

📝 Summary

When using the progress bar the duration (e.g. 2 min, 2s per iter) of each loop will be shown instead of the rate (e.g. 0.01 iter/s) when progress is slow.

🔍 Description of Changes

When progress is slow the current implementation of the progress bar is not very helpful as it is harder to interpret 0.01 iter/s than 1 min 40s per iter. When the rate is very low the rounding also makes 100s appear the same as 100m (both 0.01 iter/s). This commit detects when the rate drops below 1 iteration per second and switches the display to show time per iteration instead.

Comparison Table

Rate [iter/s] Old New
10 10 iter/s 10 iter/s
1 1 iter/s 1 iter/s
0.5 0.5 iter/s 2s per iter
0.3267 0.33 iter/s 3.06s per iter
0.0751 0.08 iter/s 13s per iter
0.009 0.01 iter/s 1m, 11s per iter
0.00165 0.01 iter/s 10m, 2s per iter

This uses the same humanizer that is used for the ETA, so the styles match. There is one small change to the humanizer: if the seconds are greater than 10, no decimal places are shown on the smaller unit, to avoid outputs like 10m, 2.04s.

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • I have added tests for the changes made.
  • I have run the code and verified that it works as expected.

@vercel
Copy link

vercel bot commented Nov 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Ready Preview Comment Nov 20, 2025 2:47am

mscolnick
mscolnick previously approved these changes Nov 19, 2025
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.

nice, thank you for this change! its much more readable

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the progress bar display by showing duration per iteration (e.g., "2 min, 2s per iter") instead of rate (e.g., "0.01 iter/s") when progress is slow (rate < 1 iter/s). This improves readability and prevents confusion from rounded rates that appear identical.

Key changes:

  • Modified rate calculation to preserve precision for rates below 1 iter/s
  • Updated frontend to display time-per-iteration format when rate < 1
  • Adjusted prettyTime function to omit decimal places when seconds >= 10

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
marimo/_plugins/stateless/status/_progress.py Modified _calculate_rate() to preserve full precision for rates < 1, updated docstring
frontend/src/plugins/layout/ProgressPlugin.tsx Added conditional logic to display duration per iteration when rate < 1, modified prettyTime() to adjust decimal precision
tests/_plugins/stateless/status/test_progress.py Added test_update_progress_slowly() to verify slow progress behavior with 12s sleep
examples/outputs/progress_bar.py Added new example cell demonstrating slow progress with 12s delays
marimo/_smoke_tests/async_iterator.py Added test_progress_slow_async() to test slow progress with varying durations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…and split each case into its own test so all failures are reported.
@kjgoodrick
Copy link
Contributor Author

Thank you both for the suggestions. I’ve mocked time.time to quickly test slow progress and added additional tests for prettyTime. I also refactored the prettyTime tests so each case reports its own failure, but I’m happy to revert that change if it’s not desired.

Copy link
Contributor

@akshayka akshayka left a comment

Choose a reason for hiding this comment

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

Thanks!

@akshayka akshayka added enhancement New feature or request bash-focus Area to focus on during release bug bash labels Nov 20, 2025
@akshayka akshayka merged commit efeb10e into marimo-team:main Nov 20, 2025
35 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bash-focus Area to focus on during release bug bash enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants