Class: RSpecTurbo::Executor
- Inherits:
-
Object
- Object
- RSpecTurbo::Executor
- Defined in:
- lib/rspec_turbo/executor.rb
Overview
Runs the planned batches across a fixed pool of slots: one Worker per free slot at a time, slots recycled as workers finish until the queue drains.
Renders a live multi-line dashboard on a TTY (per-worker spinner lines plus a global progress bar) and periodic single-line [progress] updates on CI.
Instance Attribute Summary collapse
-
#wall_started ⇒ Object
readonly
Returns the value of attribute wall_started.
Instance Method Summary collapse
-
#initialize(planner, display, rspec_options) ⇒ Executor
constructor
A new instance of Executor.
- #run ⇒ Object
Constructor Details
#initialize(planner, display, rspec_options) ⇒ Executor
Returns a new instance of Executor.
12 13 14 15 16 17 18 19 |
# File 'lib/rspec_turbo/executor.rb', line 12 def initialize(planner, display, ) @planner = planner @display = display @rspec_options = @labels = planner.batches.each_index.map { |i| format("worker/%02d", i + 1) } @slots = (1..planner.batches.size).to_a @total_examples = planner.counts.values.sum end |
Instance Attribute Details
#wall_started ⇒ Object (readonly)
Returns the value of attribute wall_started.
10 11 12 |
# File 'lib/rspec_turbo/executor.rb', line 10 def wall_started @wall_started end |
Instance Method Details
#run ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rspec_turbo/executor.rb', line 21 def run pending = Queue.new @planner.batches.each_with_index { |units, i| pending << [@labels[i], units] } results = [] @wall_started = Process.clock_gettime(Process::CLOCK_MONOTONIC) if Config::TTY run_tty(pending, results) else run_plain(pending, results) end results end |