Sha256: 902079f63ab87258638f9b01cd1e8204dbbccf8718562fa7cc871518305a2426

Contents?: true

Size: 891 Bytes

Versions: 24

Compression:

Stored size: 891 Bytes

Contents

module DeepTest
  class ResultReader
    def initialize(blackboard)
      @blackboard = blackboard
    end

    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
  end
end

Version data entries

24 entries across 24 versions & 4 rubygems

Version Path
jason-o-matic-deep_test-1.2.2.1 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.10 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.11 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.12 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.13 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.14 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.2 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.3 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.4 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.5 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.6 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.7 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.8 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.9 lib/deep_test/result_reader.rb
jperkins-deep_test-1.2.2 lib/deep_test/result_reader.rb
jason-o-matic-deep_test-1.2.2.15 lib/deep_test/result_reader.rb
jstorimer-deep-test-1.4.0 lib/deep_test/result_reader.rb
jstorimer-deep-test-1.3.0 lib/deep_test/result_reader.rb
jstorimer-deep-test-1.2.0 lib/deep_test/result_reader.rb
jstorimer-deep-test-1.1.0 lib/deep_test/result_reader.rb