-
Notifications
You must be signed in to change notification settings - Fork 327
chore: Migrate gsutil usage to gcloud storage #2533
base: master
Are you sure you want to change the base?
Changes from all commits
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -76,8 +76,8 @@ def convert_backbone_presets(): | |||||||||
| config_filename="config.json", | ||||||||||
| ) | ||||||||||
| # Delete first to clean up any exising version. | ||||||||||
| os.system(f"gsutil rm -rf gs://{BUCKET}/{preset}") | ||||||||||
| os.system(f"gsutil cp -r {preset} gs://{BUCKET}/{preset}") | ||||||||||
| os.system(f"gcloud storage rm --recursive --continue-on-error gs://{BUCKET}/{preset}") | ||||||||||
| os.system(f"gcloud storage cp --recursive {preset} gs://{BUCKET}/{preset}") | ||||||||||
|
Comment on lines
+79
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script uses
Suggested change
|
||||||||||
| for root, _, files in os.walk(preset): | ||||||||||
| for file in files: | ||||||||||
| path = os.path.join(BUCKET, root, file) | ||||||||||
|
|
@@ -121,8 +121,8 @@ def convert_task_presets(): | |||||||||
| config_filename="config.json", | ||||||||||
| ) | ||||||||||
| # Delete first to clean up any exising version. | ||||||||||
| os.system(f"gsutil rm -rf gs://{BUCKET}/{preset}") | ||||||||||
| os.system(f"gsutil cp -r {preset} gs://{BUCKET}/{preset}") | ||||||||||
| os.system(f"gcloud storage rm --recursive --continue-on-error gs://{BUCKET}/{preset}") | ||||||||||
| os.system(f"gcloud storage cp --recursive {preset} gs://{BUCKET}/{preset}") | ||||||||||
| for root, _, files in os.walk(preset): | ||||||||||
| for file in files: | ||||||||||
| path = os.path.join(BUCKET, root, file) | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -73,5 +73,6 @@ | |||||||
| json.dump(preset_updates, f, indent=4) | ||||||||
|
|
||||||||
| print("Please run:") | ||||||||
| print("`gsutil cp -r efficientnet_v2/ gs://keras-cv/models/`") | ||||||||
| print("`gcloud storage cp --recursive efficientnet_v2/ gs://keras-cv/models/`") | ||||||||
| # The gsutil to gcloud migration guide does not provide a mapping for ACL role abbreviations like 'R'. | ||||||||
| print('`gsutil acl ch -u AllUsers:R "gs://keras-cv/models/efficientnet_v2/*"`') | ||||||||
|
Comment on lines
+77
to
78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The migration for
Suggested change
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,8 +15,8 @@ echo With top checksum: $(shasum -a 256 $WEIGHTS) | |||||||||||||||||||||||||
| echo Without top: $GCS_PATH/$OUTPUT_WEIGHTS | ||||||||||||||||||||||||||
| echo Without top checksum: $(shasum -a 256 $OUTPUT_WEIGHTS) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| gsutil cp $WEIGHTS $GCS_PATH/ | ||||||||||||||||||||||||||
| gsutil cp $OUTPUT_WEIGHTS $GCS_PATH/ | ||||||||||||||||||||||||||
| gcloud storage cp $WEIGHTS $GCS_PATH/ | ||||||||||||||||||||||||||
| gcloud storage cp $OUTPUT_WEIGHTS $GCS_PATH/ | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| gsutil acl ch -u AllUsers:R $GCS_PATH/$WEIGHTS | ||||||||||||||||||||||||||
| gsutil acl ch -u AllUsers:R $GCS_PATH/$OUTPUT_WEIGHTS | ||||||||||||||||||||||||||
| gcloud storage objects update $GCS_PATH/$WEIGHTS --add-acl-grant=AllUsers:R | ||||||||||||||||||||||||||
| gcloud storage objects update $GCS_PATH/$OUTPUT_WEIGHTS --add-acl-grant=AllUsers:R | ||||||||||||||||||||||||||
|
Comment on lines
+18
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script uses unquoted variables
Suggested change
|
||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,5 +8,5 @@ GCS_PATH=$2 | |||||||||
|
|
||||||||||
| echo Checksum: $(shasum -a 256 $WEIGHTS) | ||||||||||
|
|
||||||||||
| gsutil cp $WEIGHTS $GCS_PATH/ | ||||||||||
| gsutil acl ch -u AllUsers:R $GCS_PATH/$WEIGHTS | ||||||||||
| gcloud storage cp $WEIGHTS $GCS_PATH/ | ||||||||||
| gcloud storage objects update --add-acl-grant=AllUsers:R $GCS_PATH/$WEIGHTS | ||||||||||
|
Comment on lines
+11
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script uses unquoted variables
Suggested change
|
||||||||||
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.
The notebook uses IPython's shell execution syntax
!with an interpolated variable{path}. Sincepathis derived from an external CSV file (gs://vit_models/augreg/index.csv), an attacker who can modify this CSV could inject malicious shell commands. It is recommended to quote the variable to prevent shell interpolation issues.