<commit_before>require 'helper'
class BenchmarkController < ApplicationController
  include Helper
  
  def generate
    
  end
  
  
  
  
  
  
  def run
    # get the url for benchmark profile, given by the user
    benchmark_profile_url = params[:benchmark_profile_url]
    
    logger.debug "***************************************************************"
    
    logger.debug "---------------------------------------------------------------"
    logger.debug "::: Downloading the benchmark profile from the given source:..."
    logger.debug "::: #{benchmark_profile_url}"
    logger.debug "---------------------------------------------------------------"
    benchmark_profile_path = "#{Rails.root}/chef-repo/.chef/tmp/benchmark_profiles.yaml"
    system "curl --location #{benchmark_profile_url} --output #{benchmark_profile_path} --silent"
    
    logger.debug "------------------------------------"
    logger.debug "::: Parsing the benchmark profile..."
    logger.debug "------------------------------------"
    benchmark_profiles = Psych.load(File.open benchmark_profile_path)
    
    # contain all keys of benchmark profiles
    # the keys are split in 2 groups
    # service key: service1, service2, etc...
    # profile key: profile1, profile2, etc...
    key_array = benchmark_profiles.keys<commit_msg>take values from the form<commit_after>require 'helper'
class BenchmarkController < ApplicationController
  include Helper
  
  def generate
    
    # test
    puts "SELECTED INSTANCE TYPE:"
    puts "Small: #{params[:instance_small]}"
    puts "Medium: #{params[:instance_medium]}"
    puts "High: #{params[:instance_high]}"
    
  end
  
  
  
  
  
  
  def run
    # get the url for benchmark profile, given by the user
    benchmark_profile_url = params[:benchmark_profile_url]
    
    logger.debug "***************************************************************"
    
    logger.debug "---------------------------------------------------------------"
    logger.debug "::: Downloading the benchmark profile from the given source:..."
    logger.debug "::: #{benchmark_profile_url}"
    logger.debug "---------------------------------------------------------------"
    benchmark_profile_path = "#{Rails.root}/chef-repo/.chef/tmp/benchmark_profiles.yaml"
    system "curl --location #{benchmark_profile_url} --output #{benchmark_profile_path} --silent"
    
    logger.debug "------------------------------------"
    logger.debug "::: Parsing the benchmark profile..."
    logger.debug "------------------------------------"
    benchmark_profiles = Psych.load(File.open benchmark_profile_path)
    
    # contain all keys of benchmark profiles
    # the keys are split in 2 groups
    # service key: service1, service2, etc...
    # profile key: profile1, profile2, etc...
    key_array = benchmark_profiles.keys
{'fraction_non_alphanumeric': 0.26879831342234717, 'fraction_numerical': 0.0035137034434293743, 'mean_word_length': 1.9502590673575129, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '658115', 'n_tokens_mistral': 729, 'n_tokens_neox': 713, 'n_words': 181}