diff --git a/Gemfile.lock b/Gemfile.lock index 182a315..34080e2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ GIT remote: https://github.com/resque/resque.git - revision: aee359b79ed58799a9d1463b47da6533395e1185 + revision: 41469a3eaa9394a60a2ff249c4d00a41f06b4b22 branch: 1-x-stable specs: - resque (1.25.1) + resque (1.25.2) mono_logger (~> 1.0) multi_json (~> 1.0) redis-namespace (~> 1.3) @@ -23,113 +23,117 @@ PATH GEM remote: https://rubygems.org/ specs: - actionmailer (4.0.3) - actionpack (= 4.0.3) - mail (~> 2.5.4) - actionpack (4.0.3) - activesupport (= 4.0.3) + actionmailer (4.0.10) + actionpack (= 4.0.10) + mail (~> 2.5, >= 2.5.4) + actionpack (4.0.10) + activesupport (= 4.0.10) builder (~> 3.1.0) erubis (~> 2.7.0) rack (~> 1.5.2) rack-test (~> 0.6.2) - activemodel (4.0.3) - activesupport (= 4.0.3) + activemodel (4.0.10) + activesupport (= 4.0.10) builder (~> 3.1.0) - activerecord (4.0.3) - activemodel (= 4.0.3) + activerecord (4.0.10) + activemodel (= 4.0.10) activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.3) + activesupport (= 4.0.10) arel (~> 4.0.0) activerecord-deprecated_finders (1.0.3) - activerecord-jdbc-adapter (1.2.9.1) - activerecord-jdbcsqlite3-adapter (1.2.9) - activerecord-jdbc-adapter (~> 1.2.9) + activerecord-jdbc-adapter (1.3.11) + activerecord (>= 2.2) + activerecord-jdbcsqlite3-adapter (1.3.11) + activerecord-jdbc-adapter (~> 1.3.11) jdbc-sqlite3 (~> 3.7.2) - activesupport (4.0.3) - i18n (~> 0.6, >= 0.6.4) + activesupport (4.0.10) + i18n (~> 0.6, >= 0.6.9) minitest (~> 4.2) multi_json (~> 1.3) thread_safe (~> 0.1) tzinfo (~> 0.3.37) arel (4.0.2) - atomic (1.1.15) - atomic (1.1.15-java) builder (3.1.4) - coffee-rails (4.0.1) + coffee-rails (4.1.0) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) coffee-script (2.3.0) coffee-script-source execjs - coffee-script-source (1.7.1) - colorize (0.5.8) - coveralls (0.6.7) - colorize + coffee-script-source (1.8.0) + coveralls (0.7.1) multi_json (~> 1.3) rest-client simplecov (>= 0.7) + term-ansicolor thor - dotenv (0.9.0) - dotenv-rails (0.9.0) - dotenv (= 0.9.0) + docile (1.1.5) + dotenv (1.0.2) + dotenv-rails (1.0.2) + dotenv (= 1.0.2) erubis (2.7.0) - execjs (2.0.1) + execjs (2.2.2) ffi2-generators (0.1.1) hike (1.2.3) - i18n (0.6.9) + i18n (0.6.11) jdbc-sqlite3 (3.7.2.1) - jquery-rails (3.1.1) + jquery-rails (3.1.2) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.1) json (1.8.1-java) - libv8 (3.16.14.3) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - metaclass (0.0.1) - mime-types (1.25.1) + libv8 (3.16.14.7) + mail (2.6.3) + mime-types (>= 1.16, < 3) + metaclass (0.0.4) + mime-types (2.4.3) minitest (4.7.5) - minitest-spec-rails (4.7.6) + minitest-spec-rails (4.7.7) minitest (~> 4.7) rails (>= 3.0, < 4.1) - mocha (0.14.0) + mocha (1.1.0) metaclass (~> 0.0.1) mono_logger (1.1.0) - multi_json (1.8.4) - polyglot (0.3.4) - racc (1.4.10) + multi_json (1.10.1) + netrc (0.8.0) + racc (1.4.12) rack (1.5.2) - rack-protection (1.5.2) + rack-protection (1.5.3) rack rack-test (0.6.2) rack (>= 1.0) - rails (4.0.3) - actionmailer (= 4.0.3) - actionpack (= 4.0.3) - activerecord (= 4.0.3) - activesupport (= 4.0.3) + rails (4.0.10) + actionmailer (= 4.0.10) + actionpack (= 4.0.10) + activerecord (= 4.0.10) + activesupport (= 4.0.10) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.3) - sprockets-rails (~> 2.0.0) - railties (4.0.3) - actionpack (= 4.0.3) - activesupport (= 4.0.3) + railties (= 4.0.10) + sprockets-rails (~> 2.0) + railties (4.0.10) + actionpack (= 4.0.10) + activesupport (= 4.0.10) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.1.1) - rdoc (4.0.1) + rake (10.3.2) + rb-readline (0.5.1) + rdoc (4.1.2) json (~> 1.4) redcard (1.1.0) - redis (3.0.7) - redis-namespace (1.4.1) - redis (~> 3.0.4) + redis (3.1.0) + redis-namespace (1.5.1) + redis (~> 3.0, >= 3.0.4) ref (1.0.5) - rest-client (1.6.7) - mime-types (>= 1.16) + resque-history (1.12.2) + resque + resque-sliders (0.2.3) + resque (>= 1.15.0, < 2.0) + rest-client (1.7.2) + mime-types (>= 1.16, < 3.0) + netrc (~> 0.7) rubinius-coverage (2.0.3) - rubinius-profiler (2.0.0) - rubysl (2.0.15) + rubinius-profiler (2.0.1) + rubysl (2.1.0) rubysl-abbrev (~> 2.0) rubysl-base64 (~> 2.0) rubysl-benchmark (~> 2.0) @@ -163,7 +167,7 @@ GEM rubysl-io-nonblock (~> 2.0) rubysl-io-wait (~> 2.0) rubysl-ipaddr (~> 2.0) - rubysl-irb (~> 2.0) + rubysl-irb (~> 2.1) rubysl-logger (~> 2.0) rubysl-mathn (~> 2.0) rubysl-matrix (~> 2.0) @@ -192,7 +196,6 @@ GEM rubysl-pstore (~> 2.0) rubysl-pty (~> 2.0) rubysl-rational (~> 2.0) - rubysl-readline (~> 2.0) rubysl-resolv (~> 2.0) rubysl-rexml (~> 2.0) rubysl-rinda (~> 2.0) @@ -234,7 +237,7 @@ GEM rubysl-csv (2.0.2) rubysl-english (~> 2.0) rubysl-curses (2.0.1) - rubysl-date (2.0.6) + rubysl-date (2.0.8) rubysl-delegate (2.0.1) rubysl-digest (2.0.3) rubysl-drb (2.0.1) @@ -259,10 +262,10 @@ GEM rubysl-io-nonblock (2.0.0) rubysl-io-wait (2.0.0) rubysl-ipaddr (2.0.0) - rubysl-irb (2.0.4) + rubysl-irb (2.1.0) + rb-readline (~> 0.5) rubysl-e2mmap (~> 2.0) rubysl-mathn (~> 2.0) - rubysl-readline (~> 2.0) rubysl-thread (~> 2.0) rubysl-logger (2.0.0) rubysl-mathn (2.0.0) @@ -287,22 +290,21 @@ GEM rubysl-observer (2.0.0) rubysl-open-uri (2.0.0) rubysl-open3 (2.0.0) - rubysl-openssl (2.0.5) + rubysl-openssl (2.2.1) rubysl-optparse (2.0.1) rubysl-shellwords (~> 2.0) rubysl-ostruct (2.0.4) - rubysl-pathname (2.0.0) - rubysl-prettyprint (2.0.2) + rubysl-pathname (2.1.0) + rubysl-prettyprint (2.0.3) rubysl-prime (2.0.1) rubysl-profile (2.0.0) rubysl-profiler (2.0.1) rubysl-pstore (2.0.0) rubysl-pty (2.0.2) rubysl-rational (2.0.1) - rubysl-readline (2.0.2) - rubysl-resolv (2.0.0) - rubysl-rexml (2.0.2) - rubysl-rinda (2.0.0) + rubysl-resolv (2.1.0) + rubysl-rexml (2.0.3) + rubysl-rinda (2.0.1) rubysl-rss (2.0.0) rubysl-scanf (2.0.0) rubysl-securerandom (2.0.0) @@ -320,7 +322,7 @@ GEM rubysl-thwait (2.0.0) rubysl-time (2.0.3) rubysl-timeout (2.0.0) - rubysl-tmpdir (2.0.0) + rubysl-tmpdir (2.0.1) rubysl-tsort (2.0.1) rubysl-un (2.0.0) rubysl-fileutils (~> 2.0) @@ -332,53 +334,52 @@ GEM rubysl-yaml (2.0.4) rubysl-zlib (2.0.1) sass (3.2.19) - sass-rails (4.0.3) + sass-rails (4.0.4) railties (>= 4.0.0, < 5.0) - sass (~> 3.2.0) - sprockets (~> 2.8, <= 2.11.0) + sass (~> 3.2.2) + sprockets (~> 2.8, < 2.12) sprockets-rails (~> 2.0) - simplecov (0.7.1) + simplecov (0.9.1) + docile (~> 1.1.0) multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - sinatra (1.4.4) + simplecov-html (~> 0.8.0) + simplecov-html (0.8.0) + sinatra (1.4.5) rack (~> 1.4) rack-protection (~> 1.4) tilt (~> 1.3, >= 1.3.4) - sprockets (2.11.0) + sprockets (2.11.3) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) + sprockets-rails (2.2.0) actionpack (>= 3.0) activesupport (>= 3.0) - sprockets (~> 2.8) - sqlite3 (1.3.8) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.10) + term-ansicolor (1.3.0) + tins (~> 1.0) therubyracer (0.12.1) libv8 (~> 3.16.14.0) ref therubyrhino (2.0.2) therubyrhino_jar (>= 1.7.3) therubyrhino_jar (1.7.4) - thor (0.18.1) - thread_safe (0.2.0) - atomic (>= 1.1.7, < 2) - thread_safe (0.2.0-java) - atomic (>= 1.1.7, < 2) + thor (0.19.1) + thread_safe (0.3.4) + thread_safe (0.3.4-java) tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) + tins (1.3.3) twitter-bootstrap-rails (2.2.8) actionpack (>= 3.1) execjs rails (>= 3.1) railties (>= 3.1) - tzinfo (0.3.38) - uglifier (2.2.0) + tzinfo (0.3.42) + uglifier (2.5.3) execjs (>= 0.3.0) - multi_json (~> 1.0, >= 1.0.2) + json (>= 1.8.0) vegas (0.1.11) rack (>= 1.0.0) @@ -398,6 +399,8 @@ DEPENDENCIES rdoc redcard resque! + resque-history + resque-sliders resque-web! rubinius-coverage rubinius-profiler diff --git a/app/controllers/resque_web/workers_controller.rb b/app/controllers/resque_web/workers_controller.rb index cf18c15..52d58bb 100644 --- a/app/controllers/resque_web/workers_controller.rb +++ b/app/controllers/resque_web/workers_controller.rb @@ -13,6 +13,19 @@ def show end end + #kills all workers on a given host + def destroy + @workers = Resque.workers + @workers.each { |worker| worker.unregister_worker} + redirect_to workers_path + end + + #kills worker by by worker id + def kill_worker + Resque::Worker.find(params[:id]).unregister_worker + redirect_to workers_path + end + private def display_subtabs diff --git a/app/views/resque_web/workers/show.html.erb b/app/views/resque_web/workers/show.html.erb index f1c2a03..3fe9913 100644 --- a/app/views/resque_web/workers/show.html.erb +++ b/app/views/resque_web/workers/show.html.erb @@ -1,12 +1,21 @@

