Skip to content

Check whether GBQ Job is finished #9141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Check whether GBQ Job is finished #9141

wants to merge 2 commits into from

Conversation

cgrin
Copy link
Contributor

@cgrin cgrin commented Dec 23, 2014

xref #8728

jobComplete can be False in query_reply. Simply checking for the existence of the field isn't enough, as a False value will cause a KeyError when checking for query_reply['totalRows']

jobComplete can be False in query_reply. Simply checking for the existence of the field isn't enough, as a False value will cause a KeyError when checking for query_reply['totalRows']
@@ -185,7 +185,7 @@ def run_query(self, query):

job_reference = query_reply['jobReference']

while(not 'jobComplete' in query_reply):
while(not 'jobComplete' in query_reply) or (query_reply['jobComplete'] is False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usually I would prefer not query_reply['jobComplete'] to query_reply['jobComplete'] is False

you could also consolidate these with while(not query_reply.get('jobComplete', False))

@cgrin
Copy link
Contributor Author

cgrin commented Dec 24, 2014

@shoyer I like the get method. Added a comment to make it blatantly obvious why the loop is there.

@jreback jreback added this to the 0.16.0 milestone Dec 24, 2014
@jreback
Copy link
Contributor

jreback commented Dec 24, 2014

@jacobschaer pls have a look

@jacobschaer
Copy link
Contributor

Isn't this similar to #8728 ? We are waiting for Google's response to http://stackoverflow.com/questions/27810116/google-bigquery-request-too-large

@cgrin
Copy link
Contributor Author

cgrin commented Jan 7, 2015

Looks like this is the same issue as #8728. The code is exactly the same. I can see in that issue that the existing code came right from Google's example, however the API reference for getQueryResults regarding the jobComplete key states:

Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available.

So clearly we need to check the value of jobComplete before moving on to grabbing totalRows. The thread you've referenced at SO is regarding an issue with inserts, why is that holding up this unrelated change?

@jacobschaer
Copy link
Contributor

It's being held up because we wanted to get the intergration suite to pass before giving this the go ahead. The other PR I referenced had a couple of changes from @shaun-schaefer that was supposed to go in as well and needed testing. At this point though, I am wondering if we should just proceed with the understanding that the test suite has a known issue.

@cgrin
Copy link
Contributor Author

cgrin commented Jan 7, 2015

Gotcha. I'd argue that having read_gbq() return data reliably is more valuable than passing all integration tests, especially since the BQ API is still evolving.

@jreback
Copy link
Contributor

jreback commented Jan 18, 2015

@jacobschaer how's the testing coming?

@jreback
Copy link
Contributor

jreback commented Jan 18, 2015

closing in favor of #8728 (its the older issue).

@jreback jreback closed this Jan 18, 2015
@jreback jreback added the Duplicate Report Duplicate issue or pull request label Jan 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants