googleapis / gapic-generator-python

Generate Python API client libraries from Protocol Buffers.
Apache License 2.0
117 stars 67 forks source link

AsyncIO support for google-cloud-compute #1864

Open satels opened 4 years ago

satels commented 4 years ago

I repeat old question: When are you start the supporting AsyncIO up?

The previous official request: https://github.com/googleapis/google-cloud-python/issues/3103

zbarnett commented 4 years ago

I am interested to know this as well.

maxpz commented 4 years ago

Really interested in this feature too. Are there some plans on when this is going to be worked on?

plamut commented 4 years ago

Unofficial answer - this will not be added until Python 2.7 support is dropped, which will only start happening in the client libraries after the last official Python 2.7.x release (scheduled for April 2020).

After that, the work on AsyncIO support might start, but not necessarily immediately after dropping Python 2.7. The pace will likely differ across various client libraries.

Side note - this issue is in the old monolithic repository, and progress of each individual client library should be tracked in their respective standalone repositories. The links to the new repositories are in the main README file.

ghost commented 4 years ago

Its April. Where we at with this?

ognacy commented 3 years ago

Any updates on official support for asyncio?

I have ended up re-writing most of my google client code to using REST APIs with aiohttp considering the official client sdk lacks support for it, and some critical components of it lack things like timeout control.

ghost commented 3 years ago

Nice work @ognacy!
Do you have the code somewhere?

(Google are useless at writing APIs)

robhaswell commented 3 years ago

Any updates?

I have to say, the poor progress of Python client libraries is really making me question using Google Cloud for future projects. AWS has had asyncio support for years.

zagfai commented 2 years ago

Waiting for aio support for spanner.. Few months passed.

lyricnz commented 2 years ago

Also waiting for this. Frankly, it's a bit embarrassing not to have it already.

zagfai commented 2 years ago

@lyricnz I noticed that the spanner lib has provided low layer asyncio services client, so I implemented and tested an easy wrapped for asyncio, but it is the code for my company so I could not open source before permission. You could use the low layer services like this to do async rpc request:

from google.cloud import spanner_v1
_client = spanner_v1.services.spanner.SpannerAsyncClient()
name_project = f'projects/{project}'
name_instance = f'{name_project}/instances/{instance}'
name_database = f'{name_instance}/databases/{database}'
session = await _client.create_session(database=name_database)
request = spanner_v1.ReadRequest(
        session=session.name,
        table="tb_test_types",
        columns=['id', 'data_num'],
        key_set=spanner_v1.keyset.KeySet(all_=True)._to_pb()
)
response = await _client.read(request=request)
print(type(response))
print(response)

To wrap the lower layer, you need to implement session pool and management, transaction management, and AsyncStreamedResultSet.

zagfai commented 2 years ago

We make our lib which support asyncio for spanner open source: https://pypi.org/project/aspanner/

parthea commented 10 months ago

Closing as obsolete. The generated clients in this repository have AsyncIO support.

irfansharif commented 9 months ago

@parthea, noob question, is there a generated client with AsyncIO support for https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-compute/google/cloud/compute_v1/services/instances? I was unable to find it.

parthea commented 9 months ago

@irfansharif You're right. There is no AsyncIO support for google-cloud-compute. I'm going to transfer this feature request to the repository for the code generator that we use to generate the google-cloud-compute library as I believe the feature needs to be added there.

l1n commented 5 months ago

@parthea any update on this one? This would significantly speed up parallel use cases in Python.