class CircleCI::Parallel::Task::Master

@api private

Constants

Downloader

Public Instance Methods

run() click to toggle source
# File lib/circleci/parallel/task/master.rb, line 8
def run # rubocop:disable Metrics/AbcSize
  create_node_data_dir
  configuration.before_sync_hook.call(node.data_dir)
  mark_as_syncing
  configuration.before_download_hook.call(BASE_DATA_DIR)
  download_from_slave_nodes
  configuration.after_download_hook.call(BASE_DATA_DIR)
  configuration.after_sync_hook.call(node.data_dir)
  done
end

Private Instance Methods

download_from_slave_nodes() click to toggle source
# File lib/circleci/parallel/task/master.rb, line 21
def download_from_slave_nodes
  # TODO: Consider implementing timeout mechanism
  Parallel.puts('Waiting for slave nodes to be ready for download...')
  loop do
    downloaders.each(&:download)
    break if downloaders.all?(&:downloaded?)
    Kernel.sleep(1)
  end
end
downloaders() click to toggle source
# File lib/circleci/parallel/task/master.rb, line 31
def downloaders
  @downloaders ||= node.other_nodes.map { |other_node| Downloader.new(other_node) }
end