Skip to content

test(amber): replace commented-out PythonWorkflowWorkerSpec with pythonworker proxy unit tests - #7488

Merged
aglinxinyuan merged 1 commit into
apache:mainfrom
aglinxinyuan:test/pythonworker-proxy-specs
Aug 10, 2026
Merged

test(amber): replace commented-out PythonWorkflowWorkerSpec with pythonworker proxy unit tests#7488
aglinxinyuan merged 1 commit into
apache:mainfrom
aglinxinyuan:test/pythonworker-proxy-specs

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

#7447 proposed deleting PythonWorkflowWorkerSpec.scala, which has been fully commented out for years and no longer compiles against today's APIs. Following the review feedback there (#7447 (comment)), this PR replaces the dead file with real unit tests instead of only deleting it.

The commented-out spec drove PythonWorkflowWorker end-to-end, which needs a live Python process — that path is covered by the e2e tests. What can be unit-tested without Python is the JVM side of the JVM↔Python Arrow Flight bridge, which had no coverage until now:

                     JVM                                     Python
  ┌───────────────────────────────────────┐
  │ PythonWorkflowWorker (actor)          │      e2e-tested only (needs Python)
  │  ├─ PythonProxyClient ──── Flight ────┼────▶ network_receiver.py
  │  │    PythonProxyClientSpec: fake     │
  │  │    Python Flight server in Scala   │
  │  └─ PythonProxyServer ◀─── Flight ────┼───── network_sender.py
  │       PythonProxyServerSpec: test     │
  │       plays the Python Flight client  │
  └───────────────────────────────────────┘
New spec Subject Behavior pinned down
PythonProxyServerSpec PythonProxyServer / AmberProducer handshake completes the port promise and replies ok; control actions route ControlInvocation / ReturnInvocation to the output gateway on the control channel and ack with a little-endian credit value; Data / State / ECM puts are reassembled into DataFrame / StateFrame (loop envelope preserved) / EmbeddedControlMessage and acked with credits
PythonProxyClientSpec PythonProxyClient heartbeat handshake happens before the queue is drained; queued ControlInvocation / ReturnInvocation / actor commands arrive as control / actor actions with intact protobuf payloads; DataFrame / StateFrame / ECM puts arrive under the right PythonDataHeader with tuples, loop envelope, and bytes intact; queue-size acks update getQueuedCredit; connection retries abort with WorkflowRuntimeException (no server listening, non-ack heartbeat); close() before any connection does not throw

Both specs stand in for the Python worker with plain Arrow Flight components (FlightClient / NoOpFlightProducer), so no Python process is involved. Together with the existing WorkerBatchInternalQueueSpec and PythonWorkflowWorkerStartupConfigSpec, every class in the pythonworker package except the actor itself now has unit coverage.

The commented-out PythonWorkflowWorkerSpec.scala is removed, superseded by these tests.

Any related issues, documentation, discussions?

Supersedes #7447.

How was this PR tested?

This PR is tests-only. Both new specs pass locally:

sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.pythonworker.PythonProxyServerSpec org.apache.texera.amber.engine.architecture.pythonworker.PythonProxyClientSpec"

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

Generated-by: Claude Code (Claude Fable 5)

…onworker proxy unit tests

PythonWorkflowWorkerSpec.scala has been fully commented out for years and
no longer compiles against today's APIs; the actor-level path it targeted
is covered by the e2e tests. Replace it with real unit tests for the JVM
side of the JVM<->Python Arrow Flight bridge, which had none:

- PythonProxyServerSpec: handshake port promise + ok reply; control
  actions route ControlInvocation/ReturnInvocation to the output gateway
  on the control channel and ack with a little-endian credit; Data/State/
  ECM puts are reassembled into DataFrame/StateFrame (loop envelope
  preserved)/EmbeddedControlMessage and acked with credits.
- PythonProxyClientSpec: heartbeat-before-drain connection order; queued
  control/actor commands and Data/State/ECM payloads arrive as the right
  Flight actions/puts with intact payloads; queue-size acks drive
  getQueuedCredit; retry exhaustion and non-ack heartbeats abort with
  WorkflowRuntimeException; close() before connecting does not throw.

Both specs stand in for the Python worker with plain Arrow Flight
components, so no Python process is involved.
Copilot AI lite review requested due to automatic review settings August 10, 2026 00:58

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 reached their quota limit.

