Class: Bas::Orchestrator::Manager
- Inherits:
-
Object
- Object
- Bas::Orchestrator::Manager
- Defined in:
- lib/bas/orchestrator/manager.rb
Overview
Manager class responsible for scheduling and executing scripts concurrently.
This class initializes a thread pool and processes scheduled scripts based on time intervals, specific days, or exact times.
rubocop:disable Metrics/ClassLength
Instance Method Summary collapse
-
#initialize(schedules) ⇒ Manager
constructor
A new instance of Manager.
- #run ⇒ Object
Constructor Details
#initialize(schedules) ⇒ Manager
Returns a new instance of Manager.
16 17 18 19 20 |
# File 'lib/bas/orchestrator/manager.rb', line 16 def initialize(schedules) @last_executions = Hash.new(0.0) @schedules = schedules @pool = Concurrent::FixedThreadPool.new(@schedules.size) end |
Instance Method Details
#run ⇒ Object
22 23 24 25 26 27 |
# File 'lib/bas/orchestrator/manager.rb', line 22 def run @schedules.each { |script| @pool.post { process_script(script) } } @pool.shutdown @pool.wait_for_termination end |