这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,10 @@
"else:\n",
" FILE = IMPORT_FILE\n",
"\n",
"count = ! gsutil cat $FILE | wc -l\n",
"print(\"Number of Examples\", int(count[0]))\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" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1327,7 +1325,7 @@
},
"outputs": [],
"source": [
"test_item = ! gsutil cat $IMPORT_FILE | head -n1\n",
"test_item = ! gcloud storage cat $IMPORT_FILE | head -n1\n",
"if len(test_item[0]) == 3:\n",
" _, test_item, test_label = str(test_item[0]).split(\",\")\n",
"else:\n",
Expand Down Expand Up @@ -1533,8 +1531,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" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The gsutil rm -r gs://<bucket> command deletes the bucket and all objects within it. The gcloud storage rm --recursive gs://<bucket> command only deletes the objects within the bucket, but not the bucket itself. This change leaves the bucket undeleted, which could lead to resource leakage. The correct command to delete a bucket and its contents is gcloud storage buckets delete --recursive.

    ! gcloud storage buckets delete --recursive $BUCKET_NAME

}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,10 @@
"else:\n",
" FILE = IMPORT_FILE\n",
"\n",
"count = ! gsutil cat $FILE | wc -l\n",
"print(\"Number of Examples\", int(count[0]))\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" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1327,8 +1325,7 @@
},
"outputs": [],
"source": [
"test_item = ! gsutil cat $IMPORT_FILE | head -n1\n",
"\n",
"test_item = ! gcloud storage cat $IMPORT_FILE | head -n1\n", "\n",
"cols = str(test_item[0]).split(\",\")\n",
"test_item = cols[0]\n",
"test_label = cols[1:]\n",
Expand Down Expand Up @@ -1533,8 +1530,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" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The gsutil rm -r gs://<bucket> command deletes the bucket and all objects within it. The gcloud storage rm --recursive gs://<bucket> command only deletes the objects within the bucket, but not the bucket itself. This change leaves the bucket undeleted, which could lead to resource leakage. The correct command to delete a bucket and its contents is gcloud storage buckets delete --recursive.

    ! gcloud storage buckets delete --recursive $BUCKET_NAME

}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,12 +718,10 @@
"else:\n",
" FILE = IMPORT_FILE\n",
"\n",
"count = ! gsutil cat $FILE | wc -l\n",
"print(\"Number of Examples\", int(count[0]))\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" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1329,8 +1327,7 @@
},
"outputs": [],
"source": [
"test_item = ! gsutil cat $IMPORT_FILE | head -n1\n",
"if len(test_item[0]) == 3:\n",
"test_item = ! gcloud storage cat $IMPORT_FILE | head -n1\n", "if len(test_item[0]) == 3:\n",
" _, test_item, test_label, max = str(test_item[0]).split(\",\")\n",
"else:\n",
" test_item, test_label, max = str(test_item[0]).split(\",\")\n",
Expand Down Expand Up @@ -1534,8 +1531,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" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The gsutil rm -r gs://<bucket> command deletes the bucket and all objects within it. The gcloud storage rm --recursive gs://<bucket> command only deletes the objects within the bucket, but not the bucket itself. This change leaves the bucket undeleted, which could lead to resource leakage. The correct command to delete a bucket and its contents is gcloud storage buckets delete --recursive.

    ! gcloud storage buckets delete --recursive $BUCKET_NAME

}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_NAME"
]
"! gcloud storage buckets create --location=$REGION $BUCKET_NAME" ]
},
{
"cell_type": "markdown",
Expand All @@ -442,8 +441,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
]
"! gcloud storage ls --all-versions --long $BUCKET_NAME" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1244,8 +1242,7 @@
"source": [
"FLOWERS_CSV = \"gs://cloud-ml-data/img/flower_photos/all_data.csv\"\n",
"\n",
"test_images = ! gsutil cat $FLOWERS_CSV | head -n1\n",
"test_image = test_images[0].split(\",\")[0]\n",
"test_images = ! gcloud storage cat $FLOWERS_CSV | head -n1\n", "test_image = test_images[0].split(\",\")[0]\n",
"print(test_image)"
]
},
Expand Down Expand Up @@ -1471,8 +1468,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" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The gsutil rm -r gs://<bucket> command deletes the bucket and all objects within it. The gcloud storage rm --recursive gs://<bucket> command only deletes the objects within the bucket, but not the bucket itself. This change leaves the bucket undeleted, which could lead to resource leakage. The correct command to delete a bucket and its contents is gcloud storage buckets delete --recursive.

    ! gcloud storage buckets delete --recursive $BUCKET_NAME

}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_URI"
]
"! gcloud storage buckets create --location $REGION $BUCKET_URI" ]
},
{
"cell_type": "markdown",
Expand All @@ -581,8 +580,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_URI"
]
"! gcloud storage ls --all-versions --long $BUCKET_URI" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1145,8 +1143,7 @@
"with open(\"schema.yaml\", \"w\") as f:\n",
" f.write(yaml)\n",
"\n",
"! gsutil cp schema.yaml {BUCKET_URI}/schema.yaml"
]
"! gcloud storage cp schema.yaml {BUCKET_URI}/schema.yaml" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1633,8 +1630,7 @@
"delete_bucket = False\n",
"\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -rf {BUCKET_URI}\n",
"\n",
" ! gcloud storage rm --recursive --continue-on-error {BUCKET_URI}\n", "\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The gsutil rm -rf gs://<bucket> command deletes the bucket and all objects within it, continuing on errors. The gcloud storage rm --recursive --continue-on-error gs://<bucket> command only deletes the objects within the bucket, not the bucket itself. This change leaves the bucket undeleted, which could lead to resource leakage. The correct command to delete a bucket and its contents is gcloud storage buckets delete --recursive. While gcloud storage buckets delete does not have a --continue-on-error flag, it correctly reflects the primary intent of deleting the bucket.

    ! gcloud storage buckets delete --recursive {BUCKET_URI}

