Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,7 @@
"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.protobuf import json_format"
]
},
{
Expand Down Expand Up @@ -722,11 +720,11 @@
"else:\n",
" FILE = IMPORT_FILE\n",
"\n",
"count = ! gsutil cat $FILE | wc -l\n",
"count = ! gcloud storage cat $FILE | wc -l\n",
"print(\"Number of Examples\", int(count[0]))\n",
"\n",
"print(\"First 10 rows\")\n",
"! gsutil cat $FILE | head"
"! gcloud storage cat $FILE | head"
]
},
{
Expand Down Expand Up @@ -1345,7 +1343,7 @@
},
"outputs": [],
"source": [
"test_items = !gsutil cat $IMPORT_FILE | head -n1\n",
"test_items = !gcloud storage cat $IMPORT_FILE | head -n1\n",
"cols = str(test_items[0]).split(\",\")\n",
"if len(cols) == 11:\n",
" test_item = str(cols[1])\n",
Expand Down Expand Up @@ -1574,7 +1572,7 @@
" print(e)\n",
"\n",
"if delete_bucket and \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
" ! gcloud storage rm --recursive $BUCKET_NAME"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@
"\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"
]
},
Expand Down Expand Up @@ -1614,7 +1613,7 @@
" print(e)\n",
"\n",
"if delete_bucket and \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
" ! gcloud storage rm --recursive $BUCKET_NAME"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_NAME"
"! gcloud storage buckets create --location $REGION $BUCKET_NAME"
]
},
{
Expand All @@ -443,7 +443,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
"! gcloud storage ls --all-versions --long $BUCKET_NAME"
]
},
{
Expand Down Expand Up @@ -477,12 +477,8 @@
},
"outputs": [],
"source": [
"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.protobuf import json_format"
]
},
{
Expand Down Expand Up @@ -1639,7 +1635,7 @@
" print(e)\n",
"\n",
"if delete_bucket and \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
" ! gcloud storage rm --recursive $BUCKET_NAME"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_NAME"
"! gcloud storage buckets create --location=$REGION $BUCKET_NAME"
]
},
{
Expand All @@ -443,7 +443,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
"! gcloud storage ls --all-versions --long $BUCKET_NAME"
]
},
{
Expand Down Expand Up @@ -477,12 +477,8 @@
},
"outputs": [],
"source": [
"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.protobuf import json_format"
]
},
{
Expand Down Expand Up @@ -1616,7 +1612,7 @@
" print(e)\n",
"\n",
"if delete_bucket and \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
" ! gcloud storage rm --recursive $BUCKET_NAME"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_URI"
"! gcloud storage buckets create --location $REGION $BUCKET_URI"
]
},
{
Expand All @@ -507,7 +507,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_URI"
"! gcloud storage ls --all-versions --long $BUCKET_URI"
]
},
{
Expand Down Expand Up @@ -634,13 +634,13 @@
},
"outputs": [],
"source": [
"count = ! gsutil cat $IMPORT_FILE | wc -l\n",
"count = ! gcloud storage cat $IMPORT_FILE | wc -l\n",
"print(\"Number of Examples\", int(count[0]))\n",
"\n",
"print(\"First 10 rows\")\n",
"! gsutil cat $IMPORT_FILE | head\n",
"! gcloud storage cat $IMPORT_FILE | head\n",
"\n",
"heading = ! gsutil cat $IMPORT_FILE | head -n1\n",
"heading = ! gcloud storage cat $IMPORT_FILE | head -n1\n",
"label_column = str(heading).split(\",\")[-1].split(\"'\")[0]\n",
"print(\"Label Column Name\", label_column)\n",
"if label_column is None:\n",
Expand Down Expand Up @@ -913,14 +913,14 @@
},
"outputs": [],
"source": [
"! gsutil cat $IMPORT_FILE | head -n 1 > tmp.csv\n",
"! gsutil cat $IMPORT_FILE | tail -n 10 >> tmp.csv\n",
"! gcloud storage cat $IMPORT_FILE | head -n 1 > tmp.csv\n",
"! gcloud storage cat $IMPORT_FILE | tail -n 10 >> tmp.csv\n",
"\n",
"! cut -d, -f1-16 tmp.csv > batch.csv\n",
"\n",
"gcs_input_uri = BUCKET_URI + \"/test.csv\"\n",
"\n",
"! gsutil cp batch.csv $gcs_input_uri"
"! gcloud storage cp batch.csv $gcs_input_uri"
]
},
{
Expand Down Expand Up @@ -1552,7 +1552,7 @@
"outputs": [],
"source": [
"# Create test data w/o the label\n",
"output = ! gsutil cat $IMPORT_FILE | head -n 10\n",
"output = ! gcloud storage cat $IMPORT_FILE | head -n 10\n",
"rows = []\n",
"for i in range(0, 10):\n",
" rows.append(output[i][:-2])\n",
Expand Down Expand Up @@ -1831,7 +1831,7 @@
"delete_bucket = False\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 @@ -331,7 +331,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 @@ -892,7 +892,7 @@
"! rm -f custom.tar custom.tar.gz\n",
"! tar cvf custom.tar custom\n",
"! gzip custom.tar\n",
"! gsutil cp custom.tar.gz $BUCKET_URI/trainer_cifar10.tar.gz"
"! gcloud storage cp custom.tar.gz $BUCKET_URI/trainer_cifar10.tar.gz"
]
},
{
Expand Down Expand Up @@ -1300,8 +1300,8 @@
},
"outputs": [],
"source": [
"! gsutil cp tmp1.jpg $BUCKET_URI/tmp1.jpg\n",
"! gsutil cp tmp2.jpg $BUCKET_URI/tmp2.jpg\n",
"! gcloud storage cp tmp1.jpg $BUCKET_URI/tmp1.jpg\n",
"! gcloud storage cp tmp2.jpg $BUCKET_URI/tmp2.jpg\n",
"\n",
"test_item_1 = BUCKET_URI + \"/tmp1.jpg\"\n",
"test_item_2 = BUCKET_URI + \"/tmp2.jpg\""
Expand Down Expand Up @@ -1695,7 +1695,7 @@
"# Delete Cloud Storage objects that were created\n",
"delete_bucket = False # Set True for deletion\n",
"if delete_bucket:\n",
" ! gsutil -m rm -r $BUCKET_URI\n",
" ! gcloud storage rm --recursive $BUCKET_URI\n",
"\n",
"# remove the local users and movies avro files\n",
"! rm -rf custom\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,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 @@ -678,7 +678,7 @@
"! rm -f custom.tar custom.tar.gz\n",
"! tar cvf custom.tar custom\n",
"! gzip custom.tar\n",
"! gsutil cp custom.tar.gz $BUCKET_URI/trainer_cifar10.tar.gz"
"! gcloud storage cp custom.tar.gz $BUCKET_URI/trainer_cifar10.tar.gz"
]
},
{
Expand Down Expand Up @@ -1145,8 +1145,8 @@
},
"outputs": [],
"source": [
"! gsutil cp tmp1.jpg $BUCKET_URI/tmp1.jpg\n",
"! gsutil cp tmp2.jpg $BUCKET_URI/tmp2.jpg\n",
"! gcloud storage cp tmp1.jpg $BUCKET_URI/tmp1.jpg\n",
"! gcloud storage cp tmp2.jpg $BUCKET_URI/tmp2.jpg\n",
"\n",
"test_item_1 = BUCKET_URI + \"/tmp1.jpg\"\n",
"test_item_2 = BUCKET_URI + \"/tmp2.jpg\""
Expand Down Expand Up @@ -1637,7 +1637,7 @@
"# delete cloud storage bucket\n",
"delete_bucket = False # set True for deletion\n",
"if delete_bucket:\n",
" ! gsutil rm -r $BUCKET_URI"
" ! gcloud storage rm --recursive $BUCKET_URI"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,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 @@ -467,9 +467,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 @@ -602,7 +602,7 @@
},
"outputs": [],
"source": [
"! gsutil cp gs://cloud-samples-data/vertex-ai/community-content/datasets/abalone/abalone.data {RAW_INPUT_DATA}"
"! gcloud storage cp gs://cloud-samples-data/vertex-ai/community-content/datasets/abalone/abalone.data {RAW_INPUT_DATA}"
]
},
{
Expand Down Expand Up @@ -1611,7 +1611,7 @@
"# Delete Cloud Storage bucket\n",
"delete_bucket = True\n",
"if delete_bucket:\n",
" ! gsutil rm -r $BUCKET_URI\n",
" ! gcloud storage rm --recursive $BUCKET_URI\\\n",
"\n",
"# Delete the pipeline package file\n",
"! rm PIPELINE_YAML_PKG_PATH"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $LOCATION $BUCKET_URI"
"! gcloud storage buckets create --location=$LOCATION $BUCKET_URI"
]
},
{
Expand Down Expand Up @@ -2237,7 +2237,7 @@
"# Delete Cloud Storage objects that were created\n",
"delete_bucket = True # Set True for deletion\n",
"if delete_bucket:\n",
" ! gsutil -m rm -r $BUCKET_URI"
" ! gcloud storage rm --recursive $BUCKET_URI"
]
}
],
Expand Down