Repository navigation
Fall back to placeholder PNG when Plotly static export fails - #582
Draft
kam-validmind wants to merge 2 commits into
Draft
kam-validmind wants to merge 2 commits into
kam-validmind wants to merge 2 commits into
Conversation
Kaleido 1.x needs a working Chrome, which isn't available on Databricks serverless. Instead of failing the run, upload the Plotly JSON with a placeholder image, stop retrying after the first failure, and add VALIDMIND_PLOTLY_STATIC_EXPORT=false to skip the attempt.
|
|
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.
Problem
On Databricks serverless, Kaleido 1.x can't start Chrome (no root, missing system libs), so
run_documentation_tests()fails as soon as a test produces a Plotly figure. Retries can also leave the cell hanging.Change
fig.to_imagefails, log one warning and upload a placeholder PNG plus the Plotly JSON (json_image), so the platform can render the figure interactively.VALIDMIND_PLOTLY_STATIC_EXPORT=falseskips the attempt up front.Notes
/log_figurerequires theimagefile, so a placeholder is uploaded rather than omitting the PNG. Anything using the PNG instead of the JSON (e.g. document export) shows the placeholder.to_imageexception, not only "Chrome is missing". If Chrome works but one figure fails for a one-off reason (Kaleido's 90-second render timeout on a very large figure, a Chrome crash), the rest of the session also gets placeholders, where before only that one test failed. This is deliberate: it keeps the Databricks case to a single attempt, and the one-off case is rare and comes with a warning naming the error. Alternatives if it bites: latch only on Kaleido/Chrome start-up errors, or after two or three consecutive failures.Tests
tests/test_figure_static_export.py(4 tests).