python - Celery 能让某个任务同时只能运行一个么。
高洛峰
高洛峰 2017-04-18 09:50:48
0
1
857

有个任务在同一时间只能有一个进程执行它,假如这个任务celery 正在跑,后面再提交的就task忽略不跑了。
Celery有参数能快速设置么,还是要自己写逻辑控制。

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
大家讲道理

https://pypi.python.org/pypi/...

There is a library called celery_once. The mechanism behind it is to set a task lock with the task name in redis. When a task is being executed, the same task cannot be triggered again.

When a task is triggered, if it is found that the task already has a lock, an AlreadyQueued exception will be thrown, which is very suitable for use when the previous task has not been executed, the next cycle has arrived, and the mutual exclusion of scheduled tasks in the case of distributed task services scene.

Hope it’s useful to you.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!