You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am able to retrieve data correctly, however I get alarming warning-like messages:
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x732ff0fdede0>
Unclosed connector
connections: ['deque([(<aiohttp.client_proto.ResponseHandler object at 0x732ff0fe5910>, 12327.646955165)])']
connector: <aiohttp.connector.TCPConnector object at 0x732ff0fded20>
This should be a complete, reproducible example.
importioimportaiohttpfromgcloud.aio.authimportTokenfromgcloud.aio.storageimportStorageasyncdefretrive_data_gcs(bucket_object_map: dict[str, str], service_file_path: str) ->dict[str, io.BytesIO]:
"""Retrives multiple objects (files) from Google Cloud Storage asynchronously."""token=Token(service_file_path, scopes=["https://www.googleapis.com/auth/devstorage.read_only"])
retrived_objects= {} # not creating aiohttp.ClientSession leads to exactly same resultasyncwithaiohttp.ClientSession() assession, Storage(token=token, session=session) asclient:
forbucket_name, file_nameinbucket_object_map.items():
byte_data=awaitclient.download(bucket_name, file_name, session=session)
retrived_objects[file_name] =io.BytesIO(byte_data)
returnretrived_objectsif__name__=="__main__":
importasynciofromuvloopimportEventLoopPolicyasyncio.set_event_loop_policy(EventLoopPolicy())
loop=asyncio.new_event_loop()
bytes_data=loop.run_until_complete(
retrive_data_gcs(
{"some_bucket_name": "some_file_name"}, # replace with actual values"some_service_account_key.json", # replace with actual values
)
)
loop.close()
I tried rewriting the code multiple times, manually calling close etc.. Nothing helps. If I do not create session manually, I get exactly the same effect as well...
Could you recommend how to fix it?
The text was updated successfully, but these errors were encountered:
I am able to retrieve data correctly, however I get alarming warning-like messages:
This should be a complete, reproducible example.
I tried rewriting the code multiple times, manually calling close etc.. Nothing helps. If I do not create session manually, I get exactly the same effect as well...
Could you recommend how to fix it?
The text was updated successfully, but these errors were encountered: