芹菜可以分配任务指定工人 [英] Can celery assign task to specify worker

查看:50
本文介绍了芹菜可以分配任务指定工人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Celery将任务发送给空闲的工人.

Celery will send task to idle workers.

我有一个任务将每5秒运行一次,并且我希望将此任务仅发送给一位指定工作人员.

I have a task will run every 5 seconds, and I want this task to only be sent to one specify worker.

其他任务可以共享剩余的工作人员

Other tasks can share the left over workers

芹菜可以这样做吗?

我想知道此参数是什么: CELERY_TASK_RESULT_EXPIRES
这是否意味着任务将不会发送到队列中的工作程序?
还是运行时间太长会停止任务?

And I want to know what this parameter is: CELERY_TASK_RESULT_EXPIRES
Does it means that the task will not be sent to a worker in the queue?
Or does it stop the task if it runs too long?

推荐答案

可以.最好的方法是,使用不同的队列将芹菜工作者分开.您只需要确保所需的任务进入单独的队列,并且您的工作人员在侦听特定队列.长话不说: http://docs.celeryproject.org/en/latest/userguide/routing.html

Sure, you can. Best way to do it, separate celery workers using different queues. You just need to make sure that task you need goes to separate queue, and your worker listening particular queue. Long story for this: http://docs.celeryproject.org/en/latest/userguide/routing.html

这篇关于芹菜可以分配任务指定工人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