resque_ui 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ == 3.1.1 2011-10-13
2
+
3
+ * Modified the restart_workers and quit_workers cap tasks to no longer use the , :only => {:resque_restart => true} flag.
4
+ - These tasks now execute the rake tasks on all servers in the farm
5
+ * Modified the restart_workers and quit_workers rake tasks to not execute separate cap tasks for each worker.
6
+ - Task now iterates through the workers and restarts the ones on the box the rake task is executing on.
7
+
1
8
  == 3.1.0 2011-09-22
2
9
 
3
10
  * Added Resque Cleaner to manage the failed queue. Removed the Failed tab.
data/README.markdown CHANGED
@@ -182,10 +182,13 @@ You will also need to tell resque_ui where cap is installed. Add this line to y
182
182
 
183
183
  The cap tasks included are:
184
184
 
185
- cap resque:work # start a resque worker.
186
- cap resque:workers # start multiple resque workers.
187
- cap resque:quit_worker # Gracefully kill a worker. If the worker is working, it will finish before shutting down.
188
- cap resque:restart_workers # Restart all workers on all servers
185
+ cap resque:work # start a resque worker.
186
+ cap resque:workers # start multiple resque workers.
187
+ cap resque:quit_worker # Gracefully kill a worker. If the worker is working, it will finish before shutting down.
188
+ cap resque:quit_workers # Gracefully kill all workers on all servers. If the worker is working, it will finish before shutting down.
189
+ cap resque:kill_worker_with_impunity # Kill a rogue worker. If the worker is working, it will not finish and the job will go to the Failed queue as a DirtyExit. arg: host=ip pid=pid
190
+ cap resque:kill_workera_with_impunity # Kill all rogue workers on all servers. If the worker is working, it will not finish and the job will go to the Failed queue as a DirtyExit.
191
+ cap resque:restart_workers # Restart all workers on all servers
189
192
 
190
193
  Multi-Threaded Workers
191
194
  ---------------------
@@ -211,13 +214,7 @@ After Deploy Hooks
211
214
  The resque:restart_workers cap task can be added as an after deploy task to refresh your workers. Without this, your workers will
212
215
  continue to run your old code base after a deployment.
213
216
 
214
- To make it work:
215
- Set one of the servers in your app role as the resque_restart server:
216
-
217
- role :app, "your.first.ip.1","your.second.ip"
218
- role :app, "your.first.ip.1", :resque_restart => true
219
-
220
- Then add the callbacks:
217
+ To make it work add the callbacks in your deploy.rb file:
221
218
 
222
219
  after "deploy", "resque:restart_workers"
223
220
  after "deploy:migrations", "resque:restart_workers"
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 3
3
3
  :minor: 1
4
- :patch: 0
4
+ :patch: 1
5
5
  :build:
@@ -28,13 +28,13 @@ Capistrano::Configuration.instance(:must_exist).load do
28
28
  end
29
29
 
30
30
  desc "Gracefully kill all workers on all servers. If the worker is working, it will finish before shutting down."
31
- task :quit_workers, :roles => :app, :only => {:resque_restart => true} do
31
+ task :quit_workers, :roles => :app do
32
32
  default_run_options[:pty] = true
33
33
  rake = fetch(:rake, "rake")
34
34
  run("cd #{current_path}; #{rake} RAILS_ENV=#{stage} resque:quit_workers")
35
35
  end
36
36
 
37
- desc "Kill a rogue worker. If the worker is working, it will not finish and the job will go to the Failed queue as a DirtExit. arg: host=ip pid=pid"
37
+ desc "Kill a rogue worker. If the worker is working, it will not finish and the job will go to the Failed queue as a DirtyExit. arg: host=ip pid=pid"
38
38
  task :kill_worker_with_impunity, :roles => :app do
39
39
  if ENV['host'].nil? || ENV['host'].empty? || ENV['pid'].nil? || ENV['pid'].empty?
40
40
  puts 'You must enter the host and pid to kill..cap resque:quit host=ip pid=pid'
