Sha256: 3daa99795fb69563c7d682290d5a0ae3d51d19df7d7007616740962aadb3b5ee

Contents?: true

Size: 1.4 KB

Versions: 11

Compression:

Stored size: 1.4 KB

Contents

namespace :rubber do
  
  namespace :resque_worker_default do
    
    rubber.allow_optional_tasks(self)
    
    before "deploy:stop", "rubber:resque_worker_default:stop"
    after "deploy:start", "rubber:resque_worker_default:start"
    after "deploy:restart", "rubber:resque_worker_default:restart"
    
    desc "Starts default resque worker"
    task :start, :roles => :resque_worker_default do
      as = fetch(:runner, "app")
      via = fetch(:run_method, :sudo)
      rubber_env.resque_worker_default_count.times do |i|
        invoke_command "sh -c 'cd #{current_path}; RAILS_ENV=#{rails_env} QUEUE=* nohup rake resque:work &> log/resque_worker_default_#{i}.log & echo $! > tmp/pids/resque_worker_default_#{i}.pid'", :via => via, :as => as
      end
    end

    desc "Stops default resque worker"
    task :stop, :roles => :resque_worker_default do
      as = fetch(:runner, "app")
      via = fetch(:run_method, :sudo)
      rubber_env.resque_worker_default_count.times do |i|
        invoke_command "sh -c 'cd #{current_path} && kill `cat tmp/pids/resque_worker_default_#{i}.pid` && rm -f tmp/pids/resque_worker_default_#{i}.pid; exit 0;'", :via => via, :as => as
      end

      sleep 11 #wait for process to finish
    end

    desc "Restarts default resque worker"
    task :restart, :roles => :resque_worker_default do
      rubber.resque_worker_default.stop
      rubber.resque_worker_default.start
    end
  end

end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
axtro-rubber-1.2.3 generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb
axtro-rubber-1.2.2 generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb
rubber-1.3.2 generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb
rubber-1.3.1 generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb
rubber-1.3.0 generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb
rubber-1.2.1 generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb
axtro-rubber-1.2.1 generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb
axtro-rubber-1.2.0 generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb
rubber-1.2.0 generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb
nirvdrum-rubber-1.1.7 generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb
rubber-1.1.7 generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb