in text-semantic-search/index_builder/builder/task.py [0:0]
def _upload_to_gcs(gcs_services, local_file_name, bucket_name, gcs_location):
logging.info('Uploading file {} to {}...'.format(
local_file_name, "gs://{}/{}".format(bucket_name, gcs_location)))
media = MediaFileUpload(local_file_name,
mimetype='application/octet-stream',
chunksize=CHUNKSIZE, resumable=True)
request = gcs_services.objects().insert(
bucket=bucket_name, name=gcs_location, media_body=media)
response = None
while response is None:
progress, response = request.next_chunk()
logging.info('File {} uploaded to {}.'.format(
local_file_name, "gs://{}/{}".format(bucket_name, gcs_location)))