sagemaker.core.lineage.association#

This module contains code to create and manage SageMaker Artifact.

Classes

Association([sagemaker_session])

An Amazon SageMaker artifact, which is part of a SageMaker lineage.

class sagemaker.core.lineage.association.Association(sagemaker_session=None, **kwargs)[source]#

Bases: Record

An Amazon SageMaker artifact, which is part of a SageMaker lineage.

Examples

from sagemaker.lineage import association

my_association = association.Association.create(
    source_arn=artifact_arn,
    destination_arn=trial_component_arn,
    association_type='ContributedTo')

for assoctn in association.Association.list():
    print(assoctn)

my_association.delete()
source_arn#

The ARN of the source entity.

Type:

str

source_type#

The type of the source entity.

Type:

str

destination_arn#

The ARN of the destination entity.

Type:

str

destination_type#

The type of the destination entity.

Type:

str

association_type#

the type of the association.

Type:

str

classmethod create(source_arn: str, destination_arn: str, association_type: str | None = None, sagemaker_session=None) Association[source]#

Add an association and return an Association object representing it.

Parameters:
  • source_arn (str) – The ARN of the source.

  • destination_arn (str) – The ARN of the destination.

  • association_type (str) – The type of the association. ContributedTo, AssociatedWith, DerivedFrom, or Produced.

  • sagemaker_session (sagemaker.session.Session) – Session object which manages interactions with Amazon SageMaker APIs and any other AWS services needed. If not specified, one is created using the default AWS configuration chain.

Returns:

A SageMaker Association object.

Return type:

association

delete()[source]#

Delete this Association from SageMaker.

destination_arn: str = None#
classmethod list(source_arn: str | None = None, destination_arn: str | None = None, source_type: str | None = None, destination_type: str | None = None, association_type: str | None = None, created_after: datetime | None = None, created_before: datetime | None = None, sort_by: str | None = None, sort_order: str | None = None, max_results: int | None = None, next_token: str | None = None, sagemaker_session=None) Iterator[AssociationSummary][source]#

Return a list of context summaries.

Parameters:
  • source_arn (str) – The ARN of the source entity.

  • destination_arn (str) – The ARN of the destination entity.

  • source_type (str) – The type of the source entity.

  • destination_type (str) – The type of the destination entity.

  • association_type (str) – The type of the association.

  • created_after (datetime.datetime, optional) – Return contexts created after this instant.

  • created_before (datetime.datetime, optional) – Return contexts created before this instant.

  • sort_by (str, optional) – Which property to sort results by. One of ‘SourceArn’, ‘CreatedBefore’, ‘CreatedAfter’

  • sort_order (str, optional) – One of ‘Ascending’, or ‘Descending’.

  • max_results (int, optional) – maximum number of contexts to retrieve

  • next_token (str, optional) – token for next page of results

  • sagemaker_session (sagemaker.session.Session) – Session object which manages interactions with Amazon SageMaker APIs and any other AWS services needed. If not specified, one is created using the default AWS configuration chain.

Returns:

An iterator

over AssociationSummary objects.

Return type:

collections.Iterator[AssociationSummary]

set_tag(tag=None)[source]#

Add a tag to the object.

Parameters:

tag (obj) – Key value pair to set tag.

Returns:

str}): a list of key value pairs

Return type:

list({str

set_tags(tags=None)[source]#

Add tags to the object.

Parameters:

([{key (tags) – value}]): list of key value pairs.

Returns:

str}): a list of key value pairs

Return type:

list({str

source_arn: str = None#