Skip to content

Commit 3abba79

Browse files
Migrate gsutil usage to gcloud storage (#13727)
1 parent 64e7af3 commit 3abba79

6 files changed

Lines changed: 7 additions & 9 deletions

File tree

people-and-planet-ai/land-cover-classification/e2e_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def data_path(bucket_name: str) -> str:
5757
def model_path(bucket_name: str) -> str:
5858
# This is a different path than where Vertex AI saves its model.
5959
gcs_path = f"gs://{bucket_name}/pretrained-model"
60-
conftest.run_cmd("gsutil", "-m", "cp", "-r", "./pretrained-model", gcs_path)
60+
conftest.run_cmd("gcloud", "storage", "cp", "--recursive", "./pretrained-model", gcs_path)
6161
return gcs_path
6262

6363

people-and-planet-ai/weather-forecasting/notebooks/2-dataset.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,7 @@
700700
},
701701
"outputs": [],
702702
"source": [
703-
"!gsutil ls -lh gs://{bucket}/weather/data-small"
704-
],
703+
"!gcloud storage ls --long --readable-sizes gs://{bucket}/weather/data-small" ],
705704
"id": "F43OAIlrDosG"
706705
},
707706
{

people-and-planet-ai/weather-forecasting/notebooks/3-training.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@
285285
"data_path_gcs = f\"gs://{bucket}/weather/data\"\n",
286286
"\n",
287287
"!mkdir -p data-training\n",
288-
"!gsutil -m cp {data_path_gcs}/* data-training"
288+
"!gcloud storage cp {data_path_gcs}/* data-training"
289289
],
290290
"metadata": {
291291
"id": "h_IUpnqvO-sa"
@@ -1336,7 +1336,7 @@
13361336
"cell_type": "code",
13371337
"source": [
13381338
"# Stage the `weather-model` package in Cloud Storage.\n",
1339-
"!gsutil cp serving/weather-model/dist/weather-model-1.0.0.tar.gz gs://{bucket}/weather/"
1339+
"!gcloud storage cp serving/weather-model/dist/weather-model-1.0.0.tar.gz gs://{bucket}/weather/"
13401340
],
13411341
"metadata": {
13421342
"id": "JA1k9ky02dsx"

people-and-planet-ai/weather-forecasting/notebooks/4-predictions.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,7 @@
336336
"model_path_gcs = f\"gs://{bucket}/weather/model\"\n",
337337
"\n",
338338
"!mkdir -p model\n",
339-
"!gsutil cp {model_path_gcs}/* model"
340-
],
339+
"!gcloud storage cp {model_path_gcs}/* model" ],
341340
"metadata": {
342341
"id": "5w_uNjluhDMG"
343342
},

people-and-planet-ai/weather-forecasting/tests/predictions_tests/test_predictions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_name() -> str:
3737
@pytest.fixture(scope="session")
3838
def model_path_gcs(bucket_name: str) -> str:
3939
path_gcs = f"gs://{bucket_name}/model"
40-
conftest.run_cmd("gsutil", "cp", "serving/model/*", path_gcs)
40+
conftest.run_cmd("gcloud", "storage", "cp", "serving/model/*", path_gcs)
4141
return path_gcs
4242

4343

people-and-planet-ai/weather-forecasting/tests/training_tests/test_training.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def data_path_gcs(bucket_name: str) -> str:
5151
inputs_batch = [inputs] * batch_size
5252
labels_batch = [labels] * batch_size
5353
np.savez_compressed(f, inputs=inputs_batch, labels=labels_batch)
54-
conftest.run_cmd("gsutil", "cp", f.name, f"{path_gcs}/example.npz")
54+
conftest.run_cmd("gcloud", "storage", "cp", f.name, f"{path_gcs}/example.npz")
5555
return path_gcs
5656

5757

0 commit comments

Comments
 (0)