Skip to content

Commit f6c8bcf

Browse files
Migrate gsutil usage to gcloud storage (#4301)
* Migrate gsutil usage to gcloud storage * changes for 4301 * linter changes * Revert "linter changes" This reverts commit 6665133. * Apply automated linter fixes * Update training-multi-class-classification-model-for-ads-targeting-usecase.ipynb * Update training-multi-class-classification-model-for-ads-targeting-usecase.ipynb * removed model_garden folder changes * Update model_garden_mediapipe_object_detection.ipynb --------- Co-authored-by: gurusai-voleti <gvoleti@google.com>
1 parent 9e590d5 commit f6c8bcf

7 files changed

+22
-22
lines changed

notebooks/community/generative_ai/bq_dataframes_llm_code_generation.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@
761761
"\n",
762762
"BUCKET_ID = \"code-samples-\" + str(uuid.uuid1())\n",
763763
"\n",
764-
"!gsutil mb gs://{BUCKET_ID}"
764+
"!gcloud storage buckets create gs://{BUCKET_ID}"
765765
]
766766
},
767767
{
@@ -874,7 +874,7 @@
874874
"outputs": [],
875875
"source": [
876876
"# # Delete the Google Cloud Storage bucket and files\n",
877-
"# ! gsutil rm -r gs://{BUCKET_ID}\n",
877+
"# ! gcloud storage rm --recursive gs://{BUCKET_ID}\n",
878878
"# print(f\"Deleted bucket '{BUCKET_ID}'.\")"
879879
]
880880
}

notebooks/official/datasets/get_started_with_data_labeling.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@
381381
},
382382
"outputs": [],
383383
"source": [
384-
"! gsutil mb -l $REGION $BUCKET_URI"
384+
"! gcloud storage buckets create --location=$REGION $BUCKET_URI"
385385
]
386386
},
387387
{
@@ -584,7 +584,7 @@
584584
"print(IMPORT_FILE)\n",
585585
"\n",
586586
"# printing content of uploaded file\n",
587-
"! gsutil cat $IMPORT_FILE"
587+
"! gcloud storage cat $IMPORT_FILE"
588588
]
589589
},
590590
{
@@ -707,7 +707,7 @@
707707
"outputs": [],
708708
"source": [
709709
"# create placeholder file for instructions for data labeling\n",
710-
"! echo \"this is instruction\" >> instruction.txt | gsutil cp instruction.txt $BUCKET_URI"
710+
"! echo \"this is instruction\" >> instruction.txt | gcloud storage cp instruction.txt $BUCKET_URI"
711711
]
712712
},
713713
{
@@ -864,7 +864,7 @@
864864
"\n",
865865
"# Delete the bucket created\n",
866866
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
867-
" ! gsutil rm -r $BUCKET_URI"
867+
" ! gcloud storage rm --recursive $BUCKET_URI"
868868
]
869869
}
870870
],

notebooks/official/explainable_ai/sdk_automl_tabular_classification_online_explain.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291
},
292292
"outputs": [],
293293
"source": [
294-
"! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}"
294+
"! gcloud storage buckets create --location {LOCATION} --project {PROJECT_ID} {BUCKET_URI}"
295295
]
296296
},
297297
{
@@ -372,13 +372,13 @@
372372
},
373373
"outputs": [],
374374
"source": [
375-
"count = ! gsutil cat $IMPORT_FILE | wc -l\n",
375+
"count = ! gcloud storage cat $IMPORT_FILE | wc -l\n",
376376
"print(\"Number of Examples\", int(count[0]))\n",
377377
"\n",
378378
"print(\"First 10 rows\")\n",
379-
"! gsutil cat $IMPORT_FILE | head\n",
379+
"! gcloud storage cat $IMPORT_FILE | head\n",
380380
"\n",
381-
"heading = ! gsutil cat $IMPORT_FILE | head -n1\n",
381+
"heading = ! gcloud storage cat $IMPORT_FILE | head -n1\n",
382382
"label_column = str(heading).split(\",\")[-1].split(\"'\")[0]\n",
383383
"print(\"Label Column Name\", label_column)\n",
384384
"if label_column is None:\n",
@@ -840,7 +840,7 @@
840840
"# Delete the Cloud Storage bucket\n",
841841
"delete_bucket = False # set True for deletion\n",
842842
"if delete_bucket:\n",
843-
" ! gsutil rm -r $BUCKET_URI"
843+
" ! gcloud storage rm --recursive $BUCKET_URI"
844844
]
845845
}
846846
],