@@ -44,7 +44,7 @@ Capistrano::Configuration.instance(:must_exist).load do
44
44
  end
45
45
  end
46
46
 
47
- desc "Kill all rogue workers on all servers. If the worker is working, it will not finish and the job will go to the Failed queue as a DirtExit. arg: host=ip pid=pid"
47
+ desc "Kill all rogue workers on all servers. If the worker is working, it will not finish and the job will go to the Failed queue as a DirtyExit.
48
48
  task :kill_workers_with_impunity, :roles => :app do
49
49
  default_run_options[:pty] = true
50
50
  rake = fetch(:rake, "rake")
@@ -62,7 +62,7 @@ Capistrano::Configuration.instance(:must_exist).load do
62
62
  end
63
63
 
64
64
  desc "Restart all workers on all servers"
65
- task :restart_workers, :roles => :app, :only => {:resque_restart => true} do
65
+ task :restart_workers, :roles => :app do
66
66
  default_run_options[:pty] = true
67
67
  rake = fetch(:rake, "rake")
68
68
  run("cd #{current_path}; nohup #{rake} RAILS_ENV=#{stage} resque:restart_workers")
@@ -206,7 +206,7 @@ module Resque
206
206
 
207
207
  def self.start(ips, queues)
208
208
  if Rails.env =~ /development|test/
209
- Thread.new(queues) { |queue| system("rake QUEUE=#{queue} resque:work") }
209
+ Thread.new(queues) { |queue| system("rake RAILS_ENV=#{Rails.env} QUEUE=#{queue} resque:work") }
210
210
  else
211
211
  Thread.new(queues, ips) { |queue, ip_list| system("cd #{Rails.root}; #{ResqueUi::Cap.path} #{Rails.env} resque:work host=#{ip_list} queue=#{queue}") }
212
212
  end
data/lib/resque_ui.rb CHANGED
@@ -18,10 +18,5 @@ Resque::Server.tabs.delete 'Failed'
18
18
 
19
19
  module ResqueUi
20
20
  class Engine < Rails::Engine
21
- rake_tasks do
22
- load 'tasks/worker.rake'
23
- load 'tasks/failure.rake'
24
- load 'tasks/scheduler.rake' if Resque.respond_to? :schedule
25
- end
26
21
  end
27
22
  end
@@ -4,14 +4,14 @@ namespace :resque do
4
4
  task :work => :setup do
5
5
  require 'resque'
6
6
 
7
- worker = nil
8
- queues = (ENV['QUEUES'] || ENV['QUEUE']).to_s.split('#').delete_if { |a| a.blank? }
9
- threads = []
10
- mqueue = queues.shift
7
+ worker = nil
8
+ queues = (ENV['QUEUES'] || ENV['QUEUE']).to_s.split('#').delete_if { |a| a.blank? }
9
+ threads = []
10
+ mqueue = queues.shift
11
11
  Thread.current[:queues] = mqueue
12
- mworker = Resque::Worker.new(mqueue)
13
- mworker.verbose = true #ENV['LOGGING'] || ENV['VERBOSE']
14
- mworker.very_verbose = true #ENV['VVERBOSE']
12
+ mworker = Resque::Worker.new(mqueue)
13
+ mworker.verbose = true #ENV['LOGGING'] || ENV['VERBOSE']
14
+ mworker.very_verbose = true #ENV['VVERBOSE']
15
15
 
16
16
  if ENV['PIDFILE']
17
17
  File.open(ENV['PIDFILE'], 'w') { |f| f << mworker.pid }
@@ -21,9 +21,9 @@ namespace :resque do
21
21
  threads << Thread.new do
22
22
  begin
23
23
  Thread.current[:queues] = queue
24
- worker = Resque::Worker.new(queue)
25
- worker.verbose = ENV['LOGGING'] || ENV['VERBOSE']
26
- worker.very_verbose = ENV['VVERBOSE']
24
+ worker = Resque::Worker.new(queue)
25
+ worker.verbose = ENV['LOGGING'] || ENV['VERBOSE']
26
+ worker.very_verbose = ENV['VVERBOSE']
27
27
  rescue Resque::NoQueueError