"! rm -f schema.yaml\n",
"\n",
"! bq rm -f {PROJECT_ID}.model_deployment_monitoring_{ENDPOINT_ID}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_URI"
]
"! gcloud storage buckets create --location $REGION $BUCKET_URI" ]
},
{
"cell_type": "markdown",
Expand All @@ -581,8 +580,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_URI"
]
"! gcloud storage ls --all-versions --long $BUCKET_URI" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1556,8 +1554,7 @@
"with open(\"schema.yaml\", \"w\") as f:\n",
" f.write(yaml)\n",
"\n",
"! gsutil cp schema.yaml {BUCKET_URI}/schema.yaml"
]
"! gcloud storage cp schema.yaml {BUCKET_URI}/schema.yaml" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1688,8 +1685,7 @@
"delete_bucket = True\n",
"\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -rf {BUCKET_URI}\n",
"\n",
" ! gcloud storage rm --recursive --continue-on-error {BUCKET_URI}\n", "\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The gsutil rm -rf gs://<bucket> command deletes the bucket and all objects within it, continuing on errors. The gcloud storage rm --recursive --continue-on-error gs://<bucket> command only deletes the objects within the bucket, not the bucket itself. This change leaves the bucket undeleted, which could lead to resource leakage. The correct command to delete a bucket and its contents is gcloud storage buckets delete --recursive. While gcloud storage buckets delete does not have a --continue-on-error flag, it correctly reflects the primary intent of deleting the bucket.

    ! gcloud storage buckets delete --recursive {BUCKET_URI}