notebooks/official/prediction/get_started_with_dedicated_endpoint.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
"source": [
218218
"# Create GCS Bucket\n",
219219
"BUCKET_URI = \"gs://your-bucket-name-unique\" # @param {type:\"string\"}\n",
220-
"! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}"
220+
"! gcloud storage buckets create --location={LOCATION} --project={PROJECT_ID} {BUCKET_URI}"
221221
]
222222
},
223223
{
@@ -309,7 +309,7 @@
309309
"IMAGE_URI = \"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-12:latest\"\n",
310310
"\n",
311311
"# Copy Test Models to the Bucket\n",
312-
"! gsutil -m cp -r \"gs://cloud-samples-data/vertex-ai/prediction/test-models-requests/tensorflow/*\" {ARTIFACT_URI}\n",
312+
"! gcloud storage cp --recursive \"gs://cloud-samples-data/vertex-ai/prediction/test-models-requests/tensorflow/*\" {ARTIFACT_URI}\n",
313313
"\n",
314314
"model = aiplatform.Model.upload(\n",
315315
" display_name=DISPLAY_NAME,\n",
@@ -786,7 +786,7 @@
786786
},
787787
"outputs": [],
788788
"source": [
789-
"! gsutil rm -r {BUCKET_URI}"
789+
"! gcloud storage rm --recursive {BUCKET_URI}"
790790
]
791791
},
792792
{

notebooks/official/tensorboard/tensorboard_custom_training_with_custom_container.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@
347347
},
348348
"outputs": [],
349349
"source": [
350-
"! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}"
350+
"! gcloud storage buckets create --location {LOCATION} --project {PROJECT_ID} {BUCKET_URI}"
351351
]
352352
},
353353
{
@@ -720,9 +720,9 @@
720720
},
721721
"outputs": [],
722722
"source": [
723-
"! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectCreator $BUCKET_URI\n",
723+
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectCreator\n",
724724
"\n",
725-
"! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectViewer $BUCKET_URI"
725+
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectViewer"
726726
]
727727
},
728728
{
@@ -840,7 +840,7 @@
840840
"# Delete GCS bucket.\n",
841841
"delete_bucket = False\n",
842842
"if delete_bucket:\n",
843-
" ! gsutil -m rm -r $BUCKET_URI"
843+
" ! gcloud storage rm --recursive $BUCKET_URI"
844844
]
845845
}
846846
],

notebooks/official/tensorboard/tensorboard_vertex_ai_pipelines_integration.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@
350350
},
351351
"outputs": [],
352352
"source": [
353-
"! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}"
353+
"! gcloud storage buckets create --location={LOCATION} --project={PROJECT_ID} {BUCKET_URI}"
354354
]
355355
},
356356
{
@@ -846,7 +846,7 @@
846846
"# Delete GCS bucket.\n",
847847
"delete_bucket = False # set True for deletion\n",
848848
"if delete_bucket:\n",
849-
" ! gsutil -m rm -r {BUCKET_URI}"
849+
" ! gcloud storage rm --recursive {BUCKET_URI}"
850850
]
851851
}
852852
],

notebooks/official/workbench/ads_targetting/training-multi-class-classification-model-for-ads-targeting-usecase.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282
},
283283
"outputs": [],
284284
"source": [
285-
"! gsutil mb -l $LOCATION -p $PROJECT_ID $BUCKET_URI"
285+
"! gcloud storage buckets create --location=$LOCATION --project=$PROJECT_ID $BUCKET_URI"
286286
]
287287
},
288288
{
@@ -840,7 +840,7 @@
840840
"\n",
841841
"delete_bucket = False\n",
842842
"if delete_bucket:\n",
843-
" ! gsutil -m rm -r $BUCKET_URI"
843+
" ! gcloud storage rm --recursive $BUCKET_URI"
844844
]
845845
}
846846
],

0 commit comments

Comments
 (0)