Repository navigation
Render figure PNGs before starting result uploads in log_async - #560
Merged
Merged
Conversation
The test-suite runner awaits TestResult.log_async() directly, bypassing the pre-serialization that TestResult.log() does. Figures were therefore rendered inside alog_figure while the log_test_results request was already in flight. Kaleido 1.x launches a Chromium per figure and blocks the event loop while it runs, so with several figures the 30s request timeout expired on the results upload (asyncio.TimeoutError from aiohttp's TimerContext). Move the pre-serialization into a helper called from both log() and log_async(), so every PNG is rendered before any request starts. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
|
Pull requests must include at least one of the required labels: |
juanmleng
approved these changes
Sep 3, 2026
Contributor
|
Pull requests must include at least one of the required labels: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Description
What and why?
TestSuiteRunner(used byrun_documentation_tests) awaitsTestResult.log_async()directly and so skipped the figure pre-serialization thatTestResult.log()does. Each Plotly figure was therefore rendered with kaleido insidealog_figurewhile thelog_test_resultsrequest was already in flight. Kaleido 1.x launches a fresh Chromium per figure and blocks the event loop while it runs, so with several figures the 30sVM_API_TIMEOUTexpired on the results upload:Seen on the JupyterHub demo environment running
application_scorecard_full_suite.ipynbon 2.13.12. In a fresh process on the same host the same POST completes in 20ms, which isolated in-flight rendering as the cause.log_async()now pre-serializes all figure PNGs before creating any upload task, via a helper shared withlog().How to test
uv run python -m unittest tests.test_results— includes the newtest_test_result_log_async_pre_serializes_figures, which asserts the PNG cache is populated by the timealog_figureis called.%pip install --user "git+https://github.com/validmind/validmind-library@andres/fix-figure-upload-timeout", restart the kernel, rerunapplication_scorecard_full_suite.ipynb. Verified by @cachafla: the full suite logs without timeouts.What needs special review?
_pre_serialize_figures()is now called twice on thelog()path (once outside the loop, once insidelog_async()); the second call is a no-op because the bytes are cached.Dependencies, breaking changes, and deployment notes
None. The three failures in
tests.test_api_clientare pre-existing onmainand unrelated.Release notes
Fixed
asyncio.TimeoutErrorwhenrun_documentation_testsuploads results with several Plotly figures. Figures are now rendered before uploads start.Checklist
🤖 Generated with Claude Code