Skip to content
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

impl: add async InsertJob #24

Merged
merged 4 commits into from
Jan 15, 2025
Merged

Conversation

scotthart
Copy link
Member

Adds the InsertJob overloads that starts the Job and returns a future while polling in the background for completion.

Created issue to add LRO unit tests #23

@scotthart scotthart requested review from dbolduc and cuiy0006 January 15, 2025 18:25
@cuiy0006
Copy link
Contributor

Thanks for the LRO example! I learnt a lot from this.

@scotthart scotthart merged commit edaaca3 into googleapis:main Jan 15, 2025
8 checks passed
Comment on lines +40 to +41
// Once we update the code in google-cloud-cpp to accept a operation_name
// function and default it to OperationType::name, all this code can go away.
Copy link
Member

Choose a reason for hiding this comment

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

Did you do this already? googleapis/google-cloud-cpp#14924

Copy link
Member Author

Choose a reason for hiding this comment

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

It's available at HEAD, but not in a google-cloud-cpp release this repo can depend on. Once google-cloud-cpp v2.34.0 is available, this can be refactored.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha, thanks

Comment on lines +161 to +162
// TODO: JobServiceRestConnectionImpl requires background threads, but does it
// actually use them? Needs further investigation.
Copy link
Member

Choose a reason for hiding this comment

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

*RestConnectionImpl requires background threads, but does it actually use them?

I don't think so.

I thought for REST, our only async APIs are the LROs. We spin off a new thread for each request to handle the polling asynchronously.

And then our long-term goal was to maybe have a background thread pool and do the work on that instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, and I'm pretty sure that none of the services in bigquerycontrol have any LRO rpcs. Other REST services do have LROs, but in bigquerycontrol the background threads go unused.

Copy link
Member

Choose a reason for hiding this comment

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

And then our long-term goal

FTR, it looks like we did implement this.

AsyncRestPollingLoopImpl takes a CompletionQueue which it gets from the background threads.

a lot of compute uses this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants