Skip to content

refactor(workflow-operator): share chart Python codegen - #9646

Open
aglinxinyuan wants to merge 1 commit into
apache:mainfrom
aglinxinyuan:refactor/viz-runtime-standalone-codegen
Open

aglinxinyuan wants to merge 1 commit into
apache:mainfrom
aglinxinyuan:refactor/viz-runtime-standalone-codegen

Conversation

@aglinxinyuan

@aglinxinyuan aglinxinyuan commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Share duplicated runtime (generatePythonCode) and standalone (generateStandaloneCode) Plotly Python code generation across four visualization operators in common/workflow-operator (4 files, +364/-571, -207 net lines):

File Shared codegen Net LOC
NetworkGraphOpDesc.scala Extracts NetworkGraphPython.body(indent) for graph construction, seeded spring_layout, edge/node traces, and figure layout +107/-181 (-74)
BulletChartOpDesc.scala Extracts deltaReferenceLiteral, thresholdLiteral, stepsLiteral, and BulletChartPython (helperDefs, stepsListBody, figureBody) +96/-136 (-40)
TreePlotOpDesc.scala Extracts TreePlotPython.annotationsBody, parseEdges, and figureBody (reusing PythonCodeFragment.render) +94/-135 (-41)
ContinuousErrorBandsOpDesc.scala Extracts buildFigure(tableVar, encode, indent) returning PythonTemplateBuilder so runtime createPlotlyFigure() preserves both .plain and .encode modes while standalone renders via pyStringLiteral +67/-119 (-52)

Notes for reviewers:

  • Runtime pyb base64 encoding (self.decode_python_template(...)) and standalone pyStringLiteral escaping are preserved unchanged.
  • No existing operator tests were modified; all user-facing behavior and error messages remain identical.

Any related issues, documentation, discussions?

Closes #9645

How was this PR tested?

Verified on cd3fc253ee (based on origin/main 95e2748b97) with JDK 17.0.14, sbt 1.12.9, and Python 3.12 (pandas 2.2.3, plotly 5.24.1, networkx 3.4.2):

sbt "WorkflowOperator/scalafixAll --check" "WorkflowOperator/scalafmtCheckAll"
UDF_PYTHON_PATH=/path/to/python3.12 sbt \
  "WorkflowOperator/testOnly *NetworkGraphOpDescSpec *BulletChartOpDescSpec *TreePlotOpDescSpec *ContinuousErrorBandsOpDescSpec *ColorPatternSpec" \
  "WorkflowCompilingService/testOnly *WorkflowToPythonTranslatorSpec"
  • Lint / format: WorkflowOperator/scalafixAll --check and WorkflowOperator/scalafmtCheckAll exit 0.
  • Unit tests (JUnit XML):
    • WorkflowOperator: 5 suites, 100 cases (99 passed, 1 pre-existing pendingUntilFixed skipped in BulletChartOpDescSpec, 0 failed), including all 5 live NeedsPythonPackages layout tests in TreePlotOpDescSpec.
    • WorkflowCompilingService: WorkflowToPythonTranslatorSpec 19/19 passed.
  • Live Python parity: Executed generated runtime (generatePythonCode) and standalone (generateStandaloneCode) scripts for all four operators in Python 3.12 against origin/main 95e2748b97: 8/8 Plotly figure JSON outputs matched identically, and ContinuousErrorBandsOpDesc.createPlotlyFigure() preserved literal column names under .plain and base64 decode expressions under .encode.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Antigravity

Copilot AI balanced review requested due to automatic review settings November 23, 2026 11:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@aglinxinyuan aglinxinyuan added common refactor Refactor the code labels Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • No candidates found from git blame history.

@codecov-commenter

codecov-commenter commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.70%. Comparing base (95e2748) to head (cd3fc25).

