Skip to content

Conversation

@mscolnick
Copy link
Contributor

@mscolnick mscolnick commented Jun 10, 2025

I didn't actually test the perf, but did notice when this was running that other requests could get blocked

@mscolnick mscolnick requested review from Copilot and dmadisetti June 10, 2025 14:38
@vercel
Copy link

vercel bot commented Jun 10, 2025

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 10, 2025 9:28pm

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 pull request modifies the auto-export functionality to avoid blocking when saving export files by switching to asynchronous file operations using a thread pool. Key changes include refactoring the file save methods into asynchronous functions, introducing a thread pool for blocking I/O, and instantiating a single AutoExporter instance in the API endpoints.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
marimo/_server/export/exporter.py Refactored synchronous file operations to async with threadpool use
marimo/_server/api/endpoints/export.py Updated endpoints to await the new async auto-export functions

# save html to .marimo directory
filepath.write_text(html, encoding="utf-8")
# Run blocking file I/O in thread pool
loop = asyncio.get_event_loop()
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

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

Consider using 'asyncio.get_running_loop()' instead of 'asyncio.get_event_loop()' to obtain the current running loop in an async function.

Suggested change
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@dmadisetti dmadisetti left a comment

Choose a reason for hiding this comment

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

Typing, but looks reasonable- makes sense from what we saw

@mscolnick mscolnick merged commit 7b4ed54 into main Jun 11, 2025
34 of 37 checks passed
@mscolnick mscolnick deleted the ms/auto-export branch June 11, 2025 01:59
@github-actions
Copy link

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

sebbeutler pushed a commit to sebbeutler/marimo that referenced this pull request Jun 28, 2025
I didn't actually test the perf, but did notice when this was running
that other requests could get blocked
sebbeutler pushed a commit to sebbeutler/marimo that referenced this pull request Jul 7, 2025
I didn't actually test the perf, but did notice when this was running
that other requests could get blocked
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.

3 participants