Repository navigation
Conversation
…ger metric_tag across model updates
AMOOOMA
force-pushed
the
fix-model-identifier-and-metric-tag
branch
from
October 19, 2026 22:43
8f9def8 to
ab4245c
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40671 +/- ##
=============================================
+ Coverage 56.16% 80.00% +23.83%
=============================================
Files 1124 490 -634
Lines 178336 82827 -95509
Branches 1489 0 -1489
=============================================
- Hits 100170 66268 -33902
+ Misses 75645 16559 -59086
+ Partials 2521 0 -2521
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses two related issues with
model_identifierandModelManagermetrics during runtime side-input model updates inRunInference:Scope
model_identifiertransform annotation strictly toBeamML_RunInference:RunInference.annotations()attachedmodel_identifierto the outerRunInferencecompositePTransform, which caused all nested sub-transforms (such asWatchFilePatternside-input polling transforms,BatchElements, preprocess/postprocess transforms, etc.) to inherit themodel_identifierannotation. Runners that group steps bymodel_identifierto look upnum_loaded_models_<model_identifier>would then fail to resolve the metric on steps that never execute_RunInferenceDoFn.model_identifierfromRunInference.annotations()and instead attachtransform_annotations(model_identifier=self._model_tag)directly aroundBeamML_RunInferenceinRunInference.expand().Stick to reporting the original
model_identifier(metric_tag) inModelManageracross runtime side-input model updates:RunInferenceupdates its model via side input (ModelMetadata),_RunInferenceDoFn._load_modelacquires the new model under the updatedmodel_idtag (self._cur_tag) soModelManagercaches/evicts the new model version separately from the previous version, while theBeamML_RunInferencetransform annotation remains fixed at construction time (self._model_tag/model_identifier).metric_tag=self._model_tagthrough_SharedModelWrappertoModelManager.acquire_model(..., metric_tag=...), and mapmetric_tagto the active version tag inModelManager/ResourceEstimatorsonum_loaded_models_<metric_tag>andmemory_estimate_mb_<metric_tag>strictly reuse and report under the originalmetric_tagrather than the new side-input version tag.Testing
test_run_inference_only_attaches_model_identifier_to_inference_stepinbase_test.py.test_run_inference_dofn_model_update_acquires_and_releases_matching_taginbase_test.pyto verifymetric_tagpreservation across model updates.test_model_manager_metrics_with_metric_taginmodel_manager_test.pyverifying thatnum_loaded_models_<metric_tag>andmemory_estimate_mb_<metric_tag>report exclusively undermetric_tag.test_monitoring_outlet_clears_model_identifier_annotationinvertex_ai_model_monitoring_v2_test.py.