<%= @workers.size %> Workers

The workers listed below are all registered as active on your system.

+ + <%= form_tag(worker_path(params[:id]), :method => :delete, :class => 'remove-queue') do %> + <%= submit_tag "Kill All Workers", :class => 'btn btn-danger', :data => { :confirm => "Are you sure you want to kill all workers on this host?" } %> + <% end %> + + + + + <% @workers.each do |worker| %> @@ -27,7 +36,11 @@ <% else %> Waiting for a job... <% end %> + + + <% end %> <% if @workers.empty? %> diff --git a/app/views/resque_web/working/_working.html.erb b/app/views/resque_web/working/_working.html.erb index afde5ca..5575646 100644 --- a/app/views/resque_web/working/_working.html.erb +++ b/app/views/resque_web/working/_working.html.erb @@ -6,6 +6,7 @@ + <% if worker_jobs.empty? %> @@ -29,6 +30,11 @@ Waiting for a job... <% end %> + + + <% end %>
  Where Queues ProcessingKill Worker?
+ <%= link_to "Kill Worker", kill_worker_path(worker), :method=> :delete, :data => { :confirm => "Are you sure you want to kill #{worker}?"} %>
Where Queue Processing Kill Worker?
+ <%= link_to " Kill Worker", kill_worker_path(worker), :method=> :delete, :data=> {:confirm => "Are you sure you wnat to kill #{worker}"} %> +
diff --git a/config/initializers/resque_plugins.rb b/config/initializers/resque_plugins.rb new file mode 100644 index 0000000..60ac2da --- /dev/null +++ b/config/initializers/resque_plugins.rb @@ -0,0 +1,3 @@ +#Encountered difficulty installing plugnins via gemfile. Tried to add plugins to web-app manually. +require "resque-sliders" +require "resque-history" diff --git a/config/routes.rb b/config/routes.rb index 10c0644..e6e41f6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,10 +11,10 @@ resources :working, :only => [:index] resources :queues, :only => [:index,:show,:destroy], :constraints => {:id => id_pattern} do member do - put 'clear' + put 'clear' end end - resources :workers, :only => [:index,:show], :constraints => {:id => id_pattern} + resources :workers, :only => [:index,:show,:destroy], :constraints => {:id => id_pattern} resources :failures, :only => [:show,:index,:destroy] do member do put 'retry' @@ -29,6 +29,9 @@ get '/stats/:action', :controller => :stats get '/stats/:action/:id', :controller => :stats, :constraints => {:id => id_pattern}, :as => :statistic + #route pass worker id to controller method that unregisteres worker by id + delete '/kill_worker/:id' => "workers#kill_worker", :as => :kill_worker + root :to => 'overview#show' end