Module: Taski::TestHelper::SchedulerExtension Private

Included in:
Execution::Scheduler
Defined in:
lib/taski/test_helper.rb

Overview

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

Module prepended to Scheduler to skip dependencies of mocked tasks.

Instance Method Summary collapse

Instance Method Details

#load_graph(dependency_graph, root_task_class) ⇒ Object

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.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/taski/test_helper.rb', line 41

def load_graph(dependency_graph, root_task_class)
  queue = [root_task_class]

  while (task_class = queue.shift)
    next if @task_states.key?(task_class)

    # Mocked tasks have no dependencies (isolates indirect dependencies)
    mock = MockRegistry.mock_for(task_class)
    deps = mock ? Set.new : dependency_graph.dependencies_for(task_class)
    @dependencies[task_class] = deps.dup
    @task_states[task_class] = Taski::Execution::Scheduler::STATE_PENDING
    @run_reverse_deps[task_class] ||= Set.new

    deps.each do |dep|
      @run_reverse_deps[dep] ||= Set.new
      @run_reverse_deps[dep].add(task_class)
      log_dependency_resolved(task_class, dep)
      queue << dep
    end
  end
end