Class: Bosh::Director::Scheduler
- Defined in:
- lib/bosh/director/scheduler.rb
Instance Method Summary collapse
-
#initialize(scheduled_jobs = [], options = {}) ⇒ Scheduler
constructor
A new instance of Scheduler.
- #logger ⇒ Object
- #start! ⇒ Object
- #stop! ⇒ Object
Constructor Details
#initialize(scheduled_jobs = [], options = {}) ⇒ Scheduler
Returns a new instance of Scheduler.
5 6 7 8 9 10 11 12 13 |
# File 'lib/bosh/director/scheduler.rb', line 5 def initialize(scheduled_jobs=[], ={}) if scheduled_jobs.nil? || scheduled_jobs.is_a?(Array) @scheduled_jobs = scheduled_jobs @scheduler = .fetch(:scheduler) { Rufus::Scheduler::PlainScheduler.new } @queue = .fetch(:queue) { JobQueue.new } else raise 'scheduled_jobs must be an array' end end |
Instance Method Details
#logger ⇒ Object
27 28 29 |
# File 'lib/bosh/director/scheduler.rb', line 27 def logger @logger ||= Config.logger end |
#start! ⇒ Object
15 16 17 18 19 20 |
# File 'lib/bosh/director/scheduler.rb', line 15 def start! logger.info('starting scheduler') add_jobs unless @added_already @scheduler.start @scheduler.join end |
#stop! ⇒ Object
22 23 24 25 |
# File 'lib/bosh/director/scheduler.rb', line 22 def stop! logger.info('stopping scheduler') @scheduler.stop end |