class_docstr: A helper class to manage Lineage Artifacts
class_docstr_tok: ["A","helper","class","to","manage","Lineage","Artifacts"]
docstr: Associate the artifact with a source/destination ARN (e.g. trial component arn)
  
  Args:
      sagemaker_session (sagemaker.session.Session): Session object which
          manages interactions with Amazon SageMaker APIs and any other
          AWS services needed.
docstr_tok: ["Associate","the","artifact","with","a","source\/destination","ARN","(","e.g",".","trial","component","arn",")","Args",":","sagemaker_session","(","sagemaker.session.Session",")",":","Session","object","which","manages","interactions","with","Amazon","SageMaker","APIs","and","any","other","AWS","services","needed","."]
code: def add_association(self, sagemaker_session):
      """Associate the artifact with a source/destination ARN (e.g. trial component arn)
  
      Args:
          sagemaker_session (sagemaker.session.Session): Session object which
              manages interactions with Amazon SageMaker APIs and any other
              AWS services needed.
      """
      source_arn = (
          self.source_arn if self.source_arn else self.artifact_arn
      )
      dest_arn = self.dest_arn if self.dest_arn else self.artifact_arn
      # if the trial component (job) is the source then it produced the artifact,
      # otherwise the artifact contributed to the trial component (job)
      association_edge_type = (
          "Produced" if self.source_arn else "ContributedTo"
      )
      try:
          sagemaker_session.sagemaker_client.add_association(
              SourceArn=source_arn,
              DestinationArn=dest_arn,
              AssociationType=association_edge_type,
          )
      except botocore.exceptions.ClientError as err:
          err_info = err.response["Error"]
          if not is_already_exist_error(err_info):
              raise
          logger.warning(
              "Skip associating since the association already exists: %s",
              err_info["Message"],
          )
  
imports: from __future__ import absolute_import
  import json
  import logging
  import os
  import botocore
  from sagemaker import s3
  from sagemaker.experiments._utils import is_already_exist_error
label_desc: Use image node_id 3 for calling the _LineageArtifactManager obj's underlying member method code with example usage: obj.add_association(sagemaker_session) without return types