Class: Evilution::Parallel::WorkQueue::Dispatcher Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/parallel/work_queue/dispatcher.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: DeadlineTracker, RunResult

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workers:, items:, prefetch:, item_timeout:, worker_max_items:, recycle_factory:) ⇒ Dispatcher

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Dispatcher.



11
12
13
14
15
16
17
18
19
20
# File 'lib/evilution/parallel/work_queue/dispatcher.rb', line 11

def initialize(workers:, items:, prefetch:, item_timeout:, worker_max_items:, recycle_factory:)
  @workers = workers
  @items = items
  @prefetch = prefetch
  @worker_max_items = worker_max_items
  @recycle_factory = recycle_factory
  @state = Evilution::Parallel::WorkQueue.send(:const_get, :CollectionState).new(items.length)
  @retired = []
  @deadlines = DeadlineTracker.new(item_timeout:, workers: @workers)
end

Instance Attribute Details

#first_errorObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
# File 'lib/evilution/parallel/work_queue/dispatcher.rb', line 9

def first_error
  @first_error
end

Instance Method Details

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
25
26
27
# File 'lib/evilution/parallel/work_queue/dispatcher.rb', line 22

def run
  seed
  collect
  @first_error = @state.first_error
  RunResult.new(results: @state.results, retired: @retired)
end