Sha256: a21f8472d8fe4ee4a36d2184fb3d895f899752fe46fd59eca464ca8e345019be

Contents?: true

Size: 1.56 KB

Versions: 7

Compression:

Stored size: 1.56 KB

Contents

require 'test_queue'
require 'test_queue/runner'

module TestQueue
  class Runner
    class Sample < Runner
      def spawn_workers
        puts "Spawning #@concurrency workers"
        super
      end

      def after_fork(num)
        puts "  -- worker #{num} booted as pid #{$$}"
        super
      end

      def run_worker(iterator)
        sum = 0
        iterator.each do |item|
          puts "  #{item.inspect}"
          sum += item
        end
        sum
      end

      def summarize_worker(worker)
        stats.update(worker.stats)

        worker.summary  = worker.output.scan(/^\s*(\d+)/).join(', ')
        worker.failure_output = ''
      end
    end
  end
end

if __FILE__ == $0
  TestQueue::Runner::Sample.new(Array(1..10)).execute
end

__END__

Spawning 4 workers
  -- worker 0 booted as pid 40406
  -- worker 1 booted as pid 40407
  -- worker 2 booted as pid 40408
  -- worker 3 booted as pid 40409

==> Starting ruby test-queue worker [1] (40407)

  2
  5
  8

==> Starting ruby test-queue worker [3] (40409)


==> Starting ruby test-queue worker [2] (40408)

  3
  6
  9

==> Starting ruby test-queue worker [0] (40406)

  1
  4
  7
  10

==> Summary

    [1]                                                 2, 5, 8      in 0.0024s      (pid 40407 exit 15)
    [3]                                                              in 0.0036s      (pid 40409 exit 0)
    [2]                                                 3, 6, 9      in 0.0038s      (pid 40408 exit 18)
    [0]                                             1, 4, 7, 10      in 0.0044s      (pid 40406 exit 22)

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
test-queue-split-0.3.2 lib/test_queue/runner/sample.rb
test-queue-split-0.3.1 lib/test_queue/runner/sample.rb
test-queue-split-0.3.0 lib/test_queue/runner/sample.rb
test-queue-0.2.13 lib/test_queue/runner/sample.rb
test-queue-0.2.12 lib/test_queue/runner/sample.rb
test-queue-0.2.11 lib/test_queue/runner/sample.rb
test-queue-0.2.10 lib/test_queue/runner/sample.rb