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: retry failed query jobs in
result()
#837feat: retry failed query jobs in
result()
#837Changes from 11 commits
cc62448
61e1c38
093f9b4
b2ce74b
d930c83
bf7b4c6
0598197
c9644e9
2d0e067
0dcac01
026edba
0e764d2
c96d8b3
5058cb4
3c53172
eb51432
d6d958f
a05f75f
32e7050
3361a82
4c6ef5b
25b44a0
9ab84e4
d2bf840
4c004a5
be49c4b
9e4a011
204641b
bf051b0
b47244f
2377a1b
6b790e8
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.
license headers :-)
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.
Fixed, here and in unit test. Sorry.
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.
Needs to be the Google header in this repo. https://opensource.google/docs/releasing/preparing/#Apache-header
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.
Ouch. Sorry.
Fixed.
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.
Neat! Maybe add a comment explaining that the sleep is so that the first query fails.
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
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.
Oh, is the
retry
used to determine if we should re-issue a query? I think we should have a separate object for that, since retrying individual API requests can still be useful in cases where we don't want to retry the whole query if its failed.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.
OK, I changed it to use
DEFAULT_RETRY
for the 2 sub-requests, however...There's a problem here. I don't think users understand retry. They expect it to deal with transient semantic errors, like NotFound and rate limiting. They don't get that network errors and application errors are handled separately. They probably aren't aware of what network errors they should worry about. It took me a while to grok the difference between errors raised by
api_request
and other errors that cause a job to be in a failed state. I'm not 100% sure I understand the difference now. 0.5 ;)IMO, it would not help to let them supply two different retries.
Some problems with this PR as it stands ATM:
retry
argument toresult()
depends on whether a job id was supplied toquery
. This is bad. :)query
, not when callingresult
.A fundamental problem, IMO, is that there are two kinds of retry and the distinction between them is subtle.
Maybe, a breaking change we could make, since we're making breaking changes :), would be to:
retry
argument toquery
andresult
to specify how failed jobs should be retried.result
.job id
toquery
, then error if they pass aretry
argument toquery
orresult
, to the effect that their job isn't retryable, because the supplied a custom job id.I suspect we should brainstorm this a bit.
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 hate for us to retry the query if there was just a transient API error, so I do think we need separate logic.
I agree. I'm hoping the with good defaults, most users won't have to worry about it. But I also don't think it's something we should hide from them. It's not intuitive and requires some detailed knowledge about how the API works to get right, but I think that's true for custom retry logic in general.
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.
This could work. Especially if we use the
jobs.query
API. #589 This is all way too complicated. 😭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'm not suggesting we don't retry API/network errors. I was suggesting we don't give users control over them.
However, in the interest of backward compatibility, I propose:
retry
argument as API retry. IN the documentation, I'd say something to the effect of "this isn't the retry you're looking for."job_retry
argument toquery
andresult
to retry failed jobs. (Thejob_retry
passed toquery
is simply the default forresult
.)job_retry
is provided for non-retryable jobs, due to user-suplied job id.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 like this proposal.
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, see 4c6ef5b.