Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a1461a

Browse files
authored
BigQuery: Limit number of jobs looped through. (googleapis#5104)
The `list_jobs` snippet was taking a very long time in the CI tests. This should keep it from timing out.
1 parent 9e7b62b commit 8a1461a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/bigquery/snippets.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,8 +1767,9 @@ def do_something_with(_):
17671767
pass
17681768

17691769
# [START client_list_jobs]
1770-
job_iterator = client.list_jobs() # API request(s)
1771-
for job in job_iterator:
1770+
job_iterator = client.list_jobs(
1771+
max_results=10) # Optionally, limit the results to 10 jobs.
1772+
for job in job_iterator: # API request(s) happen when iterating
17721773
do_something_with(job)
17731774
# [END client_list_jobs]
17741775

0 commit comments

Comments
 (0)