8000 ppai/timeseries-classification: use check_call instead of run (#7180) · orossini/python-docs-samples@c7b931e · GitHub
[go: up one dir, main page]

Skip to content

Commit c7b931e

Browse files
authored
ppai/timeseries-classification: use check_call instead of run (GoogleCloudPlatform#7180)
1 parent 089ae80 commit c7b931e

File tree

1 file changed

+8
-12
lines changed
  • people-and-planet-ai/timeseries-classification

1 file changed

+8
-12
lines changed

people-and-planet-ai/timeseries-classification/e2e_test.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def raw_labels_dir(bucket_name: str) -> str:
106106
def container_image() -> str:
107107
# https://cloud.google.com/sdk/gcloud/reference/builds/submit
108108
container_image = f"gcr.io/{PROJECT}/{NAME}:{UUID}"
109-
subprocess.run(
109+
subprocess.check_call(
110110
[
111111
"gcloud",
112112
"builds",
@@ -116,15 +116,14 @@ def container_image() -> str:
116116
"--machine-type=e2-highcpu-8",
117117
"--timeout=15m",
118118
"--quiet",
119-
],
120-
check=True,
119+
]
121120
)
122121

123122
logging.info(f"container_image: {container_image}")
124123
yield container_image
125124

126125
# https://cloud.google.com/sdk/gcloud/reference/container/images/delete
127-
subprocess.run(
126+
subprocess.check_call(
128127
[
129128
"gcloud",
130129
"container",
@@ -134,16 +133,15 @@ def container_image() -> str:
134133
f"--project={PROJECT}",
135134
"--force-delete-tags",
136135
"--quiet",
137-
],
138-
check=True,
136+
]
139137
)
140138

141139

142140
@pytest.fixture(scope="session")
143141
def service_url(bucket_name: str, container_image: str) -> str:
144142
# https://cloud.google.com/sdk/gcloud/reference/run/deploy
145143
service_name = f"{NAME.replace('/', '-')}-{UUID}"
146-
subprocess.run(
144+
subprocess.check_call(
147145
[
148146
"gcloud",
149147
"run",
@@ -161,8 +159,7 @@ def service_url(bucket_name: str, container_image: str) -> str:
161159
f"--set-env-vars=REGION={REGION}",
162160
f"--set-env-vars=CONTAINER_IMAGE={container_image}",
163161
"--no-allow-unauthenticated",
164-
],
165-
check=True,
162+
]
166163
)
167164

168165
# https://cloud.google.com/sdk/gcloud/reference/run/services/describe
@@ -189,7 +186,7 @@ def service_url(bucket_name: str, container_image: str) -> str:
189186
yield service_url
190187

191188
# https://cloud.google.com/sdk/gcloud/reference/run/services/delete
192-
subprocess.run(
189+
subprocess.check_call(
193190
[
194191
"gcloud",
195192
"run",
@@ -200,8 +197,7 @@ def service_url(bucket_name: str, container_image: str) -> str:
200197
f"--project={PROJECT}",
201198
f"--region={REGION}",
202199
"--quiet",
203-
],
204-
check=True,
200+
]
205201
)
206202

207203

0 commit comments

Comments
 (0)
0