AWS sagemaker documentation change
Summary
Added SageMaker Python SDK v3 code examples for lineage tracking operations while maintaining legacy v2 examples
Security assessment
The changes are purely documentation updates showing new SDK syntax for lineage tracking operations. No security vulnerabilities, fixes, or security-specific features are mentioned or addressed in the added code snippets.
Diff
diff --git a/sagemaker/latest/dg/lineage-tracking-manual-creation.md b/sagemaker/latest/dg/lineage-tracking-manual-creation.md index d79f06d09..3e987a6ad 100644 --- a//sagemaker/latest/dg/lineage-tracking-manual-creation.md +++ b//sagemaker/latest/dg/lineage-tracking-manual-creation.md @@ -35,0 +36,17 @@ The following procedure shows you how to create and associate artifacts between +SageMaker Python SDK v3 + + + import sys + !{sys.executable} -m pip install -q sagemaker + + from sagemaker.core.helper.session_helper import get_execution_role + from sagemaker.core.helper.session_helper import Session + **from sagemaker.lineage import context, artifact, association, action** + + import boto3 + boto_session = boto3.Session(region_name=region) + sagemaker_client = boto_session.client("sagemaker") + +SageMaker Python SDK v2 (Legacy) + + @@ -90,0 +108,20 @@ The following procedure shows you how to create and associate artifacts between +SageMaker Python SDK v3 + + + from sagemaker.serve import ModelBuilder + + # model_trainer is the trained model from the training step above + model_builder = ModelBuilder( + model=model_trainer, + role_arn=role, + instance_type='ml.m4.xlarge' + ) + model = model_builder.build() + endpoint = model_builder.deploy( + initial_instance_count=1, + endpoint_name="my-endpoint" + ) + +SageMaker Python SDK v2 (Legacy) + + @@ -95,0 +133,17 @@ The following procedure shows you how to create and associate artifacts between +SageMaker Python SDK v3 + + + from sagemaker.lineage import context + + endpoint_details = sagemaker_client.describe_endpoint(EndpointName=endpoint.endpoint_name) + endpoint_arn = endpoint_details['EndpointArn'] + + endpoint_context_arn = context.Context.create( + context_name=endpoint.endpoint_name, + context_type='Endpoint', + source_uri=endpoint_arn + ).context_arn + +SageMaker Python SDK v2 (Legacy) + + @@ -126,0 +181,17 @@ Given the endpoint Amazon Resource Name (ARN) from the previous example, the fol +SageMaker Python SDK v3 + + + import sys + !{sys.executable} -m pip install -q sagemaker + + from sagemaker.core.helper.session_helper import get_execution_role + from sagemaker.core.helper.session_helper import Session + **from sagemaker.lineage import context, artifact, association, action** + + import boto3 + boto_session = boto3.Session(region_name=region) + sagemaker_client = boto_session.client("sagemaker") + +SageMaker Python SDK v2 (Legacy) + +