如何杀死 Heroku 上的 resque 工作人员?

发布于 2024-11-26 07:56:30 字数 702 浏览 2 评论 0原文

我正在使用本指南使用 Redis http: //blog.redistogo.com/2010/07/26/resque-with-redis-to-go/

我已将其全部设置完毕,当我放置某些内容时,它会显示在我的 resque 队列中。它在 Heroku 上,所以我运行

heroku rake resque:work QUEUE=*
(in /app)
Starting the New Relic Agent.
Installed New Relic Browser Monitoring middleware
Connected to NewRelic Service at collector-1.newrelic.com:80
^C
[canceled]

This 然后完成工作,但现在工作人员仍然在那里。我现在如何删除/杀死该工作人员?

我目前有这个 0 of 4 Workersworking 我想让它在队列中的任务完成后然后工作人员就删除自己。我将如何继续执行此操作,或者是否需要调用另一个 heroku 终端命令。

resque 工作人员在 Heroku 上也需要花钱吗?我只是想手动触发我的 resque 队列中的任务。我不需要它自动完成。

I am using this guide to setup Resque with Redis http://blog.redistogo.com/2010/07/26/resque-with-redis-to-go/

I have it all set up and when I put something it shows up on my resque queue. It is on heroku so then I run

heroku rake resque:work QUEUE=*
(in /app)
Starting the New Relic Agent.
Installed New Relic Browser Monitoring middleware
Connected to NewRelic Service at collector-1.newrelic.com:80
^C
[canceled]

This then completes the job, but now the worker is still there. How do I now delete/kill the worker?

I currently have this 0 of 4 Workers Working I want to make it so that after the tasks in the queue are completed then the worker just deletes itself. How would I go on doing this or is there another heroku terminal command I need to call.

Also do resque workers cost any money on heroku? I just want to make so I can manually trigger tasks in my resque queue. I dont need it to be doing it automatically.

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

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

发布评论

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

评论(4

嘿看小鸭子会跑 2024-12-03 07:56:31

要与 Heroku Worker 集成,您需要实现一个名为 jobs:work 的 Rake 任务。要使其与 resque 一起工作,您需要将以下任务添加到 rake 文件中(取自 http://blog.redistogo.com/2010/07/26/resque-with-redis-to-go/):

require 'resque/tasks'

task "resque:setup" => :environment do
  ENV['QUEUE'] = '*'
end

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

在heroku上启动单个worker使用:

? heroku workers 1

要关闭后台工作程序,请执行以下操作:

? heroku workers 0

要使用 5 个工作程序,请执行以下操作:

? heroku workers 5

Heroku 按秒为您运行的每个工作程序收费。如果您登录 Heroku,您将能够在应用程序的资源页面上查看当前的工作人员数量将花费多少费用。

To integrate with the heroku workers you need to implement a rake task called jobs:work. To get this working with resque you need to add the following task to a rake file(taken from http://blog.redistogo.com/2010/07/26/resque-with-redis-to-go/):

require 'resque/tasks'

task "resque:setup" => :environment do
  ENV['QUEUE'] = '*'
end

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

To start a single worker on heroku use:

? heroku workers 1

To switch off background workers do:

? heroku workers 0

To use 5 workers do:

? heroku workers 5

Heroku charges you by the second for each worker that you run. If you log into heroku you'll be able to see how much your current number of workers will cost on the resources page for your app.

你的背包 2024-12-03 07:56:31

在 Heroku Cedar Stack 上,这非常简单,这是将工作人员数量更改为 n 的命令,您将运行此命令,它会杀死/创建工作人员以实现 n代码>.

heroku ps:scale worker=n --app your-app-name

有关更多详细信息,请参阅 Heroku 上的这篇文章:https://devcenter.heroku.com/articles/scaling

On the Heroku Cedar Stack this is pretty easy, this is the command to change the number of workers to n you would run this command, and it would kill/create workers to achieve n.

heroku ps:scale worker=n --app your-app-name

See this article at Heroku for more details: https://devcenter.heroku.com/articles/scaling

女皇必胜 2024-12-03 07:56:31

您尝试过 HireFire 吗?

它是专门为放大/缩小 Heroku 上的 Resque(和延迟作业)工作人员而设计的。

Have you tried out HireFire ?

Its designed specifically to scale up/down Resque (and Delayed Job) workers on Heroku.

尘曦 2024-12-03 07:56:30

我知道这是一个老问题,但你可以从控制台做到这一点:

$ heroku run console
irb(main):001:0> Resque.working[0].id
=> "09ec127d-bb90-4629-a6f2-bb2610885ab5:62:*"
irb(main):002:0> Resque.working.length
=> 28
irb(main):003:0> Resque.remove_worker("09ec127d-bb90-4629-a6f2-bb2610885ab5:62:*")
=> 0
irb(main):004:0> Resque.working.length
=> 27
irb(main):005:0> 

我还没有尝试过,但还有一个

I know this is an old question but you can do it from the console:

$ heroku run console
irb(main):001:0> Resque.working[0].id
=> "09ec127d-bb90-4629-a6f2-bb2610885ab5:62:*"
irb(main):002:0> Resque.working.length
=> 28
irb(main):003:0> Resque.remove_worker("09ec127d-bb90-4629-a6f2-bb2610885ab5:62:*")
=> 0
irb(main):004:0> Resque.working.length
=> 27
irb(main):005:0> 

I haven't tried it yet but there's also a gem for doing this manually, sounds like you want to automate it though.

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