Class: DeepTest::ProcessOrchestrator
- Inherits:
-
Object
- Object
- DeepTest::ProcessOrchestrator
- Defined in:
- lib/deep_test/process_orchestrator.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options, workers, runner) ⇒ ProcessOrchestrator
constructor
A new instance of ProcessOrchestrator.
- #run(exit_when_done = true) ⇒ Object
- #shutdown(server) ⇒ Object
Constructor Details
#initialize(options, workers, runner) ⇒ ProcessOrchestrator
Returns a new instance of ProcessOrchestrator.
7 8 9 10 11 |
# File 'lib/deep_test/process_orchestrator.rb', line 7 def initialize(, workers, runner) @options = @runner = runner @workers = workers end |
Class Method Details
.run(options, workers, runner) ⇒ Object
3 4 5 |
# File 'lib/deep_test/process_orchestrator.rb', line 3 def self.run(, workers, runner) new(, workers, runner).run end |
Instance Method Details
#run(exit_when_done = true) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/deep_test/process_orchestrator.rb', line 13 def run(exit_when_done = true) passed = false begin server = Server.start(@options) @options.new_listener_list.before_starting_workers @workers.start_all begin DeepTest.logger.debug "Loader Starting (#{$$})" passed = @runner.process_work_units ensure shutdown(server) end ensure DeepTest.logger.debug "ProcessOrchestrator: Stopping Server" Server.stop end Kernel.exit(passed ? 0 : 1) if exit_when_done end |
#shutdown(server) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/deep_test/process_orchestrator.rb', line 34 def shutdown(server) DeepTest.logger.debug "ProcessOrchestrator: Shutting Down" server.done_with_work first_exception = $! begin DeepTest.logger.debug "ProcessOrchestrator: Stopping Workers" @workers.stop_all rescue DRb::DRbConnError # Workers must have already stopped rescue Exception => e raise first_exception || e end end |