class CircleCI::Parallel::Configuration::MasterNodeConfiguration
Attributes
@api private
@api private
@api private
@api private
Public Class Methods
@api private
# File lib/circleci/parallel/configuration/master_node_configuration.rb, line 11 def initialize @before_sync_hook = @before_download_hook = @after_download_hook = @after_sync_hook = Hook.new end
Public Instance Methods
Defines a callback that will be invoked on the master node after downloading all data from slave nodes.
@param chdir [Boolean] whether the callback should be invoked while changing the current
working directory to the download data directory.
@yieldparam download_data_dir [String] the path to the download data directory
@return [void]
@example
CircleCI::Parallel.configure do |config| config.on_master_node.after_download do merged_data = Dir['*/data.json'].each_with_object({}) do |path, merged_data| data = JSON.parse(File.read(path)) node_name = File.dirname(path) merged_data[node_name] = data end File.write('merged_data.json', JSON.generate(merged_data)) end end
@see CircleCI::Parallel.download_data_dir
# File lib/circleci/parallel/configuration/master_node_configuration.rb, line 75 def after_download(chdir: true, &block) @after_download_hook = Hook.new(block, chdir) end
Defines a callback that will be invoked on the master node after syncing all nodes.
@param chdir [Boolean] whether the callback should be invoked while changing the current
working directory to the local data directory.
@yieldparam local_data_dir [String] the path to the local data directory
@return [void]
@example
CircleCI::Parallel.configure do |config| config.on_master_node.after_sync do clean_some_intermediate_data end end
@see CircleCI::Parallel.local_data_dir
# File lib/circleci/parallel/configuration/master_node_configuration.rb, line 96 def after_sync(chdir: true, &block) @after_sync_hook = Hook.new(block, chdir) end
Defines a callback that will be invoked on the master node before downloading all data from slave nodes.
@param chdir [Boolean] whether the callback should be invoked while changing the current
working directory to the download data directory.
@yieldparam download_data_dir [String] the path to the download data directory
@return [void]
@see CircleCI::Parallel.download_data_dir
# File lib/circleci/parallel/configuration/master_node_configuration.rb, line 47 def before_download(chdir: true, &block) @before_download_hook = Hook.new(block, chdir) end
Defines a callback that will be invoked on the master node before syncing all nodes.
@param chdir [Boolean] whether the callback should be invoked while changing the current
working directory to the local data directory.
@yieldparam local_data_dir [String] the path to the local data directory
@return [void]
@example
CircleCI::Parallel.configure do |config| config.on_master_node.before_sync do File.write('data.json', JSON.generate(some_data)) end end
@see CircleCI::Parallel.local_data_dir
# File lib/circleci/parallel/configuration/master_node_configuration.rb, line 32 def before_sync(chdir: true, &block) @before_sync_hook = Hook.new(block, chdir) end