-
Notifications
You must be signed in to change notification settings - Fork 228
Migrate gsutil usage to gcloud storage #4308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
2a8dfd2
0fb7624
e2a83ab
3a2c468
eecc519
1d77a0f
3292f95
750f261
656a45e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -473,8 +473,7 @@ | |
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "! gsutil mb -l $REGION $BUCKET_NAME" | ||
| ] | ||
| "! gcloud storage buckets create --location $REGION $BUCKET_NAME" ] | ||
|
||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
|
|
@@ -493,8 +492,7 @@ | |
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "! gsutil ls -al $BUCKET_NAME" | ||
| ] | ||
| "! gcloud storage ls --all-versions --long $BUCKET_NAME" ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
|
|
@@ -597,14 +595,11 @@ | |
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "count = ! gsutil cat $IMPORT_FILE | wc -l\n", | ||
| "print(\"Number of Examples\", int(count[0]))\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", | ||
| "\n", | ||
| "heading = ! gsutil cat $IMPORT_FILE | head -n1\n", | ||
| "label_column = str(heading).split(\",\")[-1].split(\"'\")[0]\n", | ||
| "! gcloud storage cat $IMPORT_FILE | head\n", "\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", | ||
| " raise Exception(\"label column missing\")" | ||
|
|
@@ -996,8 +991,7 @@ | |
| " print(e)\n", | ||
| "\n", | ||
| " if \"BUCKET_NAME\" in globals():\n", | ||
| " ! gsutil rm -r $BUCKET_NAME" | ||
| ] | ||
| " ! gcloud storage rm --recursive $BUCKET_NAME" ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command is inefficient and the use of the pipe
|is likely incorrect. It creates a local fileinstruction.txtand then attempts to upload it, but the pipe|sends the (empty) stdout of theecho >>command togcloud storage cp, which is not the intended behavior. A more idiomatic and efficient approach is to pipe the output ofechodirectly togcloud storage cpusing-for stdin. This avoids creating an unnecessary local file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Resolved] fix not needed