Class: Delayed::Workless::Scaler::Local

Inherits:
Base
  • Object
show all
Defined in:
lib/workless/scalers/local.rb

Class Method Summary collapse

Methods inherited from Base

calculate_num_workers, jobs, num_workers_cache, num_workers_cache=, scale_info=

Class Method Details

.downObject



17
18
19
20
21
22
# File 'lib/workless/scalers/local.rb', line 17

def self.down
  unless jobs.count > 0 and workers > 0
    Rush::Box.new[Rails.root].bash("script/delayed_job stop -i workless", :background => true)
  end
  true
end

.upObject



9
10
11
12
13
14
15
# File 'lib/workless/scalers/local.rb', line 9

def self.up
  if self.workers == 0
    Rush::Box.new[Rails.root].bash("script/delayed_job start -i workless", :background => true)
    sleep 1
  end
  true
end

.workersObject



24
25
26
# File 'lib/workless/scalers/local.rb', line 24

def self.workers
  Rush::Box.new.processes.filter(:cmdline => /delayed_job start -i workless|delayed_job.workless/).size
end