Class: Evilution::Runner::MutationExecutor::Strategy::Parallel

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/runner/mutation_executor/strategy/parallel.rb

Constant Summary collapse

DIED_COMPACT =

Compact result for a worker that exited unexpectedly (:error is not cached, so the 0.0 duration is never persisted).

{
  status: :error,
  duration: 0.0,
  error_message: "worker process exited unexpectedly",
  error_class: "Evilution::Error"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(cache:, isolator:, packer:, pipeline:, notifier:, pool_factory:, config:, diagnostics: nil) ⇒ Parallel

Returns a new instance of Parallel.



16
17
18
19
20
21
22
23
24
25
# File 'lib/evilution/runner/mutation_executor/strategy/parallel.rb', line 16

def initialize(cache:, isolator:, packer:, pipeline:, notifier:, pool_factory:, config:, diagnostics: nil)
  @cache = cache
  @isolator = isolator
  @packer = packer
  @pipeline = pipeline
  @notifier = notifier
  @pool_factory = pool_factory
  @diagnostics = diagnostics
  @config = config
end

Instance Method Details

#call(mutations, baseline_result:, integration:) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/evilution/runner/mutation_executor/strategy/parallel.rb', line 27

def call(mutations, baseline_result:, integration:)
  @notifier.start(mutations.length)
  pool = @pool_factory.call
  state = { results: [], truncated: false, completed: 0 }
  all_worker_stats = run_batches(mutations, pool, baseline_result, integration, state)

  log_worker_diagnostics(all_worker_stats)
  @notifier.finish
  build_result(state)
end