class_docstr: Artifact uploader
class_docstr_tok: ["Artifact","uploader"]
docstr: Upload an artifact object to S3.
  
  Args:
      artifact_name (str): the name of the artifact.
      artifact_object (obj): the object of the artifact
      file_extension (str): Optional file extension.
  
  Returns:
      str: The s3 URI of the uploaded file and the version of the file.
docstr_tok: ["Upload","an","artifact","object","to","S3",".","Args",":","artifact_name","(","str",")",":","the","name","of","the","artifact",".","artifact_object","(","obj",")",":","the","object","of","the","artifact","file_extension","(","str",")",":","Optional","file","extension",".","Returns",":","str",":","The","s3","URI","of","the","uploaded","file","and","the","version","of","the","file","."]
code: def upload_object_artifact(
      self, artifact_name, artifact_object, file_extension=None
  ):
      """Upload an artifact object to S3.
  
      Args:
          artifact_name (str): the name of the artifact.
          artifact_object (obj): the object of the artifact
          file_extension (str): Optional file extension.
  
      Returns:
          str: The s3 URI of the uploaded file and the version of the file.
      """
  
      # If self.artifact_bucket is falsy, it will be set to sagemaker_session.default_bucket.
      # In that case, and if sagemaker_session.default_bucket_prefix exists, self.artifact_prefix
      # needs to be updated too (because not updating self.artifact_prefix would result in
      # different behavior the 1st time this method is called vs the 2nd).
      (
          self.artifact_bucket,
          self.artifact_prefix,
      ) = s3.determine_bucket_and_prefix(
          bucket=self.artifact_bucket,
          key_prefix=self.artifact_prefix,
          sagemaker_session=self.sagemaker_session,
      )
  
      if file_extension:
          artifact_name = (
              artifact_name
              + ("" if file_extension.startswith(".") else ".")
              + file_extension
          )
      artifact_s3_key = "{}/{}/{}".format(
          self.artifact_prefix, self.trial_component_name, artifact_name
      )
      self._s3_client.put_object(
          Body=json.dumps(artifact_object),
          Bucket=self.artifact_bucket,
          Key=artifact_s3_key,
      )
      etag = self._try_get_etag(artifact_s3_key)
      return (
          "s3://{}/{}".format(self.artifact_bucket, artifact_s3_key),
          etag,
      )
  
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 _ArtifactUploader obj's underlying member method code with example usage: obj.upload_object_artifact(artifact_name, artifact_object, file_extension) and returns: str,  etag