28
28
  abort "set QUEUE env var, e.g. $ QUEUE=critical,high rake resque:work"
29
29
  end
@@ -45,10 +45,16 @@ namespace :resque do
45
45
  task :restart_workers => :setup do
46
46
  require 'resque'
47
47
  pid = ''
48
+ queues = ''
49
+ local_ip = Resque.workers.first.local_ip rescue '';
48
50
  Resque.workers.sort_by { |w| w.to_s }.each do |worker|
49
- if pid != worker.pid
50
- worker.restart
51
- pid = worker.pid
51
+ if local_ip == worker.ip # only restart the workers that are on this server
52
+ if pid != worker.pid
53
+ system("kill -INT #{worker.pid}")
54
+ queues = worker.queues_in_pid.join('#')
55
+ Thread.new(queues) { |queue| system("nohup rake RAILS_ENV=#{Rails.env} QUEUE=#{queue} resque:work") }
56
+ pid = worker.pid
57
+ end
52
58
  end
53
59
  end
54
60
  end
@@ -57,10 +63,13 @@ namespace :resque do
57
63
  task :quit_workers => :setup do
58
64
  require 'resque'
59
65
  pid = ''
66
+ local_ip = Resque.workers.first.local_ip
60
67
  Resque.workers.sort_by { |w| w.to_s }.each do |worker|
61
- if pid != worker.pid
62
- worker.quit
63
- pid = worker.pid
68
+ if local_ip == worker.ip # only quit the workers that are on this server
69
+ if pid != worker.pid
70
+ system("kill -INT #{worker.pid}")
71
+ pid = worker.pid
72
+ end
64
73
  end
65
74
  end
66
75
  end
@@ -69,10 +78,13 @@ namespace :resque do
69
78
  task :kill_workers_with_impunity => :setup do
70
79
  require 'resque'
71
80
  pid = ''
81
+ local_ip = Resque.workers.first.local_ip
72
82
  Resque.workers.sort_by { |w| w.to_s }.each do |worker|
73
- if pid != worker.pid
74
- `kill -9 #{worker.pid}`
75
- pid = worker.pid
83
+ if local_ip == worker.ip # only kill the pids that are on this server
84
+ if pid != worker.pid # only kill it once
85
+ `kill -9 #{worker.pid}`
86
+ pid = worker.pid
87
+ end
76
88
  end
77
89
  end
78
90
  end
@@ -212,7 +212,7 @@
212
212
  <span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 207</span>
213
213
  <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">ips</span>, <span class="ruby-identifier">queues</span>)
214
214
  <span class="ruby-keyword">if</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">env</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/development|test/</span>
