-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
When setting a timeout_seconds
greater than 5 minutes, a TimeoutError is raised after 5 minutes.
import asyncio
from kubernetes_asyncio import client, config, watch
async def watch_pods():
async with client.ApiClient() as api:
v1 = client.CoreV1Api(api)
async with watch.Watch().stream(v1.list_pod_for_all_namespaces, timeout_seconds=3600) as stream:
async for event in stream:
evt, obj = event['type'], event['object']
print("{} pod {} in NS {}".format(evt, obj.metadata.name, obj.metadata.namespace))
def main():
loop = asyncio.get_event_loop()
loop.run_until_complete(config.load_kube_config())
tasks = [
asyncio.ensure_future(watch_pods()),
]
loop.run_until_complete(asyncio.wait(tasks))
loop.close()
if __name__ == '__main__':
main()
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-2' coro=<watch_pods() done, defined at <stdin>:1> exception=TimeoutError()>
Traceback (most recent call last):
File "<stdin>", line 5, in watch_pods
File "/home/rcaillon/.local/lib/python3.10/site-packages/kubernetes_asyncio/watch/watch.py", line 131, in __anext__
return await self.next()
File "/home/rcaillon/.local/lib/python3.10/site-packages/kubernetes_asyncio/watch/watch.py", line 152, in next
line = await self.resp.content.readline()
File "/home/rcaillon/.local/lib/python3.10/site-packages/aiohttp/streams.py", line 311, in readline
return await self.readuntil()
File "/home/rcaillon/.local/lib/python3.10/site-packages/aiohttp/streams.py", line 343, in readuntil
await self._wait("readuntil")
File "/home/rcaillon/.local/lib/python3.10/site-packages/aiohttp/streams.py", line 303, in _wait
with self._timer:
File "/home/rcaillon/.local/lib/python3.10/site-packages/aiohttp/helpers.py", line 721, in __exit__
raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
Metadata
Metadata
Assignees
Labels
No labels