class_docstr: Container builder that uses Google cloud build.
class_docstr_tok: ["Container","builder","that","uses","Google","cloud","build","."]
docstr: Uploads tarfile to GCS and returns the GCS object name.
docstr_tok: ["Uploads","tarfile","to","GCS","and","returns","the","GCS","object","name","."]
code: def _upload_tar_to_gcs(self):
      """Uploads tarfile to GCS and returns the GCS object name."""
      logger.info("Uploading files to GCS.")
      storage_client = storage.Client()
      try:
          bucket = storage_client.get_bucket(
              self.docker_config.image_build_bucket
          )
      except NotFound:
          bucket = storage_client.create_bucket(
              self.docker_config.image_build_bucket
          )
  
      unique_tag = str(uuid.uuid4()).replace("-", "_")
      storage_object_name = "tf_cloud_train_tar_{}".format(unique_tag)
  
      blob = bucket.blob(storage_object_name)
      blob.upload_from_filename(self.tar_file_path)
      return storage_object_name
  
imports: import logging
  import os
  import sys
  import tarfile
  import tempfile
  import time
  import uuid
  import warnings
  from .None import gcp
  from .None import machine_config
  import docker
  from google.cloud import storage
  from google.cloud.exceptions import NotFound
  from googleapiclient import discovery
  from googleapiclient import errors
  import requests
  from ..utils import google_api_client
  from ..utils import tf_utils
label_desc: Use image node_id 2 for calling the CloudContainerBuilder obj's underlying member method code with example usage: obj._upload_tar_to_gcs() and returns: storage_object_name