mirror of
https://github.com/run-llama/llama_deploy.git
synced 2026-07-25 08:05:25 -04:00
[PR #422] [MERGED] fix: Invoke cleanup() method on the message queue from deploy() before exiting #454
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/run-llama/llama_deploy/pull/422
Author: @masci
Created: 1/7/2025
Status: ✅ Merged
Merged: 1/7/2025
Merged by: @masci
Base:
main← Head:massi/tidy-up-message-queue📝 Commits (4)
efe641cfix: proper shutdown message queues on deploy()c2f5c07removed unused methodse3f3676tidy up deploy() shutdowna425778fix naming📊 Changes
23 files changed (+66 additions, -174 deletions)
View changed files
📝
e2e_tests/message_queues/kafka/__init__.py(+0 -0)📝
e2e_tests/message_queues/kafka/conftest.py(+0 -0)📝
e2e_tests/message_queues/kafka/docker-compose.yml(+0 -0)📝
e2e_tests/message_queues/kafka/test_message_queue.py(+0 -0)📝
e2e_tests/message_queues/kafka/workflow.py(+0 -0)📝
e2e_tests/message_queues/rabbitmq/__init__.py(+0 -0)📝
e2e_tests/message_queues/rabbitmq/conftest.py(+0 -0)📝
e2e_tests/message_queues/rabbitmq/docker-compose.yml(+0 -0)📝
e2e_tests/message_queues/rabbitmq/test_message_queue.py(+0 -0)📝
e2e_tests/message_queues/rabbitmq/workflow.py(+0 -0)📝
e2e_tests/message_queues/simple/__init__.py(+0 -0)📝
e2e_tests/message_queues/simple/test_message_queue.py(+0 -0)📝
llama_deploy/control_plane/server.py(+5 -1)📝
llama_deploy/deploy/deploy.py(+21 -44)📝
llama_deploy/message_queues/apache_kafka.py(+5 -16)📝
llama_deploy/message_queues/aws.py(+5 -25)📝
llama_deploy/message_queues/base.py(+1 -14)📝
llama_deploy/message_queues/rabbitmq.py(+5 -19)📝
llama_deploy/message_queues/redis.py(+2 -17)📝
llama_deploy/message_queues/simple/client.py(+4 -7)...and 3 more files
📄 Description
Message queue clients have a method that's supposed to be invoked on exit to clean up the queue if needed (depending on the queue implementation). The method wasn't called from
deploy()and while this is ok-ish most of the times, while working on the Redis message queue I noted the redis client is not happy without a proper shutdown of its client connections, and my e2e tests were failing.With this PR:
cleanup_localwas renamed tocleanupto avoid confusion (cleanup also happens when server is remote)cleanupis called fromdeploy()on shutdownThis way, all the e2e tests currently relying on
deploy()will implicitly clean up the queue on exit, improving coverage.Also in this PR:
deploy()was refactored to rely onCancelledErrorinstead ofSIGTERMin a more asyncio-friendly fashion🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.