Migrate gsutil usage to gcloud storage (#4310)

* Migrate gsutil usage to gcloud storage

* changes for 4310

* Apply automated linter fixes

* removed model_garden folder changes

---------

Co-authored-by: gurusai-voleti <gvoleti@google.com>
This commit is contained in:
Margubur Rahman
2025-12-24 09:38:53 -05:00
committed by GitHub
co-authored by gurusai-voleti
parent f4b56e92ae
commit c53f392c5a
7 changed files with 47 additions and 47 deletions
@@ -296,7 +296,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}"
"! gcloud storage buckets create --location={LOCATION} --project={PROJECT_ID} {BUCKET_URI}"
]
},
{
@@ -619,7 +619,7 @@
"outputs": [],
"source": [
"! cd {PYTHON_PACKAGE_APPLICATION_DIR} && python3 setup.py sdist --formats=gztar\n",
"! gsutil cp {source_package_file_name} {python_package_gcs_uri}\n",
"! gcloud storage cp {source_package_file_name} {python_package_gcs_uri}\n",
"\n",
"print(f\"Python source distribution package location: {python_package_gcs_uri}\")"
]
@@ -735,7 +735,7 @@
"outputs": [],
"source": [
"print(f\"Model artifacts are available at {MODEL_DIR}\")\n",
"! gsutil ls -l {MODEL_DIR}"
"! gcloud storage ls --long {MODEL_DIR}"
]
},
{
@@ -776,7 +776,7 @@
"model_name = \"pytorch-mnist.pt\"\n",
"model_file = f\"{model_path}/{model_name}\"\n",
"\n",
"! gsutil cp {MODEL_DIR}/{model_name} {model_file}"
"! gcloud storage cp {MODEL_DIR}/{model_name} {model_file}"
]
},
{
@@ -896,7 +896,7 @@
"source": [
"#### Copy the model artifacts to Cloud Storage\n",
"\n",
"Next, use `gsutil` to copy the model artifacts to your Cloud Storage bucket."
"Next, use `gcloud storage` to copy the model artifacts to your Cloud Storage bucket."
]
},
{
@@ -909,9 +909,9 @@
"source": [
"MODEL_URI = f\"{BUCKET_URI}/model\"\n",
"\n",
"! gsutil -m rm -r -f $MODEL_URI\n",
"! gsutil -m cp -r $model_path $MODEL_URI\n",
"! gsutil ls $MODEL_URI"
"! gcloud storage rm --recursive --continue-on-error $MODEL_URI\n",
"! gcloud storage cp --recursive $model_path $MODEL_URI\n",
"! gcloud storage ls $MODEL_URI"
]
},
{
@@ -1088,7 +1088,7 @@
"# Delete Cloud Storage objects that were created\n",
"delete_bucket = True\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil -m rm -r $BUCKET_URI"
" ! gcloud storage rm --recursive $BUCKET_URI"
]
}
],