Skip to content

Commit 2d67878

Browse files
committed
Use summary report to get status
1 parent e1a16b6 commit 2d67878

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/vws/vws.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,20 @@ def wait_for_target_processed(self, target_id: str) -> None:
178178
than five minutes.
179179
"""
180180
while True:
181-
target_details = self.get_target(target_id=target_id)
182-
if target_details['status'] != 'processing':
181+
report = self.get_target_summary_report(target_id=target_id)
182+
if report['status'] != 'processing':
183183
return
184184

185185
# We wait 0.2 seconds rather than less than that to decrease the
186186
# number of calls made to the API, to decrease the likelihood of
187187
# hitting the request quota.
188188
sleep(0.2)
189189

190+
# We wait 0.2 seconds rather than less than that to decrease the
191+
# number of calls made to the API, to decrease the likelihood of
192+
# hitting the request quota.
193+
sleep(0.2)
194+
190195
def list_targets(self) -> List[str]:
191196
"""
192197
List target IDs.

tests/test_wait_for_target_processed.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def test_wait_for_target_processed(
2525
width=1,
2626
image=high_quality_image,
2727
)
28-
target_details = client.get_target(target_id=target_id)
29-
assert target_details['status'] == 'processing'
28+
report = client.get_target_summary_report(target_id=target_id)
29+
assert report['status'] == 'processing'
3030
client.wait_for_target_processed(target_id=target_id)
31-
target_details = client.get_target(target_id=target_id)
32-
assert target_details['status'] != 'processing'
31+
report = client.get_target_summary_report(target_id=target_id)
32+
assert report['status'] != 'processing'

0 commit comments

Comments
 (0)