Skip to content

fix(pyamber): keep peek side effect free - #8960

Merged
Xiao-zhen-Liu merged 1 commit into
apache:mainfrom
carloea2:codex/feature-queue-peek
Nov 11, 2026
Merged

Xiao-zhen-Liu merged 1 commit into
apache:mainfrom
carloea2:codex/feature-queue-peek

Conversation

@carloea2

@carloea2 carloea2 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Keep queue peeking from advancing the round-robin cursor. Scan with a local index so observing a queue does not change the next message returned by get().

The regression also starts at a nonzero cursor and calls the public peek() while wrapping past empty and disabled queues in either order. Repeated peeks preserve the next get() result, and an unavailable queue returns None.

Any related issues, documentation, discussions?

Closes #8225. Replaces #8226, which the stale bot closed.

How was this PR tested?

Retested with Python 3.12 on Windows from freshly fetched upstream main 1ec692c5da. Before the implementation, the original regression and both new wraparound cases fail. Afterward, all 56 customized-queue tests pass.

From amber, with PYTHONPATH=src/main/python:

python -m pytest src/test/python/core/util/customized_queue -q --tb=short -p no:cacheprovider
56 passed

python -m pytest src/test/python/core/util src/test/python/core/architecture src/test/python/core/runnables --deselect=src/test/python/core/util/test_expression_evaluator.py::TestExpressionEvaluator::test_evaluate_object_expression --deselect=src/test/python/core/util/test_expression_evaluator.py::TestExpressionEvaluator::test_evaluate_container_expressions -q --tb=short -p no:cacheprovider
716 passed, 2 deselected

ruff check src/main/python src/test/python
ruff format --check src/main/python src/test/python

The two deselected expression-evaluator tests also fail on unmodified main on Windows because object addresses in repr() have leading zeros. No expression-evaluator code changed. Ruff lint and formatting passed for all 218 Python files. git diff --check passed.

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

Generated-by: Codex (GPT-6)

@carloea2

Copy link
Copy Markdown
Contributor Author

This replaces stale-closed #8226. The problem still reproduces on current main. The patch passes its regression, 76 broader tests and Ruff checks.

/request-review @mengw15

@carloea2

Copy link
Copy Markdown
Contributor Author

/request-review @mengw15

@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 Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.92%. Comparing base (1ec692c) to head (75a75cc).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8960      +/-   ##
============================================
+ Coverage     91.81%   91.92%   +0.10%     
  Complexity     5020     5020              
============================================
  Files          1277     1277              
  Lines         56369    57762    +1393     
  Branches       7359     7505     +146     
============================================
+ Hits          51758    53100    +1342     
- Misses         2758     2828      +70     
+ Partials       1853     1834      -19     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from 1ec692c
agent-service 99.53% <ø> (ø) Carriedforward from 1ec692c
amber 85.78% <ø> (ø) Carriedforward from 1ec692c
computing-unit-managing-service 64.05% <ø> (ø) Carriedforward from 1ec692c
config-service 87.73% <ø> (ø) Carriedforward from 1ec692c
file-service 82.31% <ø> (ø) Carriedforward from 1ec692c
frontend 96.54% <ø> (ø) Carriedforward from 1ec692c
notebook-migration-service 83.77% <ø> (ø) Carriedforward from 1ec692c
pyamber 98.01% <100.00%> (-0.49%) ⬇️
workflow-compiling-service 78.30% <ø> (ø) Carriedforward from 1ec692c

*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 Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main 1ec692c 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 563 0.344 16,931/22,185/22,185 us 🔴 +10.2% / 🔴 +56.4%
⚪ bs=100 sw=10 sl=64 1,259 0.768 78,377/103,099/103,099 us ⚪ within ±5% / 🟢 -12.8%
🔴 bs=1000 sw=10 sl=64 1,444 0.881 686,000/817,032/817,032 us 🔴 +9.7% / 🟢 -21.5%
Baseline details

Latest main 1ec692c from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 563 tuples/sec 613 tuples/sec 880.16 tuples/sec -8.2% -36.0%
bs=10 sw=10 sl=64 MB/s 0.344 MB/s 0.374 MB/s 0.537 MB/s -8.0% -36.0%
bs=10 sw=10 sl=64 p50 16,931 us 15,368 us 11,544 us +10.2% +46.7%
bs=10 sw=10 sl=64 p95 22,185 us 23,838 us 14,186 us -6.9% +56.4%
bs=10 sw=10 sl=64 p99 22,185 us 23,838 us 17,122 us -6.9% +29.6%
bs=100 sw=10 sl=64 throughput 1,259 tuples/sec 1,246 tuples/sec 1,151 tuples/sec +1.0% +9.4%
bs=100 sw=10 sl=64 MB/s 0.768 MB/s 0.761 MB/s 0.703 MB/s +0.9% +9.3%
bs=100 sw=10 sl=64 p50 78,377 us 76,971 us 89,900 us +1.8% -12.8%
bs=100 sw=10 sl=64 p95 103,099 us 101,970 us 96,346 us +1.1% +7.0%
bs=100 sw=10 sl=64 p99 103,099 us 101,970 us 110,344 us +1.1% -6.6%
bs=1000 sw=10 sl=64 throughput 1,444 tuples/sec 1,457 tuples/sec 1,189 tuples/sec -0.9% +21.4%
bs=1000 sw=10 sl=64 MB/s 0.881 MB/s 0.889 MB/s 0.726 MB/s -0.9% +21.4%
bs=1000 sw=10 sl=64 p50 686,000 us 683,759 us 873,675 us +0.3% -21.5%
bs=1000 sw=10 sl=64 p95 817,032 us 744,496 us 918,440 us +9.7% -11.0%
bs=1000 sw=10 sl=64 p99 817,032 us 744,496 us 953,075 us +9.7% -14.3%
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,354.93,200,128000,563,0.344,16931.02,22185.38,22185.38
1,100,10,64,20,1588.87,2000,1280000,1259,0.768,78377.02,103099.12,103099.12
2,1000,10,64,20,13854.17,20000,12800000,1444,0.881,685999.83,817031.83,817031.83

@carloea2

Copy link
Copy Markdown
Contributor Author

/request-review @sshiv012 @parshimers

@sshiv012 sshiv012 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 @Xiao-zhen-Liu, this should be a quick review. Please check and merge this when you can

@carloea2
carloea2 force-pushed the codex/feature-queue-peek branch from 8226eb8 to 75a75cc Compare November 10, 2026 20:09
@Xiao-zhen-Liu Xiao-zhen-Liu changed the title feat(pyamber): keep peek side effect free fix(pyamber): keep peek side effect free Nov 11, 2026
@Yicong-Huang Yicong-Huang added release/v1.3 back porting to release/v1.3 release/v1.2 back porting to release/v1.2 labels Nov 11, 2026
@github-actions
github-actions Bot requested a review from xuang7 November 11, 2026 02:01
@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.

@Xiao-zhen-Liu Xiao-zhen-Liu removed release/v1.2 back porting to release/v1.2 release/v1.3 back porting to release/v1.3 labels Nov 11, 2026
@Xiao-zhen-Liu
Xiao-zhen-Liu added this pull request to the merge queue Nov 11, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 11, 2026
@Xiao-zhen-Liu
Xiao-zhen-Liu added this pull request to the merge queue Nov 11, 2026
Merged via the queue into apache:main with commit a0ab2dc Nov 11, 2026
97 of 115 checks passed
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.

Peeking a queue changes its next message

5 participants