StudioFragrance / Capstone2-KafkaPipelineForGpt

Kafka를 MessageBroker로 사용하는 JSON RPC의 Python 구현체
GNU Lesser General Public License v2.1
0 stars 1 forks source link

뭔지는 모르겠으나 ValueError: generator already executing 발생 #2

Open tomorrow9913 opened 5 months ago

tomorrow9913 commented 5 months ago

code

https://github.com/MemoriaScent/RIS_capstion_api

재현 방법

아래 api 실행 http://113.198.229.153:201/docs#/tasks/get_gpt_response_api_tasks_gpt_get

신성한 GPT님의 응답

https://chatgpt.com/share/06d4060e-e176-4879-9021-d577558313ca

Traceback

ERROR: Exception in ASGI application Traceback (most recent call last): File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in call await super().call(scope, receive, send) File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call raise exc File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call await self.app(scope, receive, _send) File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 65, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/routing.py", line 756, in call await self.middleware_stack(scope, receive, send) File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/routing.py", line 297, in handle await self.app(scope, receive, send) File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/routing.py", line 72, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/fastapi/routing.py", line 278, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/fastapi/routing.py", line 193, in run_endpoint_function return await run_in_threadpool(dependant.call, *values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool return await anyio.to_thread.run_sync(func, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 859, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/RIS_capstion_api/sender/routes/task_router.py", line 105, in get_gpt_response return broker.rpc(config('TOPIC_NAME'), "get_gpt_response", story, img_caption, img_emotion) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/RIS_capstion_api/sender/core/pipline/rpc/message_broker.py", line 189, in rpc return asyncio.run(future) ^^^^^^^^^^^^^^^^^^^ File "/root/anaconda3/envs/vv/lib/python3.12/asyncio/runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/root/anaconda3/envs/vv/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete File "/root/RIS_capstion_api/sender/core/pipline/rpc/message_broker.py", line 167, in rpc_async return await self.send_method_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/RIS_capstion_api/sender/core/pipline/rpc/message_broker.py", line 60, in send_method_request message = await self.recv_message__( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/RIS_capstion_api/sender/core/pipline/rpc/message_broker.py", line 144, in recv_message for message in self.consumers[name]: File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/kafka/consumer/group.py", line 1203, in next__ return self.next_v2() ^^^^^^^^^^^^^^ File "/root/anaconda3/envs/vv/lib/python3.12/site-packages/kafka/consumer/group.py", line 1211, in next_v2 return next(self._iterator) ^^^^^^^^^^^^^^^^^^^^ ValueError: generator already executing

yejun614 commented 5 months ago

비슷한 이슈를 찾았습니다. https://stackoverflow.com/a/74251352