<commit_before>
module CORL
module Action
class Build < Plugin::CloudAction
 
  #-----------------------------------------------------------------------------
  # Settings
  
  def configure
    super do
      codes :network_failure
    end
  end
  
  #-----------------------------------------------------------------------------
  # Operations
   
  def execute
    super do |node, network|
      if network && node
        profiles     = array(node[:profiles])
        provisioners = {}
        
        # Compose needed provisioners and profiles
        profiles.each do |profile|
          info = Plugin::Provisioner.translate_reference(profile)
          
          if info
            provider = info[:provider]
            
            provisioners[provider] = { :profiles => [] } unless provisioners.has_key?(providers)
            provisioners[provider][:profiles] += info[:profiles]
          end
        end
                
        unless provisioners.empty?
          build_directory = File.join(network.directory, 'build')
          
          FileUtils.rm_rf(build_directory)
          FileUtils.mkdir(build_directory)
          
          provisioners.each do |provider, node_profiles|
            provider_build_directory = File.join(build_directory, provider)
            
            provisioners = node.provisioners(provider)
            
            if provisioners
              provisioners.each do |name, provisioner|
                dbg(name, 'name')
                dbg(provisioner, 'provisioner')
                #provisioner.build(provider_build_directory)
              end
            end
          end
        end        
      else
        myself.status = code.network_failure
      end
    end
  end
end
end
end<commit_msg>Initial implementation of the build action provider (provisioning not yet completed).<commit_after>
module CORL
module Action
class Build < Plugin::CloudAction
 
  #-----------------------------------------------------------------------------
  # Settings
  
  def configure
    super do
      codes :network_failure
    end
  end
  
  #-----------------------------------------------------------------------------
  # Operations
   
  def execute
    super do |node, network|
      if network && node
        profiles     = array(node[:profiles])
        provisioners = {}
        
        # Compose needed provisioners and profiles
        profiles.each do |profile|
          info = Plugin::Provisioner.translate_reference(profile)
          
          if info
            provider = info[:provider]
            
            provisioners[provider] = { :profiles => [] } unless provisioners.has_key?(providers)
            provisioners[provider][:profiles] += info[:profiles]
          end
        end
                
        unless provisioners.empty?
          build_directory = File.join(network.directory, 'build')
          
          FileUtils.rm_rf(build_directory)
          FileUtils.mkdir(build_directory)
          
          provisioners.each do |provider, node_profiles|
            provider_build_directory = File.join(build_directory, provider)
            
            if provisioners = node.provisioners(provider)
              provisioners.each do |name, provisioner|
                provisioner.build(provider_build_directory)
              end
            end
          end
        end        
      else
        myself.status = code.network_failure
      end
    end
  end
end
end
end
{'fraction_non_alphanumeric': 0.1518037518037518, 'fraction_numerical': 0.0, 'mean_word_length': 1.3450608930987822, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1171579', 'n_tokens_mistral': 817, 'n_tokens_neox': 818, 'n_words': 188}