Skip to content

feat(pyamber): keep peek side effect free - #8226

Open
carloea2 wants to merge 1 commit into
apache:mainfrom
carloea2:fix/peek-round-robin-order
Open

feat(pyamber): keep peek side effect free#8226
carloea2 wants to merge 1 commit into
apache:mainfrom
carloea2:fix/peek-round-robin-order

Conversation

@carloea2

@carloea2 carloea2 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Scan subqueues with a local index when peeking so observation does not advance the round-robin cursor or alter the next message returned by get().

Any related issues, documentation, discussions?

Closes #8225

How was this PR tested?

python -c "import sys,pytest; sys.path[:0]=[worktree amber source, main amber source]; raise SystemExit(pytest.main(['amber/src/test/python/core/util/customized_queue/test_linked_blocking_multi_queue.py','amber/src/test/python/core/models/test_internal_queue.py','-q','-p','no:cacheprovider']))"
76 passed, 1 xfailed

ruff check amber/src/main/python amber/src/test/python
All checks passed

ruff format --check amber/src/main/python amber/src/test/python
213 files already formatted

A direct post-fix probe confirmed that peek does not change the cursor or the next message:

cursor_before_peek=0
peek=second
cursor_after_peek=0
next_after_peek=first

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

Generated-by: Codex

@Yicong-Huang Yicong-Huang added the release/v1.2 back porting to release/v1.2 label Aug 31, 2026
@github-actions
github-actions Bot requested a review from xuang7 August 31, 2026 04:01
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. release/* labels drive the post-merge backport, so add or remove one to change where this fix lands.

Release branch Analysis
⚠️ release/v1.3 Not labeled automatically — none of the files this PR modifies exist on this branch (amber/src/main/python/core/util/customized_queue/linked_blocking_multi_queue.py, amber/src/test/python/core/util/customized_queue/test_linked_blocking_multi_queue.py). The fix may target code that isn't on this release, or the files were moved/renamed after the branch was cut. Please check and add release/v1.3 by hand if this fix should be backported here.
release/v1.2 Already labeled — this fix is queued to backport here.

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: @mengw15
    You can notify them by mentioning @mengw15 in a comment.

@codecov-commenter

codecov-commenter commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.91%. Comparing base (70c2114) to head (e332a14).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8226      +/-   ##
============================================
- Coverage     93.94%   93.91%   -0.04%     
  Complexity     4759     4759              
============================================
  Files          1185     1185              
  Lines         48069    48810     +741     
  Branches       5359     5359              
============================================
+ Hits          45159    45838     +679     
- Misses         1480     1542      +62     
  Partials       1430     1430              
Flag Coverage Δ *Carryforward flag
access-control-service 81.00% <ø> (ø) Carriedforward from 70c2114
agent-service 99.32% <ø> (ø) Carriedforward from 70c2114
amber 89.99% <ø> (ø) Carriedforward from 70c2114
computing-unit-managing-service 73.67% <ø> (ø) Carriedforward from 70c2114
config-service 86.86% <ø> (ø) Carriedforward from 70c2114
file-service 87.91% <ø> (ø) Carriedforward from 70c2114
frontend 96.49% <ø> (ø) Carriedforward from 70c2114
notebook-migration-service 79.31% <ø> (ø) Carriedforward from 70c2114
pyamber 97.87% <100.00%> (-1.01%) ⬇️
workflow-compiling-service 77.19% <ø> (ø) Carriedforward from 70c2114

*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 Aug 31, 2026

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main 70c2114 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 410 0.25 23,742/34,052/34,052 us 🔴 +19.4% / 🔴 +118.6%
🔴 bs=100 sw=10 sl=64 819 0.5 121,492/146,227/146,227 us 🔴 +11.9% / 🔴 +36.3%
🔴 bs=1000 sw=10 sl=64 951 0.581 1,042,603/1,154,459/1,154,459 us 🔴 +7.9% / 🔴 +12.8%
Baseline details

Latest main 70c2114 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 410 tuples/sec 458 tuples/sec 787.98 tuples/sec -10.5% -48.0%
bs=10 sw=10 sl=64 MB/s 0.25 MB/s 0.279 MB/s 0.481 MB/s -10.4% -48.0%
bs=10 sw=10 sl=64 p50 23,742 us 22,520 us 12,593 us +5.4% +88.5%
bs=10 sw=10 sl=64 p95 34,052 us 28,526 us 15,579 us +19.4% +118.6%
bs=10 sw=10 sl=64 p99 34,052 us 28,526 us 18,786 us +19.4% +81.3%
bs=100 sw=10 sl=64 throughput 819 tuples/sec 883 tuples/sec 1,008 tuples/sec -7.2% -18.7%
bs=100 sw=10 sl=64 MB/s 0.5 MB/s 0.539 MB/s 0.615 MB/s -7.2% -18.7%
bs=100 sw=10 sl=64 p50 121,492 us 114,248 us 100,701 us +6.3% +20.6%
bs=100 sw=10 sl=64 p95 146,227 us 130,664 us 107,244 us +11.9% +36.3%
bs=100 sw=10 sl=64 p99 146,227 us 130,664 us 116,122 us +11.9% +25.9%
bs=1000 sw=10 sl=64 throughput 951 tuples/sec 961 tuples/sec 1,042 tuples/sec -1.0% -8.7%
bs=1000 sw=10 sl=64 MB/s 0.581 MB/s 0.587 MB/s 0.636 MB/s -1.0% -8.6%
bs=1000 sw=10 sl=64 p50 1,042,603 us 1,041,532 us 981,959 us +0.1% +6.2%
bs=1000 sw=10 sl=64 p95 1,154,459 us 1,069,559 us 1,023,080 us +7.9% +12.8%
bs=1000 sw=10 sl=64 p99 1,154,459 us 1,069,559 us 1,051,697 us +7.9% +9.8%
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,487.67,200,128000,410,0.250,23741.64,34051.83,34051.83
1,100,10,64,20,2442.53,2000,1280000,819,0.500,121491.99,146226.70,146226.70
2,1000,10,64,20,21023.58,20000,12800000,951,0.581,1042602.53,1154459.33,1154459.33

@Yicong-Huang

Copy link
Copy Markdown
Contributor

I am converting this PR to a draft: please follow our PR template and mark it ready for review.

@Yicong-Huang
Yicong-Huang marked this pull request as draft August 31, 2026 20:10
@carloea2
carloea2 marked this pull request as ready for review August 31, 2026 20:18
@carloea2

Copy link
Copy Markdown
Contributor Author

The description now follows the current template, and this is ready for review.

@carloea2 carloea2 changed the title fix(pyamber): keep peek side effect free feat(pyamber): keep peek side effect free Aug 31, 2026
@mengw15 mengw15 removed the release/v1.2 back porting to release/v1.2 label Aug 31, 2026
@xuang7 xuang7 removed the fix label Sep 1, 2026
@xuang7
xuang7 removed their request for review September 1, 2026 01:44
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.

Peeking a queue changes its next message

5 participants