user15317824
user15317824

Reputation: 470

celery receiving tasks but not returning results, just keeps pending

from time import sleep
from celery import Celery

backend = 'db+sqlite:///db.sqlite3'

app = Celery('tasks', broker='amqp********************', backend=backend)


@app.task()
def reverse(text):
    sleep(5)
    return text[::-1]

So i have the above code, when i run the code it does not work celery just received the tasks and does nothing, checking the status of the tasks i get pending i use the below command to run celery, i have tried every other solution here, still the same.

celery -A tasks worker --loglevel=info

Upvotes: 0

Views: 345

Answers (1)

Allaye
Allaye

Reputation: 950

use something like this,

celery -A tasks worker -l info --without-gossip --without-mingle --without-heartbeat -Ofair --pool=solo

i guess Celery will try to fetch tasks in batches from your broker

Upvotes: 3

Related Questions