Repository navigation
Resolve staged sklearn model path on the worker in RunInference xlang tests - #40795
Open
tarun-google wants to merge 5 commits into
Open
tarun-google wants to merge 5 commits into
tarun-google wants to merge 5 commits into
Conversation
tarun-google
marked this pull request as ready for review
October 26, 2026 02:06
Contributor
There was a problem hiding this comment.
📋 Review Summary
This PR updates the Java and Go cross-language RunInference tests to resolve the staged sklearn_model path at worker runtime via SEMI_PERSISTENT_DIRECTORY in load_model(), rather than hardcoding the staging directory at pipeline construction time. The implementation is clean, idempotent across multiple load_model() calls, and ensures compatibility with per-worker staging directory layouts (#40699).
🔍 General Feedback
- Using
os.path.basename(self._model_uri)combined withself.update_model_path(...)cleanly keepsload_model()idempotent if called multiple times. - Both the unkeyed and keyed (
KeyedModelHandler) test paths in Java as well as the Go xlang integration test are properly covered.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
Contributor
|
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
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.
The Java and Go RunInference cross-language tests hardcode where the Python SDK
harness puts staged files (
<semiPersistDir>/staged/sklearn_model, or/tmp/staged/sklearn_modelin Go). That location belongs to the container'sboot program and is only known on the worker, so the tests break when it
changes (see #40699, which moves Python staging to
<semi_persist_dir>/<worker id>/staged).The test expansion service (
expansion_service_test.py) attaches the model tothe Python environment as a staged file named
sklearn_model. The tests nowpass that name and use a small
SklearnModelHandlerNumpysubclass that buildsthe full path from
SEMI_PERSISTENT_DIRECTORYinload_model().load_model()runs on the worker after boot has set that variable. The subclass uses the
public
update_model_path(), can be called repeatedly, and raises aKeyErrornaming the variable if it is missing.
Test-only change. It works with both the current and the per-worker staging
layout, so it can merge ahead of #40699.
Testing (DirectRunner + Python expansion service, Python 3.11):
./gradlew :sdks:python:test-suites:direct:xlang:validatesCrossLanguageRunnerJavaUsingPython --tests '*RunInferenceTransformTest*' -PpythonVersion=3.11