Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: add default timeout for Client.get_job() #1935
feat: add default timeout for Client.get_job() #1935
Changes from 9 commits
83c63e2
3b0b09b
4231ba1
24baa1c
358b32e
73ad570
66fde13
2a23cda
1f1abc3
5728272
c06ca38
1d58589
9bfe28c
97844d1
0b1220e
1a5fa7c
ed5f6cb
4d77e36
bc398ee
ef7b71e
56893c0
4987ccd
253e274
bd25eea
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add some comments explaining why we need to omit the timeout if we get
_DEFAULT_VALUE
. (Because we want to use the default API-level timeouts but wait indefinitely for the job to finish)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added explanation why
kwargs
is used here, but I feel likeQueryjob.result()
is a better place to explain the default timeout behavior, so I added it in docstring there instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done isn't waiting for the job to complete, so I wonder if we actually need
PollingFuture._DEFAULT_VALUE
here?It seems more analogous to
Client.get_job
so maybe we can use the sameDEFAULT_GET_JOB_TIMEOUT,
here? 🤔 We need to double-check that we aren't calling any other API requests like getQueryResults, if so.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done()
callsreload()
, which in turn callsClient.get_job()
. So I added the sentinel values along the pathresult()
->done()
->reload()
. Indeed I realize we don't have to add sentinel fordone()
orreload()
, because it will be passed fromresult()
anyway. As to getQueryResults, I don't think it's called fromdone()
onward (it's used inresult()
). I think either way (usingPollingFuture._DEFAULT_VALUE
orDEFAULT_GET_JOB_TIMEOUT
) it's effectively the same, so I think either way it's fine. Are there any other factors I'm not aware of?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to keep our type annotations as narrow as we can. My worry with
PollingFuture._DEFAULT_VALUE
is it opens it up toobject
, which technically is anything (string, bytes, anything) in Python.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I ended up only using sentinel for
result()
, and usedDEFAULT_GET_JOB_TIMEOUT
for subsequent calls.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not do the kwargs trick here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's necessary - the purpose here is slightly different from when calling
client.get_job()
. I'm only preserving the sentinel value for thejob.done()
call, and use None as default for any other calls.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, following later comments