Search code examples
djangoceleryamazon-ecsamazon-sqskombu

Celery worker keeps creating new SQS queue


I'm using Django with Celery and attempting to deploy Celery using SQS and ECS. These are my celery-related Django settings:

CELERY_BROKER_URL = "sqs://"                                                                                        
CELERY_ACCEPT_CONTENT = ["application/json"]
CELERY_TASK_SERIALIZER = "json"
CELERY_RESULT_SERIALIZER = "json"
CELERY_IMPORTS = "app.tasks"
CELERY_BROKER_TRANSPORT_OPTIONS = {"region": "us-west-2"}
CELERY_TASK_DEFAULT_QUEUE = "staging.fifo"

My celery worker ECS task definition gives it full IAM access to SQS. But every time I start my celery worker ECS container, instead of using my existing SQS queue, "staging.fifo," the worker seems to create a new queue in SQS called "celery." Why is it creating this new queue instead of using the queue that I specified?


Solution

  • I realized in my celery.py file, I had

    app.config_from_object("django.conf:settings")
    

    Since I was not setting the namespace, all my CELERY_ configuration variables were being ignored. I changed this to:

    app.config_from_object("django.conf:settings", namespace="CELERY")
    

    and now it uses my queue! See the Celery with Django docs for more info.