简体   繁体   English

Celery Task apply_async行为错误

[英]Celery Task apply_async behaviours incorrectly

Call the follow code 调用以下代码

 tasks.update_address_location.apply_async((address_obj.id), countdown = 10)

However the task executes immediately on the queue. 但是,任务将立即在队列上执行。 It workings so must other possibilities I've rules out. 它起作用了,所以我必须排除其他可能性。 Thought someone might have an answer 以为有人可能有答案

capp = Celery('async', backend='redis://localhost:6379/0',
              broker='redis://localhost:6379/0', include=['app.async.tasks'])

# Optional configuration, see the application user guide.
capp.config_from_object(celeryconfig)
capp.conf.update(
    CELERY_TASK_RESULT_EXPIRES=3600,
)

if __name__ == '__main__':
    capp.start()

and celery is called as such: 芹菜也这样称呼:

celery multi stop worker  -A app.async.celery_app:capp --beat --loglevel=debug --pidfile=celery.pid --logfile=celery.log

The output in the celery.log is consistent and successful, but there no delay in there. celery.log中的输出是一致且成功的,但是在那里没有延迟。

A quirk of python - (x) == x - a tuple with one element must contain a comma - (x,) python的怪癖 - (x) == x具有一个元素的元组必须包含逗号- (x,)

Do this: 做这个:

apply_async((address_obj.id,), {}, countdown=10)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM