<commit_before>#!/usr/bin/env ruby

require 'sequel'
require 'amazon-pricing'

DB = Sequel.connect(ENV['DATABASE_URL'])

price_list = AwsPricing::PriceList.new

for region in price_list.regions
  for instance_type in region.ec2_on_demand_instance_types
    DB[:instance_ondemand_pricing].insert(
      :region => region.name, :instance_type => instance_type.api_name,
      :price => instance_type.linux_price_per_hour * 1000
    )
  end
end

exit


typemap = 
  {"clusterGPUI"=>{"xxxxl"=>"cg1.4xlarge"},
 "hiMemODI"=>{"xxl"=>"m2.2xlarge", "xl"=>"m2.xlarge", "xxxxl"=>"m2.4xlarge"},
 "stdODI"=> {"sm"=>"m1.small", "med"=>"m1.medium", "lg"=>"m1.large", "xl"=>"m1.xlarge"},
 "hiCPUODI"=>{"med"=>"c1.medium", "xl"=>"c1.xlarge"},
 "uODI"=>{"u"=>"t1.micro"},
 "clusterComputeI"=>{"xxxxl"=>"cc1.4xlarge", "xxxxxxxxl"=>"cc2.8xlarge"},<commit_msg>Map regions from pricing table to regions as used in the API<commit_after>#!/usr/bin/env ruby

require 'sequel'
require 'amazon-pricing'

DB = Sequel.connect(ENV['DATABASE_URL'])

price_list = AwsPricing::PriceList.new

regionmap = {
  "us-east" => "us-east-1",
  "apac-tokyo" => "ap-northeast-1",
  "sa-east-1" => "sa-east-1",
  "apac-sin" => "ap-southeast-1",
  "us-west-2" => "us-west-2",
  "us-west" => "us-west-1",
  "eu-ireland" => "eu-west-1"
}

for region in price_list.regions
  for instance_type in region.ec2_on_demand_instance_types
    DB[:instance_ondemand_pricing].insert(
      :region => regionmap[region.name], :instance_type => instance_type.api_name,
      :price => instance_type.linux_price_per_hour * 1000
    )
  end
end

exit


typemap = 
  {"clusterGPUI"=>{"xxxxl"=>"cg1.4xlarge"},
 "hiMemODI"=>{"xxl"=>"m2.2xlarge", "xl"=>"m2.xlarge", "xxxxl"=>"m2.4xlarge"},
 "stdODI"=> {"sm"=>"m1.small", "med"=>"m1.medium", "lg"=>"m1.large", "xl"=>"m1.xlarge"},
 "hiCPUODI"=>{"med"=>"c1.medium", "xl"=>"c1.xlarge"},
 "uODI"=>{"u"=>"t1.micro"},
 "clusterComputeI"=>{"xxxxl"=>"cc1.4xlarge", "xxxxxxxxl"=>"cc2.8xlarge"},
{'fraction_non_alphanumeric': 0.23158963941086846, 'fraction_numerical': 0.027932960893854747, 'mean_word_length': 5.459016393442623, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '3168659', 'n_tokens_mistral': 890, 'n_tokens_neox': 856, 'n_words': 113}