Class: DynoScaler::Manager
- Inherits:
-
Object
- Object
- DynoScaler::Manager
- Defined in:
- lib/dyno_scaler/manager.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #scale_down(options) ⇒ Object
- #scale_down? ⇒ Boolean
- #scale_up(options) ⇒ Object
- #scale_up? ⇒ Boolean
- #scale_with(options) ⇒ Object
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/dyno_scaler/manager.rb', line 5 def @options end |
Instance Method Details
#scale_down(options) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/dyno_scaler/manager.rb', line 21 def scale_down() return unless config.enabled? self. = scale_to(config.min_workers) if scale_down? end |
#scale_down? ⇒ Boolean
29 30 31 |
# File 'lib/dyno_scaler/manager.rb', line 29 def scale_down? [:workers] > config.min_workers && !pending_jobs? && !working_jobs? end |
#scale_up(options) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/dyno_scaler/manager.rb', line 7 def scale_up() return unless config.enabled? self. = scale_to(number_of_workers_needed) if scale_up? end |
#scale_up? ⇒ Boolean
15 16 17 18 19 |
# File 'lib/dyno_scaler/manager.rb', line 15 def scale_up? workers_needed = number_of_workers_needed pending_jobs? && workers_needed > [:workers] && workers_needed <= config.max_workers end |
#scale_with(options) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/dyno_scaler/manager.rb', line 33 def scale_with() return unless config.enabled? action = [:action] || action_for() send(action, ) if action end |