Skip to content

Fix handling of cancelled tickets. - #40588

Merged
tvalentyn merged 1 commit into
apache:masterfrom
tvalentyn:cancelled
Oct 16, 2026
Merged

tvalentyn merged 1 commit into
apache:masterfrom
tvalentyn:cancelled

Conversation

@tvalentyn

Copy link
Copy Markdown
Contributor
  • Fixes an out-of-bounds error when all tickets in the wait queue are cancelled.
  • drive-by: don't count cancelled tickets towards model demand signal.

@tvalentyn

Copy link
Copy Markdown
Contributor Author

R: @AMOOOMA

@github-actions github-actions Bot 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.

📋 Review Summary

This PR fixes an IndexError in ModelManager._wake_next_in_queue when all remaining tickets in _wait_queue have been cancelled, and excludes cancelled tickets from the demand calculation in _evict_to_make_space. The changes are clean, concise, and well-covered by new unit tests.

🔍 General Feedback

  • Moving the if self._wait_queue: check after draining cancelled tickets at the head of the heap properly prevents out-of-bounds access when the queue becomes empty.
  • Filtering out self._cancelled_tickets when computing demand_map ensures timed-out requests do not artificially protect idle models from eviction.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@github-actions

Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.93%. Comparing base (76f6e6d) to head (db70a31).
⚠️ Report is 168 commits behind head on master.

Files with missing lines Patch % Lines
...s/python/apache_beam/ml/inference/model_manager.py 0.00% 5 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             master   #40588       +/-   ##
=============================================
+ Coverage     56.16%   79.93%   +23.76%     
=============================================
  Files          1124      488      -636     
  Lines        178336    82348    -95988     
  Branches       1489        0     -1489     
=============================================
- Hits         100170    65823    -34347     
+ Misses        75645    16525    -59120     
+ Partials       2521        0     -2521     
Flag Coverage Δ
go ?
java ?
python 79.93% <0.00%> (+0.37%) ⬆️

Flags with carried forward coverage won't be shown. 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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Thanks! This looks good to me, good catch on the subtle clean up logic.

@tvalentyn
tvalentyn merged commit a3f3c8e into apache:master Oct 16, 2026
84 of 86 checks passed
@tvalentyn
tvalentyn deleted the cancelled branch October 16, 2026 17:32
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.

2 participants