215
- <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">queues</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">queue</span><span class="ruby-operator">|</span> <span class="ruby-identifier">system</span>(<span class="ruby-node">&quot;rake QUEUE=#{queue} resque:work&quot;</span>) }
215
+ <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">queues</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">queue</span><span class="ruby-operator">|</span> <span class="ruby-identifier">system</span>(<span class="ruby-node">&quot;rake RAILS_ENV=#{Rails.env} QUEUE=#{queue} resque:work&quot;</span>) }
216
216
  <span class="ruby-keyword">else</span>
217
217
  <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">queues</span>, <span class="ruby-identifier">ips</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">queue</span>, <span class="ruby-identifier">ip_list</span><span class="ruby-operator">|</span> <span class="ruby-identifier">system</span>(<span class="ruby-node">&quot;cd #{Rails.root}; #{ResqueUi::Cap.path} #{Rails.env} resque:work host=#{ip_list} queue=#{queue}&quot;</span>) }
218
218
  <span class="ruby-keyword">end</span>
data/rdoc/created.rid CHANGED
@@ -1,11 +1,11 @@
1
- Thu, 22 Sep 2011 15:32:04 -0400
2
- README.markdown Thu, 22 Sep 2011 15:30:29 -0400
3
- lib/resque_ui.rb Thu, 22 Sep 2011 14:44:55 -0400
1
+ Thu, 13 Oct 2011 12:25:22 -0400
2
+ README.markdown Thu, 13 Oct 2011 12:23:16 -0400
3
+ lib/resque_ui.rb Thu, 13 Oct 2011 11:42:34 -0400
4
4
  lib/resque_ui/cap.rb Wed, 14 Sep 2011 16:39:33 -0400
5
- lib/resque_ui/cap_recipes.rb Wed, 27 Apr 2011 11:46:56 -0400
5
+ lib/resque_ui/cap_recipes.rb Thu, 13 Oct 2011 12:23:16 -0400
6
6
  lib/resque_ui/overrides/resque/job.rb Fri, 16 Sep 2011 14:33:15 -0400
7
7
  lib/resque_ui/overrides/resque/resque.rb Thu, 15 Sep 2011 12:15:57 -0400
8
- lib/resque_ui/overrides/resque/worker.rb Thu, 15 Sep 2011 12:15:57 -0400
8
+ lib/resque_ui/overrides/resque/worker.rb Tue, 11 Oct 2011 14:29:01 -0400
9
9
  lib/resque_ui/overrides/resque_scheduler/resque_scheduler.rb Thu, 15 Sep 2011 11:57:02 -0400
10
10
  lib/resque_ui/overrides/resque_status/chained_job_with_status.rb Thu, 15 Sep 2011 12:06:19 -0400
11
11
  lib/resque_ui/overrides/resque_status/job_with_status.rb Thu, 15 Sep 2011 12:06:45 -0400
data/rdoc/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <head>
7
7
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
8
 
9
- <title>ResqueUi 3.1.0</title>
9
+ <title>ResqueUi 3.1.1</title>
10
10
 
11
11
  <link type="text/css" media="screen" href="rdoc.css" rel="stylesheet" />
12
12
 
@@ -19,10 +19,10 @@
19
19
  <body class="indexpage">
20
20
 
21
21
 
22
- <h1>ResqueUi 3.1.0</h1>
22
+ <h1>ResqueUi 3.1.1</h1>
23
23
 
24
24
 
25
- <p>This is the API documentation for 'ResqueUi 3.1.0'.</p>
25
+ <p>This is the API documentation for 'ResqueUi 3.1.1'.</p>
26
26
 
27
27
 
28
28
 
@@ -6,7 +6,7 @@
6
6
  <head>
7
7
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
8
 
9
- <title>File: cap.rb [ResqueUi 3.1.0]</title>
9
+ <title>File: cap.rb [ResqueUi 3.1.1]</title>
10
10
 
11
11
  <link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet" />
12
12
 
@@ -6,7 +6,7 @@
6
6
  <head>
7
7
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
8
 
9
- <title>File: cap_recipes.rb [ResqueUi 3.1.0]</title>
9
+ <title>File: cap_recipes.rb [ResqueUi 3.1.1]</title>
10
10
 
11
11
  <link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet" />
12
12
 
@@ -24,7 +24,7 @@
24
24
  <div id="metadata">
25
25
  <dl>
26
26
  <dt class="modified-date">Last Modified</dt>
27
- <dd class="modified-date">Wed Apr 27 11:46:56 -0400 2011</dd>
27
+ <dd class="modified-date">Thu Oct 13 12:23:16 -0400 2011</dd>
28
28
 
29
29
 
30
30
  <dt class="requires">Requires</dt>
@@ -6,7 +6,7 @@
6
6
  <head>
7
7
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
8
 
9
- <title>File: job.rb [ResqueUi 3.1.0]</title>
9
+ <title>File: job.rb [ResqueUi 3.1.1]</title>
10
10
 
11
11
  <link type="text/css" media="screen" href="../../../../rdoc.css" rel="stylesheet" />
12
12
 
@@ -6,7 +6,7 @@
6
6
  <head>
7
7
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
8
 
9
- <title>File: resque.rb [ResqueUi 3.1.0]</title>
9
+ <title>File: resque.rb [ResqueUi 3.1.1]</title>
10
10
 
11
11
  <link type="text/css" media="screen" href="../../../../rdoc.css" rel="stylesheet" />
12
12
 
@@ -6,7 +6,7 @@
6
6
  <head>
7
7
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
8
 
9
- <title>File: worker.rb [ResqueUi 3.1.0]</title>
9
+ <title>File: worker.rb [ResqueUi 3.1.1]</title>
10
10
 
11
11
  <link type="text/css" media="screen" href="../../../../rdoc.css" rel="stylesheet" />
12
12
 
@@ -24,7 +24,7 @@
24
24
  <div id="metadata">
25
25
  <dl>
26
26
  <dt class="modified-date">Last Modified</dt>
27
- <dd class="modified-date">Thu Sep 15 12:15:57 -0400 2011</dd>
27
+ <dd class="modified-date">Tue Oct 11 14:29:01 -0400 2011</dd>
28
28
 
29
29
 
30
30
  <dt class="requires">Requires</dt>
@@ -6,7 +6,7 @@
6
6
  <head>
7
7
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
8
 
9
- <title>File: resque_scheduler.rb [ResqueUi 3.1.0]</title>
9
+ <title>File: resque_scheduler.rb [ResqueUi 3.1.1]</title>
10
10
 
11
11
  <link type="text/css" media="screen" href="../../../../rdoc.css" rel="stylesheet" />
12
12
 
@@ -6,7 +6,7 @@
6
6
  <head>
7
7
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
8
 
9
- <title>File: chained_job_with_status.rb [ResqueUi 3.1.0]</title>
9
+ <title>File: chained_job_with_status.rb [ResqueUi 3.1.1]</title>
10
10
 
11
11
  <link type="text/css" media="screen" href="../../../../rdoc.css" rel="stylesheet" />
12
12
 
@@ -6,7 +6,7 @@
6
6
  <head>
7
7
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
8
 
9
- <title>File: job_with_status.rb [ResqueUi 3.1.0]</title>
9
+ <title>File: job_with_status.rb [ResqueUi 3.1.1]</title>
10
10
 
11
11
  <link type="text/css" media="screen" href="../../../../rdoc.css" rel="stylesheet" />
12
12
 
@@ -6,7 +6,7 @@
6
6
  <head>
7
7
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
8
 
9
- <title>File: status.rb [ResqueUi 3.1.0]</title>
9
+ <title>File: status.rb [ResqueUi 3.1.1]</title>
10
10
 
11
11
  <link type="text/css" media="screen" href="../../../../rdoc.css" rel="stylesheet" />
12
12
 
@@ -6,7 +6,7 @@
6
6
  <head>
7
7
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
8
 
9
- <title>File: resque_ui.rb [ResqueUi 3.1.0]</title>
9
+ <title>File: resque_ui.rb [ResqueUi 3.1.1]</title>
10
10
 
11
11
  <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet" />
12
12
 
@@ -24,7 +24,7 @@
24
24
  <div id="metadata">
25
25
  <dl>
26
26
  <dt class="modified-date">Last Modified</dt>
27
- <dd class="modified-date">Thu Sep 22 14:44:55 -0400 2011</dd>
27
+ <dd class="modified-date">Thu Oct 13 11:42:34 -0400 2011</dd>
28
28
 
29
29
 
30
30
  <dt class="requires">Requires</dt>
data/resque_ui.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{resque_ui}
8
- s.version = "3.1.0"
8
+ s.version = "3.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kevin Tyll"]
12
- s.date = %q{2011-09-22}
12
+ s.date = %q{2011-10-13}
13
13
  s.description = %q{A Rails UI for Resque for managing workers, failures and schedules.}
14
14
  s.email = %q{kevintyll@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: resque_ui
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.1.0
5
+ version: 3.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kevin Tyll
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-22 00:00:00 -04:00
13
+ date: 2011-10-13 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency