gapic-generator-python icon indicating copy to clipboard operation
gapic-generator-python copied to clipboard

AsyncIO support for google-cloud-compute

Open satels opened this issue 5 years ago • 16 comments

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

satels avatar Jan 11 '20 13:01 satels

I am interested to know this as well.

zbarnett avatar Feb 13 '20 23:02 zbarnett

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

maxpz avatar Mar 21 '20 05:03 maxpz

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.

plamut avatar Mar 24 '20 09:03 plamut

Its April. Where we at with this?

ghost avatar Apr 20 '20 00:04 ghost

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.

ognacy avatar Sep 05 '20 04:09 ognacy

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

(Google are useless at writing APIs)

ghost avatar Sep 06 '20 20:09 ghost

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.

robhaswell avatar Apr 29 '21 15:04 robhaswell

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

zagfai avatar Sep 10 '21 18:09 zagfai

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

lyricnz avatar Jun 04 '22 04:06 lyricnz

@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 avatar Jun 05 '22 17:06 zagfai

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

zagfai avatar Jun 09 '22 17:06 zagfai

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

parthea avatar Oct 21 '23 20:10 parthea

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

irfansharif avatar Nov 15 '23 22:11 irfansharif

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

parthea avatar Nov 16 '23 15:11 parthea

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

l1n avatar Mar 28 '24 17:03 l1n