0

I am using Celery with Django. My broker is Redis, and the task results are stored in the database.

I run Celery using the following command:

celery -A core worker -Q celery,send_sms --autoscale=10,0 -l INFO  

When I execute a Celery task with :

res = send_sms.apply_async(
                kwargs=dict(mobile=self.mobile, text=self.text, master_id=master_id, send_as_service=send_as_service,
                            high_priority=high_priority))

Flower status's is SUCCESS. However, when I check the task status with:

AsyncResult("395b43ce-ee48-4e6d-937b-922e1bc8d377").state  

the state remains PENDING.

In reality, the task has not been executed yet.

my celery setting:

CELERY_BROKER_URL = redis://redis:6379/0
CELERY_RESULT_BACKEND = django-db

CELERY_RESULT_EXTENDED = True
CELERY_TIMEZONE = 'Asia/Tehran'

CELERY_ROUTES = {
    'sms.tasks.send_sms': {'queue': 'send_sms'},
}

The Celery task is expected to execute immediately. However, the task remains in the PENDING state instead of being executed.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.