"! rm -f schema.yaml\n",
"\n",
"! bq rm -r -f {PROJECT_ID}.model_deployment_monitoring_{ENDPOINT_ID}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION -p $PROJECT_ID $BUCKET_URI"
]
"! gcloud storage buckets create --location $REGION --project $PROJECT_ID $BUCKET_URI" ]
},
{
"cell_type": "markdown",
Expand All @@ -525,8 +524,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_URI"
]
"! gcloud storage ls --all-versions --long $BUCKET_URI" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -696,9 +694,7 @@
"outputs": [],
"source": [
"%cd ..\n",
"!gsutil cp {LOCAL_MODEL_ARTIFACTS_DIR}/* {BUCKET_URI}/{MODEL_ARTIFACT_DIR}/\n",
"!gsutil ls {BUCKET_URI}/{MODEL_ARTIFACT_DIR}/"
]
"!gcloud storage cp {LOCAL_MODEL_ARTIFACTS_DIR}/* {BUCKET_URI}/{MODEL_ARTIFACT_DIR}/\n", "!gcloud storage ls {BUCKET_URI}/{MODEL_ARTIFACT_DIR}/" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1899,8 +1895,7 @@
"delete_bucket = False\n",
"\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -r $BUCKET_URI"
]
" ! gcloud storage rm --recursive $BUCKET_URI" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The gsutil rm -r gs://<bucket> command deletes the bucket and all objects within it. The gcloud storage rm --recursive gs://<bucket> command only deletes the objects within the bucket, but not the bucket itself. This change leaves the bucket undeleted, which could lead to resource leakage. The correct command to delete a bucket and its contents is gcloud storage buckets delete --recursive.

    ! gcloud storage buckets delete --recursive $BUCKET_URI

}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION -p $PROJECT_ID $BUCKET_URI"
]
"! gcloud storage buckets create --location=$REGION --project=$PROJECT_ID $BUCKET_URI" ]
},
{
"cell_type": "markdown",
Expand All @@ -523,8 +522,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_URI"
]
"! gcloud storage ls --all-versions --long $BUCKET_URI" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -878,9 +876,7 @@
},
"outputs": [],
"source": [
"!gsutil cp {LOCAL_MODEL_ARTIFACTS_DIR}/* {BUCKET_URI}/{MODEL_ARTIFACT_DIR}/\n",
"!gsutil ls {BUCKET_URI}/{MODEL_ARTIFACT_DIR}/"
]
"!gcloud storage cp {LOCAL_MODEL_ARTIFACTS_DIR}/* {BUCKET_URI}/{MODEL_ARTIFACT_DIR}/\n", "!gcloud storage ls {BUCKET_URI}/{MODEL_ARTIFACT_DIR}/" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1952,8 +1948,7 @@
"delete_bucket = False\n",
"\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -r $BUCKET_URI"
]
" ! gcloud storage rm --recursive $BUCKET_URI" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The gsutil rm -r gs://<bucket> command deletes the bucket and all objects within it. The gcloud storage rm --recursive gs://<bucket> command only deletes the objects within the bucket, but not the bucket itself. This change leaves the bucket undeleted, which could lead to resource leakage. The correct command to delete a bucket and its contents is gcloud storage buckets delete --recursive.

    ! gcloud storage buckets delete --recursive $BUCKET_URI

}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $LOCATION -p $PROJECT_ID $BUCKET_URI"
]
"! gcloud storage buckets create --location=$LOCATION --project=$PROJECT_ID $BUCKET_URI" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -700,8 +699,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_NAME/trainer_cifar10.tar.gz"
]
"! gcloud storage cp custom.tar.gz $BUCKET_NAME/trainer_cifar10.tar.gz" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1326,9 +1324,7 @@
},
"outputs": [],
"source": [
"! gsutil cp tmp1.jpg $BUCKET_URI/tmp1.jpg\n",
"! gsutil cp tmp2.jpg $BUCKET_URI/tmp2.jpg\n",
"\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 @@ -1529,8 +1525,7 @@
" print(e)\n",
"\n",
"if delete_bucket:\n",
" ! gsutil rm -r $BUCKET_URI\n",
"\n",
" ! gcloud storage rm --recursive $BUCKET_URI\n", "\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The gsutil rm -r gs://<bucket> command deletes the bucket and all objects within it. The gcloud storage rm --recursive gs://<bucket> command only deletes the objects within the bucket, but not the bucket itself. This change leaves the bucket undeleted, which could lead to resource leakage. The correct command to delete a bucket and its contents is gcloud storage buckets delete --recursive.

    ! gcloud storage rm --recursive $BUCKET_URI

"if delete_application_directory:\n",
" ! rm -rf custom custom.tar.gz temp1.jpg temp2.jpg"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $LOCATION -p $PROJECT_ID $BUCKET_URI"
]
"! gcloud storage buckets create --location $LOCATION --project $PROJECT_ID $BUCKET_URI" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -747,8 +746,7 @@
"MODEL_ARTIFACT_URI = \"gs://mco-mm/churn\"\n",
"MODEL_DIR = BUCKET_URI + \"/model/1\"\n",
"\n",
"! gsutil cp -r $MODEL_ARTIFACT_URI $MODEL_DIR"
]
"! gcloud storage cp --recursive $MODEL_ARTIFACT_URI $MODEL_DIR" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1132,8 +1130,7 @@
"with open(\"schema.yaml\", \"w\") as f:\n",
" f.write(yaml)\n",
"\n",
"! gsutil cp schema.yaml {BUCKET_URI}/schema.yaml"
]
"! gcloud storage cp schema.yaml {BUCKET_URI}/schema.yaml" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1620,8 +1617,7 @@
"delete_bucket = False\n",
"\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -rf {BUCKET_URI}\n",
"\n",
" ! gcloud storage rm --recursive --continue-on-error {BUCKET_URI}\n", "\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The gsutil rm -rf gs://<bucket> command deletes the bucket and all objects within it, continuing on errors. The gcloud storage rm --recursive --continue-on-error gs://<bucket> command only deletes the objects within the bucket, not the bucket itself. This change leaves the bucket undeleted, which could lead to resource leakage. The correct command to delete a bucket and its contents is gcloud storage buckets delete --recursive. While gcloud storage buckets delete does not have a --continue-on-error flag, it correctly reflects the primary intent of deleting the bucket.

    ! gcloud storage buckets delete --recursive {BUCKET_URI}

"! rm -f schema.yaml\n",
"\n",
"! bq rm -f {PROJECT_ID}.model_deployment_monitoring_{ENDPOINT_ID}\n",
Expand Down
Loading