Skip to content

Commit

Permalink
Merge pull request #2251 from tseaver/2119-bigquery-poll-jobs-using-c…
Browse files Browse the repository at this point in the history
…orrect-state

Poll async jobs using correct state logic in BQ usage docs.
  • Loading branch information
tseaver committed Sep 6, 2016
2 parents 7d1c02e + 761055d commit 3f836eb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/bigquery-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,15 @@ Then, begin executing the job on the server:
>>> job.created
datetime.datetime(2015, 7, 23, 9, 30, 20, 268260, tzinfo=<UTC>)
>>> job.state
'running'
'RUNNING'

Poll until the job is complete:

.. doctest::

>>> import time
>>> retry_count = 100
>>> while retry_count > 0 and job.state == 'running':
>>> while retry_count > 0 and job.state != 'DONE':
... retry_count -= 1
... time.sleep(10)
... job.reload() # API call
Expand Down Expand Up @@ -329,15 +329,15 @@ Then, begin executing the job on the server:
>>> job.created
datetime.datetime(2015, 7, 23, 9, 30, 20, 268260, tzinfo=<UTC>)
>>> job.state
'running'
'RUNNING'

Poll until the job is complete:

.. doctest::

>>> import time
>>> retry_count = 100
>>> while retry_count > 0 and job.state == 'running':
>>> while retry_count > 0 and job.state != 'DONE':
... retry_count -= 1
... time.sleep(10)
... job.reload() # API call
Expand Down Expand Up @@ -387,15 +387,15 @@ Then, begin executing the job on the server:
>>> job.created
datetime.datetime(2015, 7, 23, 9, 30, 20, 268260, tzinfo=<UTC>)
>>> job.state
'running'
'RUNNING'

Poll until the job is complete:

.. doctest::

>>> import time
>>> retry_count = 100
>>> while retry_count > 0 and job.state == 'running':
>>> while retry_count > 0 and job.state != 'DONE':
... retry_count -= 1
... time.sleep(10)
... job.reload() # API call
Expand Down Expand Up @@ -441,15 +441,15 @@ Then, begin executing the job on the server:
>>> job.created
datetime.datetime(2015, 7, 23, 9, 30, 20, 268260, tzinfo=<UTC>)
>>> job.state
'running'
'RUNNING'

Poll until the job is complete:

.. doctest::

>>> import time
>>> retry_count = 100
>>> while retry_count > 0 and job.state == 'running':
>>> while retry_count > 0 and job.state != 'DONE':
... retry_count -= 1
... time.sleep(10)
... job.reload() # API call
Expand Down

0 comments on commit 3f836eb

Please sign in to comment.