Heroku 上的 Resque Scheduler...远程操作?

发布于 2024-09-25 13:48:51 字数 1004 浏览 3 评论 0原文

我正在 Heroku 上的应用程序中添加 Resque-Scheduler

所以...我需要一个单独的并且不同的工作人员充当调度程序和 许多人在做这些工作。

我就是这样做的:
我有一个独特的 Heroku 应用程序,它什么也不做,但有 1 个 resque-scheduler 工作线程,24/7 运行,将 Resque 任务添加到“远程”ma​​in 的 Redis DB 中应用程序。

(我将 jobs:work 任务映射到 resque:schedulerresque:work

这是在 Heroku 上执行此操作的最佳方法吗?平台 ;或者我做错了?

谢谢 !

编辑: 在 Heroku 上进行调度的最小应用程序: http://github.com/clmntlxndr/heroku-scheduler

更新:新的 CEDAR 堆栈开启Heroku 和 Procfiles,可以为每个工作人员启动不同的任务。

web:        bundle exec rails server -p $PORT
scheduler:  bundle exec rake resque:scheduler
worker:     bundle exec rake jobs:work

http://devcenter.heroku.com/articles/procfile

I'm adding Resque-Scheduler in my app on Heroku

So... I need ONE alone and distinct worker acting as the scheduler and
many doing the jobs.

This is how I've done it :
I've a distinct Heroku App which does nothing but has 1 resque-scheduler worker, running 24/7, adding Resque tasks to the Redis DB of the "distant" main App.

(I do that mapping jobs:work task to resque:scheduler or resque:work)

Is this the best way to do it on the Heroku's platform ; or am I doing it totally wrong ?

Thanks !

EDIT:
minimal app for scheduling on Heroku :
http://github.com/clmntlxndr/heroku-scheduler

UPDATE: With the new CEDAR stack on Heroku and Procfiles, it's possible to start a distinct task for each worker.

web:        bundle exec rails server -p $PORT
scheduler:  bundle exec rake resque:scheduler
worker:     bundle exec rake jobs:work

http://devcenter.heroku.com/articles/procfile

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听闻余生 2024-10-02 13:48:51

我想我第一次读错了你的问题。我错过了调度程序需要单独的 rake 任务的部分。

是的,我认为唯一的方法是拥有两个单独的heroku应用程序,因为heroku工作人员只会运行rake jobs:work并且大概您只能将其映射到resque rake任务之一。

你可以尝试这个:

desc "Alias for resque:work (To run workers on Heroku)"
task "jobs:work" => ["resque:work", "resque:scheduler"]

但我真诚地怀疑它是否真的能与 Heroku 监控工作进程和其他东西的方式正常工作。另外,仔细检查那里的 rake 语法;这只是凭记忆。我知道可以指定多个依赖项。

I think I misread your question the first time. I missed the part where scheduler requires a separate rake task.

Yes, I think the only way to do it is to have two separate heroku apps, because heroku workers will only run rake jobs:work and presumably you can only map this onto one of the resque rake tasks.

You could try this:

desc "Alias for resque:work (To run workers on Heroku)"
task "jobs:work" => ["resque:work", "resque:scheduler"]

But I have sincere doubts about that actually working properly with how Heroku monitors worker processes and stuff. Also, double check the rake syntax there; it's just from memory. I know it's possible to specify multiple dependencies though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文