延迟的作业排除队列 [英] Delayed job exclude queue
问题描述
我有一个延迟的工作队列,其中包含特别慢的运行任务,我希望由其自己的专用工作人员处理,因此风险较小,它将阻塞其余的工作人员管道。
I have a delayed job queue which contains particularly slow running tasks, which I want to be crunched by its own set of dedicated workers, so there is less risk it'll bottleneck the rest of the worker pipeline.
RAILS_ENV =生产脚本/ delayed_job --queue = super_slow_stuff开始
但是,我还希望为所有其他队列提供一个通用工作池,希望不必单独指定它们(因为它们的名称等也经常更改/添加)。类似于以下内容:
However I then also want a general worker pool for all other queues, hopefully without having to specify them seperately (as their names etc are often changed/added too). Something akin to:
RAILS_ENV =生产脚本/延迟工作--except-queue = super_slow_stuff开始
我可以使用通配符 *
字符,但是我想这也会导致第二个工作人员也选择超级慢的工作?
I could use the wildcard *
charecter but I imagine this would cause the second worker to pickup the super slow jobs too?
对此有任何建议吗?
推荐答案
不幸的是,此功能未能在延迟中实现工作。
请参阅:
https://github.com/collectiveidea/delayed_job/pull/466
https://github.com/collectiveidea/delayed_job/pull/901
Unfortunately this functionality not realized in delayed jobs.
See:
https://github.com/collectiveidea/delayed_job/pull/466
https://github.com/collectiveidea/delayed_job/pull/901
您可以分叉延迟作业存储库并应用> https://github.com/collectiveidea/delayed_job/pull中的简单补丁/ 466 。
然后使用您的GitHub存储库,但请投票给 https://github.com/collectiveidea/delayed_job/pull/466 使其最终合并到上游。
You may fork delayed jobs repository and apply the simple patches from https://github.com/collectiveidea/delayed_job/pull/466.
Then use your GitHub repo, but please vote into https://github.com/collectiveidea/delayed_job/pull/466 to make it merged finally into upstream.
更新: >
我编写了自己排除队列的选项。它在(exclude_queues)分支中: https://github.com/one- more-alex / delayed_job / tree / exclude_queues
https://github.com/one-more-alex/delayed_job_active_record/tree/exclude_queues
Readme.md中包含的选项说明
Options description included in Readme.md
有关排除的部分。
# Option --exclude-specified-queues will do inverse of queues processing by skipping onces from --queue, --queues.
# If both --pool=* --exclude-specified-queues given, no exclusions will by applied on "*".
If EXCLUDE_SPECIFIED_QUEUES set to YES, then queues defined by QUEUE, QUEUES will be skipped instead. See opton --exclude-specified-queues description for specal case of queue "*"
如果严格回答问题,则致电一般工人将像这样:
If answer strictly on question, the calling of general worker will be like:
RAILS_ENV=production script/delayed_job --queue=super_slow_stuff --exclude-specified-queues start
警告
请不要,那将不支持DelayedJobs和按原样放置的代码希望它会有用。
相应的拉取请求由我发出 https://github.com/collectiveidea/delayed_job / pull / 1019
也用于Active Record后端:> https://github.com/collectiveidea/delayed_job_active_record/pull/151
Also for Active Record backend: https://github.com/collectiveidea/delayed_job_active_record/pull/151
仅支持ActiveRecord后端。
Only ActiveRecord backend supported.
这篇关于延迟的作业排除队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!