class_docstr: Make async prediction requests to an Amazon SageMaker endpoint.
class_docstr_tok: ["Make","async","prediction","requests","to","an","Amazon","SageMaker","endpoint","."]
docstr: Upload request data to Amazon S3 for users
docstr_tok: ["Upload","request","data","to","Amazon","S3","for","users"]
code: def _upload_data_to_s3(
      self,
      data,
      input_path=None,
  ):
      """Upload request data to Amazon S3 for users"""
      if input_path:
          bucket, key = parse_s3_url(input_path)
      else:
          my_uuid = str(uuid.uuid4())
          timestamp = sagemaker_timestamp()
          bucket = self.sagemaker_session.default_bucket()
          key = s3.s3_path_join(
              self.sagemaker_session.default_bucket_prefix,
              "async-endpoint-inputs",
              name_from_base(self.name, short=True),
              "{}-{}".format(timestamp, my_uuid),
          )
  
      data = self.serializer.serialize(data)
      self.s3_client.put_object(
          Body=data,
          Bucket=bucket,
          Key=key,
          ContentType=self.serializer.CONTENT_TYPE,
      )
      input_path = input_path or "s3://{}/{}".format(bucket, key)
  
      return input_path
  
imports: from __future__ import absolute_import
  import threading
  import time
  import uuid
  from botocore.exceptions import WaiterError
  from sagemaker import s3
  from sagemaker.exceptions import PollingTimeoutError, AsyncInferenceModelError
  from sagemaker.async_inference import WaiterConfig, AsyncInferenceResponse
  from sagemaker.s3 import parse_s3_url
  from sagemaker.session import Session
  from sagemaker.utils import name_from_base, sagemaker_timestamp, format_tags
label_desc: Use image node_id 4 for calling the AsyncPredictor obj's underlying member method code with example usage: obj._upload_data_to_s3(data, input_path) and returns: input_path