| Class | Uttk::Strategies::Pool |
| In: |
lib/uttk/strategies/Pool.rb
|
| Parent: | Collection |
I‘m a collection of strategies and I run all of them in a separated thread.
# File lib/uttk/strategies/Pool.rb, line 27 def abort_hook return if defined? @already_aborted @already_aborted = true @pool_contents.each do |comp| test = comp.test next if test.status.is_a? StartStatus test.abort('pool aborted') if test.running? end super end
# File lib/uttk/strategies/Pool.rb, line 84 def epilogue @pool_contents.each do |comp| comp.flow << :not_running? @log << comp.log end @pool_upper.up @pool_contents.each do |comp| comp.thread.kill if comp.thread.alive? comp.flow.destroy end @pool_contents.clear super end
# File lib/uttk/strategies/Pool.rb, line 40 def prologue super @pool_upper = @log.new_node :contents, :ordered => true path = @log.path @pool_contents = @contents.map do |test| comp = PoolComponent.new comp.test = test comp.log = Filters::Saver.new comp.flow = @symtbl[:flow_factory].new_flow test.symtbl[:flow] = comp.flow comp.thread = Thread.new do begin sleep new_log = Logger.new(comp.log) new_log.chpath(path) run_test(test, new_log) rescue Exception => ex display_unexpected_exc ex end end comp end # This thread is here to catch properly exceptions. @real_parent_thread = @thread @thread = Thread.new do begin sleep rescue Exception => ex abort_hook() @real_parent_thread.raise ex end end end