test(pyamber): extend the OutputManager tests to cover its partitioning, output-port and emit semantics - #7815
Open
eugenegujing wants to merge 2 commits into
Open
Conversation
…ng, output-port and emit semantics Extend test_output_manager.py from 10 to 39 tests: save_tuple_to_storage_if_needed's no-op and fan-out shapes, add_output_port's None normalizations and once-only guard, all five add_partitioning dispatch entries driven through OutputManager, the tuple_to_batch/tuple_to_frame/emit_ecm/emit_state emit chain, and the port/channel query methods. Also strengthen an existing reset_output_storage test to assert the (uri, schema) pairing rather than the URI set alone.
Contributor
Automated Reviewer SuggestionsBased on the
|
Contributor
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 527 | 0.322 | 16,767/30,078/30,078 us | 🔴 +8.2% / 🔴 +100.6% |
| 🟢 | bs=100 sw=10 sl=64 | 1,140 | 0.696 | 84,198/130,845/130,845 us | 🟢 -9.8% / 🔴 +23.4% |
| ⚪ | bs=1000 sw=10 sl=64 | 1,352 | 0.825 | 738,552/782,940/782,940 us | ⚪ within ±5% / 🟢 +29.6% |
Baseline details
Latest main 2edbdf9 from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 527 tuples/sec | 568 tuples/sec | 780.31 tuples/sec | -7.2% | -32.5% |
| bs=10 sw=10 sl=64 | MB/s | 0.322 MB/s | 0.347 MB/s | 0.476 MB/s | -7.2% | -32.4% |
| bs=10 sw=10 sl=64 | p50 | 16,767 us | 15,500 us | 12,590 us | +8.2% | +33.2% |
| bs=10 sw=10 sl=64 | p95 | 30,078 us | 29,000 us | 14,995 us | +3.7% | +100.6% |
| bs=10 sw=10 sl=64 | p99 | 30,078 us | 29,000 us | 19,141 us | +3.7% | +57.1% |
| bs=100 sw=10 sl=64 | throughput | 1,140 tuples/sec | 1,136 tuples/sec | 1,006 tuples/sec | +0.4% | +13.3% |
| bs=100 sw=10 sl=64 | MB/s | 0.696 MB/s | 0.693 MB/s | 0.614 MB/s | +0.4% | +13.4% |
| bs=100 sw=10 sl=64 | p50 | 84,198 us | 83,643 us | 99,387 us | +0.7% | -15.3% |
| bs=100 sw=10 sl=64 | p95 | 130,845 us | 145,122 us | 106,056 us | -9.8% | +23.4% |
| bs=100 sw=10 sl=64 | p99 | 130,845 us | 145,122 us | 113,689 us | -9.8% | +15.1% |
| bs=1000 sw=10 sl=64 | throughput | 1,352 tuples/sec | 1,341 tuples/sec | 1,043 tuples/sec | +0.8% | +29.6% |
| bs=1000 sw=10 sl=64 | MB/s | 0.825 MB/s | 0.818 MB/s | 0.637 MB/s | +0.9% | +29.6% |
| bs=1000 sw=10 sl=64 | p50 | 738,552 us | 739,063 us | 965,215 us | -0.1% | -23.5% |
| bs=1000 sw=10 sl=64 | p95 | 782,940 us | 809,232 us | 1,009,610 us | -3.2% | -22.5% |
| bs=1000 sw=10 sl=64 | p99 | 782,940 us | 809,232 us | 1,039,108 us | -3.2% | -24.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,379.29,200,128000,527,0.322,16766.78,30078.40,30078.40
1,100,10,64,20,1754.00,2000,1280000,1140,0.696,84198.12,130845.29,130845.29
2,1000,10,64,20,14792.63,20000,12800000,1352,0.825,738552.31,782940.05,782940.05
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7815 +/- ##
============================================
- Coverage 91.50% 91.38% -0.13%
+ Complexity 4501 4453 -48
============================================
Files 1177 1171 -6
Lines 47489 47032 -457
Branches 5324 5269 -55
============================================
- Hits 43457 42979 -478
- Misses 2366 2408 +42
+ Partials 1666 1645 -21
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What changes were proposed in this PR?
This PR extends
amber/src/test/python/core/architecture/packaging/test_output_manager.py(10 → 39 tests) to give the Python worker'sOutputManagerdirect semantic assertions. Nearly every line ofoutput_manager.pyalready executes undertest_main_loop.py's end-to-end tests, but the behaviors below had no direct assertion anywhere inamber/src/test/python— the end-to-end suite reachesadd_partitioningonly through a fixture that sendsOneToOnePartitioningand asserts anEmptyReturn,emit_stateappears in the test tree solely as a monkeypatch target, andtest_partitioners.pyconstructs partitioners directly rather than through the dispatch table.save_tuple_to_storage_if_needed: mirrors the five shapes its twinsave_state_to_storage_if_neededalready had — no-writer no-op, unknown-port no-op (asserting the other port's queue stays untouched), fan-out to every port whenport_idis omitted, the single-selected-port path, and that the exact tuple object is enqueued unconverted; plusclose_port_storage_writersstopping the tuple threads.add_output_port: theport_id.idNone→0 andinternalNone→False normalizations, the "each port can only be added once" guard, and that a storage writer is only set up when a storage URI is given — all against a realOutputManagerrather than theMagicMockthe handler tests use.add_partitioning: all fivePartitioning→Partitionerdispatch-table entries driven throughOutputManager(parametrized), registration of only the channels sent from this worker,is_controlNone→False canonicalization, andOneToOnePartitioner's receiver selection by worker id.tuple_to_batchbatching below/at batch size and fan-out to every partitioner (frame contents asserted viato_pydict),tuple_to_frameserialization against the port schema,emit_ecmflushing the pending batch before passing the ECM through by identity, andemit_stateflush ordering,StateFramewrapping and loop-column defaults.is_missing_output_ports,get_port_idsordering, andget_output_channel_idslistingadd_partitioning's registrations.One pre-existing test is strengthened:
test_recreates_result_and_state_tables_and_reopens_writernow asserts the (uri, schema) pairing ofcreate_documentcalls instead of the URI set alone, so swapping the result/state schemas can no longer pass. No production code is changed.Any related issues, documentation, discussions?
Closes #7813
How was this PR tested?
All tests in this PR are new or strengthened unit tests; run them from
amber/src/main/pythonwithpython -m pytest ../../test/python/core/architecture/packaging/ -q— 62 passed (39 in the extended file, including the 10 pre-existing ones unchanged in behavior). The suite is hermetic (no Arrow Flight, no Iceberg; storage writers are stubbed at the writer-triple boundary) and was verified stable across repeated runs. Each key assertion was mutation-checked: thirteen distinct hand-applied production mutations (dispatch-entry swaps, removal of each None normalization, removal of the once-only guard and channel filter, skipping the pending-batch flush, dropping the loop bookkeeping, gutting the fan-out, and swapping the result/state schemas) each turned exactly the intended test red, and every mutation was reverted byte-exact.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Fable 5)