Celery task status is only 'PENDING' and 'SUCCESS'.Why is there no "STARTED" in the task status?

Viewed 2362

I'm working on a demo and the code is simple:

# tasks.py
import time

from celery import Celery

app = Celery('tasks',
             broker='redis://:5tgb^YHN7ujm*IK<@localhost:6379/0',
             backend='redis://:5tgb^YHN7ujm*IK<@localhost:6379/0'
             )


@app.task
def test_task(s):
    time.sleep(300)
    return s

Then start the worker

 celery -A celery_test.app  worker -n kalidog -c 2 -l debug -E

 -------------- celery@kalidog v4.3.0 (rhubarb)
---- **** ----- 
--- * ***  * -- Linux-4.9.0-8-amd64-x86_64-with-debian-9.8 2019-10-11 02:36:12
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .> app:         tasks:0x7f17bf92e128
- ** ---------- .> transport:   redis://:**@localhost:6379/0
- ** ---------- .> results:     redis://:**@localhost:6379/0
- *** --- * --- .> concurrency: 2 (prefork)
-- ******* ---- .> task events: ON
--- ***** ----- 
 -------------- [queues]
                .> celery           exchange=celery(direct) key=celery          

Then to schedule task:

>>>from celery_test import test_task
>>>result = test_task.apply_async((11,)) 
>>>result.status
'PENDING'
>>>result.state
'PENDING'
>>>result.state
'PENDING'
>>>result.state
'SUCCESS'

Why is there no "STARTED" in the task status?And I checked redis.There is no key such as ‘celery-task-meta-XXX’ for the current task in redis until the task is completed

1 Answers
Related