Class: DeepTest::ResultReader
- Inherits:
-
Object
- Object
- DeepTest::ResultReader
- Defined in:
- lib/deep_test/result_reader.rb
Instance Method Summary collapse
-
#initialize(blackboard) ⇒ ResultReader
constructor
A new instance of ResultReader.
- #read(original_work_units_by_id) ⇒ Object
Constructor Details
#initialize(blackboard) ⇒ ResultReader
Returns a new instance of ResultReader.
3 4 5 |
# File 'lib/deep_test/result_reader.rb', line 3 def initialize(blackboard) @blackboard = blackboard end |
Instance Method Details
#read(original_work_units_by_id) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/deep_test/result_reader.rb', line 7 def read(original_work_units_by_id) work_units_by_id = original_work_units_by_id.dup errors = 0 begin until errors == work_units_by_id.size Thread.pass result = @blackboard.take_result next if result.nil? if Worker::Error === result puts result errors += 1 else if result.respond_to?(:output) && (output = result.output) print output end work_unit = work_units_by_id.delete(result.identifier) yield [work_unit, result] end end rescue Server::ResultOverdueError DeepTest.logger.error("Results are overdue from server, ending run") end work_units_by_id end |