Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION gs://$BUCKET_NAME"
"! gcloud storage buckets create --location=$REGION gs://$BUCKET_NAME"
]
},
{
Expand All @@ -345,7 +345,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al gs://$BUCKET_NAME"
"! gcloud storage ls --all-versions --long gs://$BUCKET_NAME"
]
},
{
Expand Down Expand Up @@ -383,10 +383,7 @@
"import sys\n",
"import time\n",
"\n",
"from google.cloud.aiplatform import gapic as aip\n",
"from google.protobuf import json_format\n",
"from google.protobuf.json_format import MessageToJson, ParseDict\n",
"from google.protobuf.struct_pb2 import Struct, Value"
"from google.cloud.aiplatform import gapic as aip"
]
},
{
Expand Down Expand Up @@ -671,7 +668,7 @@
"! rm -f custom.tar custom.tar.gz\n",
"! tar cvf custom.tar custom\n",
"! gzip custom.tar\n",
"! gsutil cp custom.tar.gz gs://$BUCKET_NAME/hpt_boston_housing.tar.gz"
"! gcloud storage cp custom.tar.gz gs://$BUCKET_NAME/hpt_boston_housing.tar.gz"
]
},
{
Expand Down Expand Up @@ -1354,13 +1351,13 @@
" print(e)\n",
"\n",
"if delete_bucket and \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r gs://$BUCKET_NAME"
" ! gcloud storage rm --recursive gs://$BUCKET_NAME"
]
}
],
"metadata": {
"colab": {
"name": "UJ11 unified HyperParameter Tuning Training Job with TensorFlow.ipynb",
"name": "UJ11 HyperParameter Tuning Training Job with TensorFlow.ipynb",
"toc_visible": true
},
"kernelspec": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_URI"
"! gcloud storage buckets create --location=$REGION $BUCKET_URI"
]
},
{
Expand All @@ -470,7 +470,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_URI"
"! gcloud storage ls --all-versions --long $BUCKET_URI"
]
},
{
Expand Down Expand Up @@ -699,7 +699,7 @@
"MODEL_DIR = f\"{BUCKET_URI}\"\n",
"tfhub_model.save(\"model\")\n",
"\n",
"! gsutil cp -r model {MODEL_DIR}\n",
"! gcloud storage cp --recursive model {MODEL_DIR}\n",
"! rm -rf model\n",
"\n",
"MODEL_DIR = MODEL_DIR + \"/model\""
Expand Down Expand Up @@ -862,7 +862,7 @@
" data = \"one two\"\n",
" f.write('\"' + data + '\"\\n')\n",
"\n",
"! gsutil cp test.jsonl {gcs_input_uri}"
"! gcloud storage cp test.jsonl {gcs_input_uri}"
]
},
{
Expand Down Expand Up @@ -1032,8 +1032,8 @@
"with open(\"test2.txt\", \"w\") as f:\n",
" f.write('\"search Google or type an Url\"\\n')\n",
"\n",
"! gsutil cp test1.txt {BUCKET_URI}/test1.txt\n",
"! gsutil cp test2.txt {BUCKET_URI}/test2.txt\n",
"! gcloud storage cp test1.txt {BUCKET_URI}/test1.txt\n",
"! gcloud storage cp test2.txt {BUCKET_URI}/test2.txt\n",
"\n",
"! rm test1.txt test2.txt\n",
"\n",
Expand All @@ -1043,7 +1043,7 @@
"\n",
"gcs_input_uri = f\"{BUCKET_URI}/test.txt\"\n",
"\n",
"! gsutil cp test.txt $gcs_input_uri"
"! gcloud storage cp test.txt $gcs_input_uri"
]
},
{
Expand Down Expand Up @@ -1188,7 +1188,7 @@
" batch_prediction_job.delete()\n",
"\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -rf {BUCKET_URI}"
" ! gcloud storage rm --recursive --continue-on-error {BUCKET_URI}"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_URI"
"! gcloud storage buckets create --location=$REGION $BUCKET_URI"
]
},
{
Expand All @@ -478,7 +478,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_URI"
"! gcloud storage ls --all-versions --long $BUCKET_URI"
]
},
{
Expand All @@ -504,7 +504,6 @@
"import google.cloud.aiplatform as aip\n",
"import tensorflow as tf\n",
"import tensorflow_hub as hub\n",
"import tensorflow_text\n",
"from official.nlp import optimization # to create AdamW optimizer"
]
},
Expand Down Expand Up @@ -1220,7 +1219,7 @@
" print(e)\n",
"\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -rf {BUCKET_URI}"
" ! gcloud storage rm --recursive --continue-on-error {BUCKET_URI}"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
"\n",
"# Get your Google Cloud project ID from gcloud\n",
"if not os.getenv(\"IS_TESTING\"):\n",
" shell_output=!gcloud config list --format 'value(core.project)' 2>/dev/null\n",
" shell_output = !gcloud config list --format 'value(core.project)' 2>/dev/null\n",
" PROJECT_ID = shell_output[0]\n",
" print(\"Project ID: \", PROJECT_ID)"
]
Expand Down Expand Up @@ -431,7 +431,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_NAME"
"! gcloud storage buckets create --location $REGION $BUCKET_NAME"
]
},
{
Expand All @@ -451,7 +451,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
"! gcloud storage ls --all-versions --long $BUCKET_NAME"
]
},
{
Expand Down Expand Up @@ -538,7 +538,7 @@
"source": [
"# List the files\n",
"\n",
"! gsutil ls {DATASET_LOCATION}"
"! gcloud storage ls {DATASET_LOCATION}"
]
},
{
Expand All @@ -551,7 +551,7 @@
"source": [
"# Examine dataset metadata\n",
"\n",
"! gsutil cat {METADATA_FILE}"
"! gcloud storage cat {METADATA_FILE}"
]
},
{
Expand Down Expand Up @@ -1130,7 +1130,7 @@
"outputs": [],
"source": [
"# Delete Cloud Storage objects that were created\n",
"! gsutil -m rm -r {BUCKET_NAME}\n",
"! gcloud storage rm --recursive {BUCKET_NAME}\n",
"\n",
"# Delete the training job\n",
"delete_training_job = True\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $LOCATION -p $PROJECT_ID $BUCKET_URI"
"! gcloud storage buckets create --location=$LOCATION --project=$PROJECT_ID $BUCKET_URI"
]
},
{
Expand Down Expand Up @@ -382,9 +382,9 @@
},
"outputs": [],
"source": [
"! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectCreator $BUCKET_URI\n",
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectCreator\n",
"\n",
"! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectViewer $BUCKET_URI"
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectViewer"
]
},
{
Expand Down Expand Up @@ -1164,7 +1164,7 @@
"# Delete Cloud Storage objects that were created\n",
"delete_bucket = True\n",
"if delete_bucket:\n",
" ! gsutil -m rm -r $BUCKET_URI\n",
" ! gcloud storage rm --recursive $BUCKET_URI\n",
"\n",
"# Delete the locally saved pipeline package file\n",
"! rm challenger_vs_blessed.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}"
"! gcloud storage buckets create --location={LOCATION} --project={PROJECT_ID} {BUCKET_URI}"
]
},
{
Expand All @@ -901,7 +901,7 @@
},
"outputs": [],
"source": [
"! curl https://www.datavis.ca/gallery/guerry/guerry.csv | gsutil cp - {BUCKET_URI}/guerry.csv"
"! curl https://www.datavis.ca/gallery/guerry/guerry.csv | gcloud storage cp - {BUCKET_URI}/guerry.csv"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions notebooks/official/tabular_workflows/bqml_arima_plus.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}"
"! gcloud storage buckets create --location {LOCATION} --project {PROJECT_ID} {BUCKET_URI}"
]
},
{
Expand Down Expand Up @@ -361,9 +361,9 @@
},
"outputs": [],
"source": [
"! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectCreator $BUCKET_URI\n",
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=\"serviceAccount:{SERVICE_ACCOUNT}\" --role=\"roles/storage.objectCreator\"\n",
"\n",
"! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectViewer $BUCKET_URI"
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectViewer"
]
},
{
Expand Down Expand Up @@ -1107,7 +1107,7 @@
"\n",
"delete_bucket = True\n",
"if delete_bucket:\n",
" ! gsutil -m rm -r $BUCKET_URI"
" ! gcloud storage rm --recursive $BUCKET_URI"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}"
"! gcloud storage buckets create --location={LOCATION} --project={PROJECT_ID} {BUCKET_URI}"
]
},
{
Expand Down Expand Up @@ -1193,7 +1193,7 @@
},
"outputs": [],
"source": [
"! gsutil ls $GCS_OUTPUT_URI_PREFIX"
"! gcloud storage ls $GCS_OUTPUT_URI_PREFIX"
]
},
{
Expand Down Expand Up @@ -1236,7 +1236,7 @@
"delete_bucket = False # Set True for deletion\n",
"\n",
"if delete_bucket:\n",
" ! gsutil rm -r $BUCKET_URI\n",
" ! gcloud storage rm --recursive $BUCKET_URI\n",
"\n",
"# Delete the repository in Artifact Registry\n",
"! gcloud artifacts repositories delete {PRIVATE_REPO} --location {LOCATION} --quiet\n",
Expand Down