feature: MLFlow E2E Example Notebook (5513)#5699
feature: MLFlow E2E Example Notebook (5513)#5699aviruthen wants to merge 2 commits intoaws:masterfrom
Conversation
sagemaker-bot
left a comment
There was a problem hiding this comment.
🤖 AI Code Review
This PR fixes several issues in an MLflow E2E example notebook: updating to MLflow 3.x compatible APIs, using V3 SDK patterns (core_endpoint.invoke instead of raw boto3), adding sagemaker_session parameter, and fixing session instantiation. The changes are well-motivated and align with V3 SDK conventions, with a few minor suggestions.
| "outputs": [], | ||
| "source": [ | ||
| "import uuid\n", | ||
| "import boto3\n", |
There was a problem hiding this comment.
The import boto3 was moved here from Step 7, which is good for consolidation. However, per V3 architecture tenets, subpackages should avoid calling boto3 directly — the preferred pattern is to let Session() handle the boto session internally. Consider simplifying to:
from sagemaker.core.helper.session_helper import Session
sagemaker_session = Session()
AWS_REGION = sagemaker_session.boto_region_nameThis avoids the explicit boto3 import entirely and is more consistent with V3's "Core as the foundation" tenet. The boto3 import was previously used in Step 7 for raw sagemaker-runtime client calls, which this PR correctly removes — so there's no remaining need for it.
Description
The notebook file
v3-examples/ml-ops-examples/v3-mlflow-train-inference-e2e-example.ipynbalready exists in the repository and contains a comprehensive MLflow E2E example. However, there are several issues that need to be fixed:registered_model.latest_versionswhich was deprecated/removed in MLflow 3.x. In MLflow 3.x, you should useclient.search_model_versions()instead.boto3 sagemaker-runtimeclient to invoke the endpoint, but the existing e2e example (train-inference-e2e-example.ipynb) usescore_endpoint.invoke()which is the V3 pattern. The notebook should use the V3 pattern consistently.import jsonin Step 7: Thejsonmodule is used in Step 7 but was only imported in Step 6 cell scope - it should work since cells share namespace, but better to keep consistent.Session.boto_region_name(class-level attribute) but other V3 examples instantiate a session first, then usesession.boto_region_name(instance attribute). The existing local-training-example.ipynb instantiates a session first.sagemaker_session, but the reference e2e notebook (train-inference-e2e-example.ipynb) does pass it.Related Issue
Related issue: 5513
Changes Made
v3-examples/ml-ops-examples/v3-mlflow-train-inference-e2e-example.ipynbAI-Generated PR
This PR was automatically generated by the PySDK Issue Agent.
Merge Checklist
prefix: descriptionformat