Skip to content

[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

Merged
merged 14 commits into from
Jun 18, 2020
Merged

[asset] Add sample code for two new RPCs. #4080

merged 14 commits into from
Jun 18, 2020

Conversation

yuyifan-google
Copy link
Contributor

No description provided.

@yuyifan-google yuyifan-google requested a review from a team as a code owner June 12, 2020 18:43
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 12, 2020
@yuyifan-google yuyifan-google changed the title Add sample code for two new RPCs. [asset] Add sample code for two new RPCs. Jun 12, 2020
@yuyifan-google
Copy link
Contributor Author

Do you know why the kokoro tests are not running?

@busunkim96 busunkim96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 12, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 12, 2020
@busunkim96
Copy link
Contributor

@yuyifan-google They only run automatically for the members of the GoogleCloudPlatform org. I just kicked off the tests, sorry to keep you waiting.

@busunkim96 busunkim96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 12, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 12, 2020
query = "name:{}".format(DATASET)

@backoff.on_exception(
backoff.expo, (AssertionError, InvalidArgument), max_time=30
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

@kurtisvg kurtisvg self-requested a review June 18, 2020 18:13
Comment on lines +54 to +56
@backoff.on_exception(
backoff.expo, (AssertionError), max_time=30
)
Copy link
Contributor

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).

Copy link
Contributor Author

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.

@kurtisvg kurtisvg added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 18, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants