Skip to content

fix(pyamber): resolve OutputManager.get_port by port id, guard empty - #9608

Open
Ma77Ball wants to merge 1 commit into
apache:mainfrom
Ma77Ball:fix/pyamber-output-get-port
Open

Ma77Ball wants to merge 1 commit into
apache:mainfrom
Ma77Ball:fix/pyamber-output-get-port

Conversation

@Ma77Ball

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

  • OutputManager.get_port now returns the port matching a given PortIdentity, normalizing unset id/internal fields and raising a KeyError that names an unknown port.
  • Called with no argument it still returns the first registered port, but raises a KeyError on zero ports instead of an IndexError on an empty list.

Any related issues, documentation, discussions?

Closes: #9605

How was this PR tested?

  • Run: cd amber && pytest src/test/python/core/architecture/packaging/test_output_manager.py (expect all green, 51 tests).
  • New TestGetPort exercises: get_port() with no ports raises KeyError "no output port"; get_port(second_port) returns the second port's schema; an unset-field id resolves to its port; an unknown id raises KeyError "unknown output port".

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

Co-authored with Claude Opus 4.8 in compliance with ASF

OutputManager.get_port takes an optional PortIdentity and returns the matching WorkerPort. When a port id is given it normalizes the unset id/internal defaults (id -> 0, internal -> False) and looks the port up in the _ports map, raising a KeyError that names the port when it is absent. When no port id is given it returns the first registered port, as the single-output callers rely on, but raises a KeyError when no output port has been added instead of indexing an empty list and throwing IndexError.

test_output_manager adds TestGetPort covering the first-port default, the empty-ports guard, lookup of a non-first port by id, normalization of an unset field before lookup, and the unknown-port error.
@Yicong-Huang Yicong-Huang added the release/v1.3 back porting to release/v1.3 label Nov 21, 2026
@github-actions github-actions Bot added fix pyamber and removed release/v1.3 back porting to release/v1.3 labels Nov 21, 2026
@Yicong-Huang Yicong-Huang added the release/v1.2 back porting to release/v1.2 label Nov 21, 2026
@github-actions
github-actions Bot requested review from mengw15 and xuang7 November 21, 2026 11:40
@github-actions

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. A release/* label nominates a backport target; the branch's release manager approving this PR is what sends the fix there. The required Backport Approvals check stays red until every label below is approved, so each manager either approves or removes their own label — which is why the labels left on a merged PR are exactly the branches it reached.

Release branch Analysis
✅ release/v1.3 Change detected on this branch — label added; this fix is queued to backport here. @mengw15 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other. Review requested.
✅ release/v1.2 Change detected on this branch — label added; this fix is queued to backport here. @xuang7 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other. Review requested.

Auto-label run.

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

  • Contributors with relevant context: @carloea2
    You can notify them by mentioning @carloea2 in a comment.

@codecov-commenter

codecov-commenter commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.57%. Comparing base (9647f58) to head (d0268ac).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...thon/core/architecture/packaging/output_manager.py 84.61% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9608      +/-   ##
============================================
- Coverage     91.57%   91.57%   -0.01%     
  Complexity     5182     5182              
============================================
  Files          1300     1300              
  Lines         58133    58144      +11     
  Branches       7615     7619       +4     
============================================
+ Hits          53236    53245       +9     
- Misses         2959     2960       +1     
- Partials       1938     1939       +1     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from 9647f58
agent-service 99.56% <ø> (ø) Carriedforward from 9647f58
amber 85.45% <ø> (ø) Carriedforward from 9647f58
computing-unit-managing-service 63.88% <ø> (ø) Carriedforward from 9647f58
config-service 87.50% <ø> (ø) Carriedforward from 9647f58
file-service 82.16% <ø> (ø) Carriedforward from 9647f58
frontend 96.46% <ø> (ø) Carriedforward from 9647f58
notebook-migration-service 83.77% <ø> (ø) Carriedforward from 9647f58
pyamber 98.34% <84.61%> (-0.04%) ⬇️
result-service 85.71% <ø> (ø) Carriedforward from 9647f58
workflow-compiling-service 78.30% <ø> (ø) Carriedforward from 9647f58

*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

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main f030df1 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 532 0.325 18,062/25,848/25,848 us 🔴 +7.9% / 🔴 +88.8%
🟢 bs=100 sw=10 sl=64 1,248 0.762 79,769/89,161/89,161 us 🟢 -20.1% / 🟢 -9.9%
⚪ bs=1000 sw=10 sl=64 1,448 0.884 681,379/771,941/771,941 us ⚪ within ±5% / 🟢 -12.3%
Baseline details

Latest main f030df1 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 532 tuples/sec 555 tuples/sec 1,018 tuples/sec -4.1% -47.8%
bs=10 sw=10 sl=64 MB/s 0.325 MB/s 0.338 MB/s 0.622 MB/s -3.8% -47.7%
bs=10 sw=10 sl=64 p50 18,062 us 18,108 us 10,127 us -0.3% +78.4%
bs=10 sw=10 sl=64 p95 25,848 us 23,951 us 13,693 us +7.9% +88.8%
bs=10 sw=10 sl=64 p99 25,848 us 23,951 us 16,105 us +7.9% +60.5%
bs=100 sw=10 sl=64 throughput 1,248 tuples/sec 1,197 tuples/sec 1,364 tuples/sec +4.3% -8.5%
bs=100 sw=10 sl=64 MB/s 0.762 MB/s 0.73 MB/s 0.832 MB/s +4.4% -8.5%
bs=100 sw=10 sl=64 p50 79,769 us 78,792 us 79,321 us +1.2% +0.6%
bs=100 sw=10 sl=64 p95 89,161 us 111,637 us 86,661 us -20.1% +2.9%
bs=100 sw=10 sl=64 p99 89,161 us 111,637 us 98,907 us -20.1% -9.9%
bs=1000 sw=10 sl=64 throughput 1,448 tuples/sec 1,458 tuples/sec 1,406 tuples/sec -0.7% +3.0%
bs=1000 sw=10 sl=64 MB/s 0.884 MB/s 0.89 MB/s 0.858 MB/s -0.7% +3.0%
bs=1000 sw=10 sl=64 p50 681,379 us 678,481 us 776,724 us +0.4% -12.3%
bs=1000 sw=10 sl=64 p95 771,941 us 776,814 us 814,345 us -0.6% -5.2%
bs=1000 sw=10 sl=64 p99 771,941 us 776,814 us 862,305 us -0.6% -10.5%
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,375.99,200,128000,532,0.325,18061.90,25847.91,25847.91
1,100,10,64,20,1602.56,2000,1280000,1248,0.762,79769.09,89161.38,89161.38
2,1000,10,64,20,13808.54,20000,12800000,1448,0.884,681378.70,771941.10,771941.10

@xuang7

xuang7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Removing release/v1.2: no user-facing failure on 1.2.

@xuang7 xuang7 removed the release/v1.2 back porting to release/v1.2 label Nov 23, 2026

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OutputManager.get_port ignores port_id and crashes on zero ports

4 participants