Skip to content

Fix missing method delegations in RunInference wrapper ModelHandlers - #40602

Merged
tvalentyn merged 1 commit into
apache:masterfrom
tvalentyn:misc_ri_fixes
Oct 15, 2026
Merged

tvalentyn merged 1 commit into
apache:masterfrom
tvalentyn:misc_ri_fixes

Conversation

@tvalentyn

Copy link
Copy Markdown
Contributor
  • Added some of the newer hooks to all wrapper ModelHandler classes so they forward these hooks to self._base or self._unkeyed.

  • Added a meta-test test_wrapper_model_handlers_override_all_model_handler_methods to verify that wrappers override all methods from the base ModelHandler class to prevent similar omissions.

  • Fix a copypasting error.

@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 properly ensures that wrapper ModelHandler classes (KeyedModelHandler, MaybeKeyedModelHandler, _PrebatchedModelHandler, _PreProcessingModelHandler, and _PostProcessingModelHandler) delegate all relevant hooks (update_model_paths, override_metrics, should_skip_batching, and should_garbage_collect_on_timeout) to their inner model handlers. It also fixes a logging format bug in KeyedModelHandler.__init__ and introduces comprehensive unit tests, including a reflection-based meta-test to prevent future delegation omissions.

🔍 General Feedback

  • The delegation implementations are clean, consistent across all wrapper classes, and properly handle single-model vs. multi-model cases in KeyedModelHandler.
  • Adding test_wrapper_model_handlers_override_all_model_handler_methods is a great safeguard against future drift when new methods are added to the base ModelHandler class.

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

@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.96970% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.92%. Comparing base (76f6e6d) to head (e264527).
⚠️ Report is 178 commits behind head on master.

Files with missing lines Patch % Lines
sdks/python/apache_beam/ml/inference/base.py 96.96% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             master   #40602       +/-   ##
=============================================
+ Coverage     56.16%   79.92%   +23.75%     
=============================================
  Files          1124      488      -636     
  Lines        178336    82416    -95920     
  Branches       1489        0     -1489     
=============================================
- Hits         100170    65874    -34296     
+ Misses        75645    16542    -59103     
+ Partials       2521        0     -2521     
Flag Coverage Δ
go ?
java ?
python 79.92% <96.96%> (+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.

@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @shunping for label python.
Backup reviewer: claudevdm (if the main reviewer is unresponsive, you can escalate to them by tagging their username)

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@shunping shunping left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@tvalentyn
tvalentyn merged commit b764d86 into apache:master Oct 15, 2026
86 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.

2 participants