@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.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 2 better · 🔴 7 worse · ⚪ 6 noise (<±5%) · 0 without baseline

Compared against main 6790bf1 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 365 0.223 25,921/36,759/36,759 us 🔴 +16.0% / 🔴 +124.3%
🟢 bs=100 sw=10 sl=64 809 0.494 123,346/136,770/136,770 us 🟢 -8.7% / 🔴 +21.6%
🔴 bs=1000 sw=10 sl=64 893 0.545 1,110,506/1,207,557/1,207,557 us 🔴 +7.8% / 🔴 +12.2%
Baseline details

Latest main 6790bf1 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 365 tuples/sec 414 tuples/sec 743.73 tuples/sec -11.8% -50.9%
bs=10 sw=10 sl=64 MB/s 0.223 MB/s 0.253 MB/s 0.454 MB/s -11.9% -50.9%
bs=10 sw=10 sl=64 p50 25,921 us 23,904 us 13,130 us +8.4% +97.4%
bs=10 sw=10 sl=64 p95 36,759 us 31,700 us 16,391 us +16.0% +124.3%
bs=10 sw=10 sl=64 p99 36,759 us 31,700 us 19,408 us +16.0% +89.4%
bs=100 sw=10 sl=64 throughput 809 tuples/sec 785 tuples/sec 944.04 tuples/sec +3.1% -14.3%
bs=100 sw=10 sl=64 MB/s 0.494 MB/s 0.479 MB/s 0.576 MB/s +3.1% -14.3%
bs=100 sw=10 sl=64 p50 123,346 us 125,996 us 105,853 us -2.1% +16.5%
bs=100 sw=10 sl=64 p95 136,770 us 149,744 us 112,493 us -8.7% +21.6%
bs=100 sw=10 sl=64 p99 136,770 us 149,744 us 122,200 us -8.7% +11.9%
bs=1000 sw=10 sl=64 throughput 893 tuples/sec 919 tuples/sec 972.22 tuples/sec -2.8% -8.1%
bs=1000 sw=10 sl=64 MB/s 0.545 MB/s 0.561 MB/s 0.593 MB/s -2.9% -8.2%
bs=1000 sw=10 sl=64 p50 1,110,506 us 1,083,958 us 1,033,856 us +2.4% +7.4%
bs=1000 sw=10 sl=64 p95 1,207,557 us 1,120,686 us 1,076,083 us +7.8% +12.2%
bs=1000 sw=10 sl=64 p99 1,207,557 us 1,120,686 us 1,107,701 us +7.8% +9.0%
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,548.14,200,128000,365,0.223,25920.71,36758.69,36758.69
1,100,10,64,20,2472.87,2000,1280000,809,0.494,123346.21,136770.14,136770.14
2,1000,10,64,20,22403.83,20000,12800000,893,0.545,1110506.27,1207556.77,1207556.77

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.96%. Comparing base (6790bf1) to head (480b7c1).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7488      +/-   ##
============================================
+ Coverage     85.69%   85.96%   +0.27%     
- Complexity     4168     4210      +42     
============================================
  Files          1169     1169              
  Lines         46739    46739              
  Branches       5203     5203              
============================================
+ Hits          40052    40181     +129     
+ Misses         4974     4824     -150     
- Partials       1713     1734      +21     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 6790bf1
agent-service 85.50% <ø> (ø) Carriedforward from 6790bf1
amber 81.84% <ø> (+0.75%) ⬆️
computing-unit-managing-service 50.72% <ø> (ø) Carriedforward from 6790bf1
config-service 65.97% <ø> (ø) Carriedforward from 6790bf1
file-service 69.05% <ø> (ø) Carriedforward from 6790bf1
frontend 88.50% <ø> (ø) Carriedforward from 6790bf1
notebook-migration-service 78.89% <ø> (ø) Carriedforward from 6790bf1
pyamber 97.55% <ø> (ø) Carriedforward from 6790bf1
workflow-compiling-service 26.31% <ø> (ø) Carriedforward from 6790bf1

*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.

@aglinxinyuan
aglinxinyuan requested a review from mengw15 August 10, 2026 01:37

@mengw15 mengw15 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.

LGTM

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Aug 10, 2026
Merged via the queue into apache:main with commit 88ca47f Aug 10, 2026
24 checks passed
@aglinxinyuan
aglinxinyuan deleted the test/pythonworker-proxy-specs branch August 10, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants