-
Notifications
You must be signed in to change notification settings - Fork 6.5k
[asset] Add sample code for two new RPCs. #4080
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
Conversation
Do you know why the kokoro tests are not running? |
@yuyifan-google They only run automatically for the members of the |
query = "name:{}".format(DATASET) | ||
|
||
@backoff.on_exception( | ||
backoff.expo, (AssertionError, InvalidArgument), max_time=30 |
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 are we added a backoff for this sample? Can we add a comment with context on why this is?
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.
It takes some time for the created dataset to be searchable. I realized sleep() may be more intuitive in this case than using backoff to retry the search.
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.
Sorry, but why? I recommend backoff over sleep.
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'll switch back to backoff. I don't code python a lot so may I ask why backoff is preferred?
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.
Using backoff is tmatsuo's personal preference, and it's not one I agree with here. I believe backoff.on_exception
has max_tries default to None
, which means this will never fail and instead will continue to retry until the whole build fails out.
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 have max_time
set to 30. It take no more than a few seconds to propagate, so maybe reduce it to 10s?
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 fine with 30 - the difference seems negligible.
@backoff.on_exception( | ||
backoff.expo, (AssertionError), max_time=30 | ||
) |
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.
Is there a way to tell if this dataset is searchable as part of the fixture? I would much prefer a check at the fixture level to determine if the resource is searchable before yielding it. If that can only be accomplished by searching it, it's fine to leave this as is (but please make sure to include either max_time
or max_tries
so it doesn't timeout forever).
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 don't think it's possible unless we do sleep() for a few seconds.
No description provided.