Skip to content

feature: MLFlow E2E Example Notebook (5513)#5699

Closed
aviruthen wants to merge 2 commits intoaws:masterfrom
aviruthen:feature/mlflow-e2e-example-notebook-5513
Closed

feature: MLFlow E2E Example Notebook (5513)#5699
aviruthen wants to merge 2 commits intoaws:masterfrom
aviruthen:feature/mlflow-e2e-example-notebook-5513

Conversation

@aviruthen
Copy link
Copy Markdown
Collaborator

Description

The notebook file v3-examples/ml-ops-examples/v3-mlflow-train-inference-e2e-example.ipynb already exists in the repository and contains a comprehensive MLflow E2E example. However, there are several issues that need to be fixed:

  1. MLflow 3.x API incompatibility: The notebook uses registered_model.latest_versions which was deprecated/removed in MLflow 3.x. In MLflow 3.x, you should use client.search_model_versions() instead.
  2. Endpoint invocation inconsistency: Step 7 uses raw boto3 sagemaker-runtime client to invoke the endpoint, but the existing e2e example (train-inference-e2e-example.ipynb) uses core_endpoint.invoke() which is the V3 pattern. The notebook should use the V3 pattern consistently.
  3. Missing import json in Step 7: The json module 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.
  4. Session usage inconsistency: Step 1 uses Session.boto_region_name (class-level attribute) but other V3 examples instantiate a session first, then use session.boto_region_name (instance attribute). The existing local-training-example.ipynb instantiates a session first.
  5. Missing sagemaker_session parameter: The ModelTrainer in Step 4 doesn't pass 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.ipynb

AI-Generated PR

This PR was automatically generated by the PySDK Issue Agent.

  • Confidence score: 85%
  • Classification: type: feature request
  • SDK version target: V3

Merge Checklist

  • Changes are backward compatible
  • Commit message follows prefix: description format
  • Unit tests added/updated
  • Integration tests added (if applicable)
  • Documentation updated (if applicable)

Copy link
Copy Markdown
Collaborator

@sagemaker-bot sagemaker-bot left a comment

Choose a reason for hiding this comment

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

🤖 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",
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.

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_name

This 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants