Skip to content

Commit

Permalink
fix: GCS Bucket subdirectory not being creating while using Reasoning…
Browse files Browse the repository at this point in the history
…Engine create method

COPYBARA_INTEGRATE_REVIEW=#3651 from ItsMeAbby:patch-1 dba25ee
PiperOrigin-RevId: 628104988
  • Loading branch information
ItsMeAbby authored and Copybara-Service committed Apr 25, 2024
1 parent 86b6cd3 commit 3d22a18
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vertexai/reasoning_engines/_reasoning_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,13 @@ def _prepare(
gcs_bucket = storage_client.create_bucket(new_bucket, location=location)
_LOGGER.info(f"Creating bucket {staging_bucket} in {location=}")

blob = gcs_bucket.blob(os.path.join(gcs_dir_name, _BLOB_FILENAME))
blob = gcs_bucket.blob(f"{gcs_dir_name}/{_BLOB_FILENAME}")
with blob.open("wb") as f:
cloudpickle.dump(reasoning_engine, f)
dir_name = f"gs://{staging_bucket}/{gcs_dir_name}"
_LOGGER.info(f"Writing to {dir_name}/{_BLOB_FILENAME}")

blob = gcs_bucket.blob(os.path.join(gcs_dir_name, _REQUIREMENTS_FILE))
blob = gcs_bucket.blob(f"{gcs_dir_name}/{_REQUIREMENTS_FILE}")
if requirements:
blob.upload_from_string("\n".join(requirements))
_LOGGER.info(f"Writing to {dir_name}/{_REQUIREMENTS_FILE}")
Expand All @@ -391,6 +391,6 @@ def _prepare(
for file in extra_packages:
tar.add(file)
tar_fileobj.seek(0)
blob = gcs_bucket.blob(os.path.join(gcs_dir_name, _EXTRA_PACKAGES_FILE))
blob = gcs_bucket.blob(f"{gcs_dir_name}/{_EXTRA_PACKAGES_FILE}")
blob.upload_from_string(tar_fileobj.read())
_LOGGER.info(f"Writing to {dir_name}/{_EXTRA_PACKAGES_FILE}")

0 comments on commit 3d22a18

Please sign in to comment.