Files with missing lines Patch % Lines
.../visualization/bulletChart/BulletChartOpDesc.scala 78.37% 6 Missing and 2 partials ⚠️
...isualization/networkGraph/NetworkGraphOpDesc.scala 66.66% 4 Missing ⚠️
...tinuousErrorBands/ContinuousErrorBandsOpDesc.scala 86.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9646      +/-   ##
============================================
+ Coverage     91.67%   91.70%   +0.02%     
- Complexity     5135     5140       +5     
============================================
  Files          1304     1304              
  Lines         58088    58131      +43     
  Branches       7582     7584       +2     
============================================
+ Hits          53254    53308      +54     
+ Misses         2922     2910      -12     
- Partials       1912     1913       +1     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø)
agent-service 99.56% <ø> (ø) Carriedforward from 95e2748
amber 85.84% <84.61%> (+0.08%) ⬆️
computing-unit-managing-service 63.83% <ø> (ø)
config-service 87.50% <ø> (ø)
file-service 82.16% <ø> (ø)
frontend 96.45% <ø> (ø) Carriedforward from 95e2748
notebook-migration-service 83.77% <ø> (ø)
pyamber 98.38% <ø> (ø) Carriedforward from 95e2748
result-service 85.71% <ø> (ø)
workflow-compiling-service 78.30% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

✅ No material benchmark regressions detected

🟢 4 better · 🔴 0 worse · ⚪ 11 noise (<±5%) · 0 without baseline

Compared against main 95e2748 benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
⚪ bs=10 sw=10 sl=64 526 0.321 18,480/24,910/24,910 us ⚪ within ±5% / 🔴 +82.5%
🟢 bs=100 sw=10 sl=64 1,262 0.77 78,136/95,648/95,648 us 🟢 -13.3% / 🔴 +10.4%
⚪ bs=1000 sw=10 sl=64 1,436 0.876 693,829/796,238/796,238 us ⚪ within ±5% / 🟢 -10.7%
Baseline details

Latest main 95e2748 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 526 tuples/sec 541 tuples/sec 1,018 tuples/sec -2.8% -48.4%
bs=10 sw=10 sl=64 MB/s 0.321 MB/s 0.33 MB/s 0.622 MB/s -2.7% -48.4%
bs=10 sw=10 sl=64 p50 18,480 us 17,854 us 10,127 us +3.5% +82.5%
bs=10 sw=10 sl=64 p95 24,910 us 26,003 us 13,693 us -4.2% +81.9%
bs=10 sw=10 sl=64 p99 24,910 us 26,003 us 16,105 us -4.2% +54.7%
bs=100 sw=10 sl=64 throughput 1,262 tuples/sec 1,201 tuples/sec 1,364 tuples/sec +5.1% -7.5%
bs=100 sw=10 sl=64 MB/s 0.77 MB/s 0.733 MB/s 0.832 MB/s +5.0% -7.5%
bs=100 sw=10 sl=64 p50 78,136 us 80,312 us 79,321 us -2.7% -1.5%
bs=100 sw=10 sl=64 p95 95,648 us 110,295 us 86,661 us -13.3% +10.4%
bs=100 sw=10 sl=64 p99 95,648 us 110,295 us 98,907 us -13.3% -3.3%
bs=1000 sw=10 sl=64 throughput 1,436 tuples/sec 1,444 tuples/sec 1,406 tuples/sec -0.6% +2.1%
bs=1000 sw=10 sl=64 MB/s 0.876 MB/s 0.881 MB/s 0.858 MB/s -0.6% +2.1%
bs=1000 sw=10 sl=64 p50 693,829 us 689,141 us 776,724 us +0.7% -10.7%
bs=1000 sw=10 sl=64 p95 796,238 us 779,756 us 814,345 us +2.1% -2.2%
bs=1000 sw=10 sl=64 p99 796,238 us 779,756 us 862,305 us +2.1% -7.7%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,380.43,200,128000,526,0.321,18480.49,24910.22,24910.22
1,100,10,64,20,1584.78,2000,1280000,1262,0.770,78136.34,95648.14,95648.14
2,1000,10,64,20,13928.50,20000,12800000,1436,0.876,693828.54,796238.34,796238.34

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Share runtime and standalone Python codegen in visualization operators

3 participants