earth 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/features/{data_center_company.feature → computation_carrier.feature} +5 -5
  2. data/features/computation_carrier_instance_class.feature +24 -0
  3. data/features/support/imports/{data_center_company_bad.csv → computation_carrier_bad.csv} +0 -0
  4. data/features/support/imports/{data_center_company_good.csv → computation_carrier_good.csv} +0 -0
  5. data/features/support/imports/computation_carrier_instance_class_bad.csv +2 -0
  6. data/features/support/imports/computation_carrier_instance_class_good.csv +2 -0
  7. data/lib/earth/computation.rb +3 -4
  8. data/lib/earth/computation/computation_carrier.rb +10 -0
  9. data/lib/earth/computation/computation_carrier/data_miner.rb +22 -0
  10. data/lib/earth/computation/computation_carrier_instance_class.rb +17 -0
  11. data/lib/earth/computation/computation_carrier_instance_class/data_miner.rb +37 -0
  12. data/lib/earth/computation/computation_carrier_region.rb +13 -0
  13. data/lib/earth/computation/computation_carrier_region/data_miner.rb +21 -0
  14. data/lib/earth/computation/data_miner.rb +3 -4
  15. data/lib/earth/locality/egrid_region.rb +2 -1
  16. data/lib/earth/locality/egrid_subregion.rb +2 -1
  17. data/lib/earth/version.rb +1 -1
  18. data/spec/earth/bus/bus_class_spec.rb +5 -3
  19. data/spec/earth_spec.rb +2 -2
  20. metadata +22 -36
  21. data/features/computation_platform.feature +0 -14
  22. data/features/server_type.feature +0 -34
  23. data/features/server_type_alias.feature +0 -14
  24. data/features/support/imports/computation_platform_bad.csv +0 -3
  25. data/features/support/imports/computation_platform_good.csv +0 -3
  26. data/features/support/imports/server_type_alias_bad.csv +0 -3
  27. data/features/support/imports/server_type_alias_good.csv +0 -3
  28. data/features/support/imports/server_type_bad.csv +0 -3
  29. data/features/support/imports/server_type_good.csv +0 -3
  30. data/lib/earth/computation/computation_platform.rb +0 -9
  31. data/lib/earth/computation/computation_platform/data_miner.rb +0 -24
  32. data/lib/earth/computation/data_center_company.rb +0 -7
  33. data/lib/earth/computation/data_center_company/data_miner.rb +0 -22
  34. data/lib/earth/computation/server_type.rb +0 -9
  35. data/lib/earth/computation/server_type/data_miner.rb +0 -49
  36. data/lib/earth/computation/server_type_alias.rb +0 -10
  37. data/lib/earth/computation/server_type_alias/data_miner.rb +0 -30
@@ -1,14 +1,14 @@
1
- Feature: Data import for DataCenterCompany
1
+ Feature: Data import for ComputationCarrier
2
2
  As a data user
3
- I want to import DataCenterCompany data
4
- So that I can perform data center company-based calculations
3
+ I want to import ComputationCarrier data
4
+ So that I can perform computation carrier-based calculations
5
5
 
6
6
  Scenario: Successfully verifying that power usage effectiveness >= 1.0
7
- Given a "DataCenterCompany" data import fetches results listed in "data_center_company_good"
7
+ Given a "ComputationCarrier" data import fetches results listed in "computation_carrier_good"
8
8
  When a data import verifies "Power usage effectiveness should be one or more"
9
9
  Then the verification should be successful
10
10
 
11
11
  Scenario: Failing to verify that power usage effectiveness >= 1.0
12
- Given a "DataCenterCompany" data import fetches results listed in "data_center_company_bad"
12
+ Given a "ComputationCarrier" data import fetches results listed in "computation_carrier_bad"
13
13
  When a data import verifies "Power usage effectiveness should be one or more"
14
14
  Then the verification should not be successful
@@ -0,0 +1,24 @@
1
+ Feature: Data import for ComputationCarrierInstanceClass
2
+ As a data user
3
+ I want to import ComputationCarrierInstanceClass data
4
+ So that I can perform computation carrier instance class-based calculations
5
+
6
+ Scenario: Successfully verifying that electricity intensity is more than zero
7
+ Given a "ComputationCarrierInstanceClass" data import fetches results listed in "computation_carrier_instance_class_good"
8
+ When a data import verifies "Electricity intensity should be more than zero"
9
+ Then the verification should be successful
10
+
11
+ Scenario: Successfully verifying that electricity intensity units are kilowatts
12
+ Given a "ComputationCarrierInstanceClass" data import fetches results listed in "computation_carrier_instance_class_good"
13
+ When a data import verifies "Electricity intensity units should be kilowatts"
14
+ Then the verification should be successful
15
+
16
+ Scenario: Failing to verify that electricity intensity is more than zero
17
+ Given a "ComputationCarrierInstanceClass" data import fetches results listed in "computation_carrier_instance_class_bad"
18
+ When a data import verifies "Electricity intensity should be more than zero"
19
+ Then the verification should not be successful
20
+
21
+ Scenario: Failing to verify that electricity intensity units are kilowatts
22
+ Given a "ComputationCarrierInstanceClass" data import fetches results listed in "computation_carrier_instance_class_bad"
23
+ When a data import verifies "Electricity intensity units should be kilowatts"
24
+ Then the verification should not be successful
@@ -0,0 +1,2 @@
1
+ name,computation_carrier_name,electricity_intensity,electricity_intensity_units
2
+ Amazon m1.small,Amazon,0.0,joules
@@ -0,0 +1,2 @@
1
+ name,computation_carrier_name,electricity_intensity,electricity_intensity_units
2
+ Amazon m1.small,Amazon,1.0,kilowatts
@@ -1,4 +1,3 @@
1
- require 'earth/computation/computation_platform'
2
- require 'earth/computation/data_center_company'
3
- require 'earth/computation/server_type'
4
- require 'earth/computation/server_type_alias'
1
+ require 'earth/computation/computation_carrier'
2
+ require 'earth/computation/computation_carrier_region'
3
+ require 'earth/computation/computation_carrier_instance_class'
@@ -0,0 +1,10 @@
1
+ class ComputationCarrier < ActiveRecord::Base
2
+ set_primary_key :name
3
+
4
+ falls_back_on :name => 'fallback',
5
+ :power_usage_effectiveness => lambda { ComputationCarrier.maximum('power_usage_effectiveness') }
6
+
7
+ data_miner do
8
+ tap "Brighter Planet's computation carrier data", Earth.taps_server
9
+ end
10
+ end
@@ -0,0 +1,22 @@
1
+ ComputationCarrier.class_eval do
2
+ data_miner do
3
+ schema Earth.database_options do
4
+ string 'name'
5
+ float 'power_usage_effectiveness'
6
+ end
7
+
8
+ import "a list of computation carriers and their power usage effectiveness",
9
+ :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdFlxZVZLai01WWJOOTFiaUd1blF6VkE&gid=0&output=csv' do
10
+ key 'name'
11
+ store 'power_usage_effectiveness'
12
+ end
13
+
14
+ verify "Power usage effectiveness should be one or more" do
15
+ ComputationCarrier.all.each do |carrier|
16
+ unless carrier.power_usage_effectiveness >= 1.0
17
+ raise "Invalid power usage effectiveness for ComputationCarrier #{carrier.name}: #{carrier.power_usage_effectiveness} (should be >= 1.0)"
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ class ComputationCarrierInstanceClass < ActiveRecord::Base
2
+ set_primary_key :name
3
+
4
+ belongs_to :computation_carrier, :foreign_key => 'computation_carrier_name'
5
+
6
+ falls_back_on :name => 'fallback',
7
+ :electricity_intensity => lambda { ComputationCarrierInstanceClass.find_by_name('Amazon m1.small').electricity_intensity },
8
+ :electricity_intensity_units => lambda { ComputationCarrierInstanceClass.find_by_name('Amazon m1.small').electricity_intensity_units }
9
+
10
+ data_miner do
11
+ tap "Brighter Planet's computation carrier instance class data", Earth.taps_server
12
+
13
+ process "Pull dependencies" do
14
+ run_data_miner_on_belongs_to_associations
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,37 @@
1
+ ComputationCarrierInstanceClass.class_eval do
2
+ data_miner do
3
+ schema Earth.database_options do
4
+ string 'name'
5
+ string 'computation_carrier_name'
6
+ string 'instance_class'
7
+ float 'electricity_intensity'
8
+ string 'electricity_intensity_units'
9
+ end
10
+
11
+ import "a list of computation carrier instance classes and their characteristics",
12
+ :url => 'https://spreadsheets.google.com/pub?key=0AkCJNpm9Ks6JdGExaW1ic2c0d2s1ZmpzeUdOa2kyRlE&gid=0&output=csv' do
13
+ key 'name'
14
+ store 'computation_carrier_name'
15
+ store 'instance_class'
16
+ store 'electricity_intensity', :units_field_name => 'electricity_intensity_units'
17
+ end
18
+
19
+ # FIXME TODO verify that computation carrier name appears in computation_carriers
20
+
21
+ verify "Electricity intensity should be more than zero" do
22
+ ComputationCarrierInstanceClass.all.each do |instance_class|
23
+ unless instance_class.electricity_intensity > 0
24
+ raise "Invalid electricity intensity for ComputationCarrierInstanceClass #{instance_class.name}: #{instance_class.electricity_intensity} (should be > 0)"
25
+ end
26
+ end
27
+ end
28
+
29
+ verify "Electricity intensity units should be kilowatts" do
30
+ ComputationCarrierInstanceClass.all.each do |instance_class|
31
+ unless instance_class.electricity_intensity_units == 'kilowatts'
32
+ raise "Invalid electricity intensity units for ComputationCarrierInstanceClass #{instance_class.name}: #{instance_class.electricity_intensity_units} (should be kilowatts)"
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,13 @@
1
+ class ComputationCarrierRegion < ActiveRecord::Base
2
+ set_primary_key :name
3
+
4
+ belongs_to :egrid_subregion, :foreign_key => 'egrid_subregion_abbreviation'
5
+
6
+ data_miner do
7
+ tap "Brighter Planet's computation carrier region data", Earth.taps_server
8
+
9
+ process "Pull dependencies" do
10
+ run_data_miner_on_belongs_to_associations
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ ComputationCarrierRegion.class_eval do
2
+ data_miner do
3
+ schema Earth.database_options do
4
+ string 'name'
5
+ string 'computation_carrier_name'
6
+ string 'region'
7
+ string 'egrid_subregion_abbreviation'
8
+ end
9
+
10
+ import "a list of computation carrier regions",
11
+ :url => 'https://spreadsheets.google.com/pub?key=0AkCJNpm9Ks6JdGFEU1gtVzFPeS0tV1VnR05WZ2ZFUVE&gid=0&output=csv' do
12
+ key 'name'
13
+ store 'computation_carrier_name'
14
+ store 'region'
15
+ store 'egrid_subregion_abbreviation'
16
+ end
17
+
18
+ # FIXME TODO verify carrier_name appears in Carrier
19
+ # FIXME TODO verify egrid_subregion_abbreviation appears in EgridSubregion
20
+ end
21
+ end
@@ -1,4 +1,3 @@
1
- require 'earth/computation/computation_platform/data_miner'
2
- require 'earth/computation/data_center_company/data_miner'
3
- require 'earth/computation/server_type/data_miner'
4
- require 'earth/computation/server_type_alias/data_miner'
1
+ require 'earth/computation/computation_carrier/data_miner'
2
+ require 'earth/computation/computation_carrier_region/data_miner'
3
+ require 'earth/computation/computation_carrier_instance_class/data_miner'
@@ -12,5 +12,6 @@ class EgridRegion < ActiveRecord::Base
12
12
  end
13
13
 
14
14
  # FIXME TODO someday should calculate this from eGRID data: (USTNGN05 + USTNFI05 - USTCON05) / USTNGN05
15
- falls_back_on :loss_factor => 0.061879 # calculated using above formula 2/21/2011
15
+ falls_back_on :name => 'fallback',
16
+ :loss_factor => 0.061879 # calculated using above formula 2/21/2011
16
17
  end
@@ -10,7 +10,8 @@ class EgridSubregion < ActiveRecord::Base
10
10
  end
11
11
  end
12
12
 
13
- falls_back_on :egrid_region => lambda { EgridSubregion.fallback_egrid_region },
13
+ falls_back_on :name => 'fallback',
14
+ :egrid_region => lambda { EgridSubregion.fallback_egrid_region },
14
15
  :electricity_co2_emission_factor => lambda { weighted_average(:electricity_co2_emission_factor, :weighted_by => :net_generation) },
15
16
  :electricity_co2_emission_factor_units => 'kilograms_per_kilowatt_hour',
16
17
  :electricity_co2_biogenic_emission_factor => lambda { weighted_average(:electricity_co2_biogenic_emission_factor, :weighted_by => :net_generation) },
@@ -1,3 +1,3 @@
1
1
  module Earth
2
- VERSION = "0.4.8"
2
+ VERSION = "0.4.9"
3
3
  end
@@ -5,8 +5,10 @@ describe 'BusFuel' do
5
5
  Earth.init :bus, :fuel, :apply_schemas => true
6
6
  end
7
7
 
8
- it 'is related to fuels' do
9
- BusFuel.run_data_miner!
10
- BusFuel.last.fuel.should_not be_nil
8
+ describe 'import', :slow => true do
9
+ it 'is related to fuels' do
10
+ BusFuel.run_data_miner!
11
+ BusFuel.last.fuel.should_not be_nil
12
+ end
11
13
  end
12
14
  end
@@ -23,7 +23,7 @@ describe Earth do
23
23
  describe '.resources' do
24
24
  it 'should get a list of resources' do
25
25
  resources = Earth.resources
26
- resources.keys.count.should == 76
26
+ resources.keys.count.should == 75
27
27
  resources['FuelType'][:domain].should == 'fuel'
28
28
  end
29
29
  it 'should exclude data_miner files' do
@@ -33,7 +33,7 @@ describe Earth do
33
33
 
34
34
  describe '.resource_names' do
35
35
  it 'should get a list of all resource names' do
36
- Earth.resource_names.count.should == 76
36
+ Earth.resource_names.count.should == 75
37
37
  Earth.resource_names.should include('Aircraft')
38
38
  Earth.resource_names.should include('Industry')
39
39
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 8
9
- version: 0.4.8
8
+ - 9
9
+ version: 0.4.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Seamus Abshere
@@ -249,16 +249,14 @@ files:
249
249
  - features/bus_fuel.feature
250
250
  - features/carrier.feature
251
251
  - features/carrier_mode.feature
252
- - features/computation_platform.feature
253
- - features/data_center_company.feature
252
+ - features/computation_carrier.feature
253
+ - features/computation_carrier_instance_class.feature
254
254
  - features/egrid_region.feature
255
255
  - features/egrid_subregion.feature
256
256
  - features/flight_segment.feature
257
257
  - features/fuel_year.feature
258
258
  - features/greenhouse_gas.feature
259
259
  - features/rail_class.feature
260
- - features/server_type.feature
261
- - features/server_type_alias.feature
262
260
  - features/shipment_mode.feature
263
261
  - features/step_definitions/data_steps.rb
264
262
  - features/support/env.rb
@@ -300,10 +298,10 @@ files:
300
298
  - features/support/imports/carrier_good.csv
301
299
  - features/support/imports/carrier_mode_bad.csv
302
300
  - features/support/imports/carrier_mode_good.csv
303
- - features/support/imports/computation_platform_bad.csv
304
- - features/support/imports/computation_platform_good.csv
305
- - features/support/imports/data_center_company_bad.csv
306
- - features/support/imports/data_center_company_good.csv
301
+ - features/support/imports/computation_carrier_bad.csv
302
+ - features/support/imports/computation_carrier_good.csv
303
+ - features/support/imports/computation_carrier_instance_class_bad.csv
304
+ - features/support/imports/computation_carrier_instance_class_good.csv
307
305
  - features/support/imports/egrid_region_bad.csv
308
306
  - features/support/imports/egrid_region_good.csv
309
307
  - features/support/imports/egrid_subregion_bad.csv
@@ -316,10 +314,6 @@ files:
316
314
  - features/support/imports/greenhouse_gas_good.csv
317
315
  - features/support/imports/rail_class_bad.csv
318
316
  - features/support/imports/rail_class_good.csv
319
- - features/support/imports/server_type_alias_bad.csv
320
- - features/support/imports/server_type_alias_good.csv
321
- - features/support/imports/server_type_bad.csv
322
- - features/support/imports/server_type_good.csv
323
317
  - features/support/imports/shipment_mode_bad.csv
324
318
  - features/support/imports/shipment_mode_good.csv
325
319
  - lib/earth.rb
@@ -389,15 +383,13 @@ files:
389
383
  - lib/earth/bus/bus_fuel_year_control/data_miner.rb
390
384
  - lib/earth/bus/data_miner.rb
391
385
  - lib/earth/computation.rb
392
- - lib/earth/computation/computation_platform.rb
393
- - lib/earth/computation/computation_platform/data_miner.rb
394
- - lib/earth/computation/data_center_company.rb
395
- - lib/earth/computation/data_center_company/data_miner.rb
386
+ - lib/earth/computation/computation_carrier.rb
387
+ - lib/earth/computation/computation_carrier/data_miner.rb
388
+ - lib/earth/computation/computation_carrier_instance_class.rb
389
+ - lib/earth/computation/computation_carrier_instance_class/data_miner.rb
390
+ - lib/earth/computation/computation_carrier_region.rb
391
+ - lib/earth/computation/computation_carrier_region/data_miner.rb
396
392
  - lib/earth/computation/data_miner.rb
397
- - lib/earth/computation/server_type.rb
398
- - lib/earth/computation/server_type/data_miner.rb
399
- - lib/earth/computation/server_type_alias.rb
400
- - lib/earth/computation/server_type_alias/data_miner.rb
401
393
  - lib/earth/conversions_ext.rb
402
394
  - lib/earth/data_miner.rb
403
395
  - lib/earth/diet.rb
@@ -562,7 +554,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
562
554
  requirements:
563
555
  - - ">="
564
556
  - !ruby/object:Gem::Version
565
- hash: -4098503984188126677
557
+ hash: -1989203883064114868
566
558
  segments:
567
559
  - 0
568
560
  version: "0"
@@ -571,7 +563,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
571
563
  requirements:
572
564
  - - ">="
573
565
  - !ruby/object:Gem::Version
574
- hash: -4098503984188126677
566
+ hash: -1989203883064114868
575
567
  segments:
576
568
  - 0
577
569
  version: "0"
@@ -602,16 +594,14 @@ test_files:
602
594
  - features/bus_fuel.feature
603
595
  - features/carrier.feature
604
596
  - features/carrier_mode.feature
605
- - features/computation_platform.feature
606
- - features/data_center_company.feature
597
+ - features/computation_carrier.feature
598
+ - features/computation_carrier_instance_class.feature
607
599
  - features/egrid_region.feature
608
600
  - features/egrid_subregion.feature
609
601
  - features/flight_segment.feature
610
602
  - features/fuel_year.feature
611
603
  - features/greenhouse_gas.feature
612
604
  - features/rail_class.feature
613
- - features/server_type.feature
614
- - features/server_type_alias.feature
615
605
  - features/shipment_mode.feature
616
606
  - features/step_definitions/data_steps.rb
617
607
  - features/support/env.rb
@@ -653,10 +643,10 @@ test_files:
653
643
  - features/support/imports/carrier_good.csv
654
644
  - features/support/imports/carrier_mode_bad.csv
655
645
  - features/support/imports/carrier_mode_good.csv
656
- - features/support/imports/computation_platform_bad.csv
657
- - features/support/imports/computation_platform_good.csv
658
- - features/support/imports/data_center_company_bad.csv
659
- - features/support/imports/data_center_company_good.csv
646
+ - features/support/imports/computation_carrier_bad.csv
647
+ - features/support/imports/computation_carrier_good.csv
648
+ - features/support/imports/computation_carrier_instance_class_bad.csv
649
+ - features/support/imports/computation_carrier_instance_class_good.csv
660
650
  - features/support/imports/egrid_region_bad.csv
661
651
  - features/support/imports/egrid_region_good.csv
662
652
  - features/support/imports/egrid_subregion_bad.csv
@@ -669,10 +659,6 @@ test_files:
669
659
  - features/support/imports/greenhouse_gas_good.csv
670
660
  - features/support/imports/rail_class_bad.csv
671
661
  - features/support/imports/rail_class_good.csv
672
- - features/support/imports/server_type_alias_bad.csv
673
- - features/support/imports/server_type_alias_good.csv
674
- - features/support/imports/server_type_bad.csv
675
- - features/support/imports/server_type_good.csv
676
662
  - features/support/imports/shipment_mode_bad.csv
677
663
  - features/support/imports/shipment_mode_good.csv
678
664
  - spec/earth/air/aircraft_spec.rb
@@ -1,14 +0,0 @@
1
- Feature: Data import for ComputationPlatform
2
- As a data user
3
- I want to import ComputationPlatform data
4
- So that I can perform computation platform-based calculations
5
-
6
- Scenario: Successfully verifying that data center company name is never missing
7
- Given a "ComputationPlatform" data import fetches results listed in "computation_platform_good"
8
- When a data import verifies "Data center company name should never be missing"
9
- Then the verification should be successful
10
-
11
- Scenario: Failing to verify that data center company name is never missing
12
- Given a "ComputationPlatform" data import fetches results listed in "computation_platform_bad"
13
- When a data import verifies "Data center company name should never be missing"
14
- Then the verification should not be successful
@@ -1,34 +0,0 @@
1
- Feature: Data import for ServerType
2
- As a data user
3
- I want to import ServerType data
4
- So that I can perform server type-based calculations
5
-
6
- Scenario: Successfully verifying that data center company name is never missing
7
- Given a "ServerType" data import fetches results listed in "server_type_good"
8
- When a data import verifies "Data center company name should never be missing"
9
- Then the verification should be successful
10
-
11
- Scenario: Successfully verifying that electricity draw is more than zero
12
- Given a "ServerType" data import fetches results listed in "server_type_good"
13
- When a data import verifies "Electricity draw should be more than zero"
14
- Then the verification should be successful
15
-
16
- Scenario: Successfully verifying that electricity draw units are kilowatts
17
- Given a "ServerType" data import fetches results listed in "server_type_good"
18
- When a data import verifies "Electricity draw units should be kilowatts"
19
- Then the verification should be successful
20
-
21
- Scenario: Failing to verify that data center company name is never missing
22
- Given a "ServerType" data import fetches results listed in "server_type_bad"
23
- When a data import verifies "Data center company name should never be missing"
24
- Then the verification should not be successful
25
-
26
- Scenario: Failing to verify that electricity draw is more than zero
27
- Given a "ServerType" data import fetches results listed in "server_type_bad"
28
- When a data import verifies "Electricity draw should be more than zero"
29
- Then the verification should not be successful
30
-
31
- Scenario: Failing to verify that electricity draw units are kilowatts
32
- Given a "ServerType" data import fetches results listed in "server_type_bad"
33
- When a data import verifies "Electricity draw units should be kilowatts"
34
- Then the verification should not be successful
@@ -1,14 +0,0 @@
1
- Feature: Data import for ServerTypeAlias
2
- As a data user
3
- I want to import ServerTypeAlias data
4
- So that I can perform server type alias-based calculations
5
-
6
- Scenario: Successfully verifying that server type name and platform name are never missing
7
- Given a "ServerTypeAlias" data import fetches results listed in "server_type_alias_good"
8
- When a data import verifies "Server type name and platform name should never be missing"
9
- Then the verification should be successful
10
-
11
- Scenario: Failing to verify that server type name and platform name are never missing
12
- Given a "ServerTypeAlias" data import fetches results listed in "server_type_alias_bad"
13
- When a data import verifies "Server type name and platform name should never be missing"
14
- Then the verification should not be successful
@@ -1,3 +0,0 @@
1
- name,data_center_company_name
2
- Heroku,Amazon
3
- Engine Yard
@@ -1,3 +0,0 @@
1
- name,data_center_company_name
2
- Heroku,Amazon
3
- Engine Yard,Amazon
@@ -1,3 +0,0 @@
1
- name,server_type_name,platform_name
2
- Fugu,Normal,Heroku
3
- Large
@@ -1,3 +0,0 @@
1
- name,server_type_name,platform_name
2
- Fugu,Normal,Heroku
3
- Large,Large,Engine Yard
@@ -1,3 +0,0 @@
1
- name,memory,memory_units,cpu,cpu_units,electricity_draw,electricity_draw_units,data_center_company_name
2
- Normal,1.7,gigabytes,1,ec2_compute_units,2.3,kilowatts,Amazon
3
- Large,7.5,gigabytes,4,ec2_compute_units,0,gigawatts
@@ -1,3 +0,0 @@
1
- name,data_center_company_name,memory,memory_units,cpu,cpu_units,electricity_draw,electricity_draw_units
2
- Normal,Amazon,1.7,gigabytes,1,ec2_compute_units,2.3,kilowatts
3
- Large,Amazon,1.7,gigabytes,1,ec2_compute_units,4.0,kilowatts
@@ -1,9 +0,0 @@
1
- class ComputationPlatform < ActiveRecord::Base
2
- set_primary_key :name
3
-
4
- belongs_to :data_center_company, :foreign_key => 'data_center_company_name'
5
-
6
- data_miner do
7
- tap "Brighter Planet's computation platform data", Earth.taps_server
8
- end
9
- end
@@ -1,24 +0,0 @@
1
- ComputationPlatform.class_eval do
2
- data_miner do
3
- schema Earth.database_options do
4
- string 'name'
5
- string 'data_center_company_name'
6
- end
7
-
8
- import "a list of computation platforms and the data center company they use",
9
- :url => 'https://spreadsheets.google.com/pub?key=0AkCJNpm9Ks6JdG5zVER5THhXRlE4N0RXTklVaS03Ymc&gid=0&gid=0&output=csv' do
10
- key 'name'
11
- store 'data_center_company_name'
12
- end
13
-
14
- verify "Data center company name should never be missing" do
15
- ComputationPlatform.all.each do |platform|
16
- unless platform.data_center_company_name.present?
17
- raise "Invalid data center company name for DataCenterCompany #{platform.name}: #{platform.data_center_company_name}"
18
- end
19
- end
20
- end
21
-
22
- # FIXME TODO verify that all data center company names appear in data_center_companies
23
- end
24
- end
@@ -1,7 +0,0 @@
1
- class DataCenterCompany < ActiveRecord::Base
2
- set_primary_key :name
3
-
4
- data_miner do
5
- tap "Brighter Planet's data center company data", Earth.taps_server
6
- end
7
- end
@@ -1,22 +0,0 @@
1
- DataCenterCompany.class_eval do
2
- data_miner do
3
- schema Earth.database_options do
4
- string 'name'
5
- float 'power_usage_effectiveness'
6
- end
7
-
8
- import "a list of data center companies and their power usage effectiveness",
9
- :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdFlxZVZLai01WWJOOTFiaUd1blF6VkE&hl=en&gid=0&output=csv' do
10
- key 'name'
11
- store 'power_usage_effectiveness'
12
- end
13
-
14
- verify "Power usage effectiveness should be one or more" do
15
- DataCenterCompany.all.each do |company|
16
- unless company.power_usage_effectiveness >= 1.0
17
- raise "Invalid power usage effectiveness for DataCenterCompany #{company.name}: #{company.power_usage_effectiveness} (should be >= 1.0)"
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,9 +0,0 @@
1
- class ServerType < ActiveRecord::Base
2
- set_primary_key :name
3
-
4
- belongs_to :data_center_company, :foreign_key => 'data_center_company_name'
5
-
6
- data_miner do
7
- tap "Brighter Planet's server type data", Earth.taps_server
8
- end
9
- end
@@ -1,49 +0,0 @@
1
- ServerType.class_eval do
2
- data_miner do
3
- schema Earth.database_options do
4
- string 'name'
5
- string 'data_center_company_name'
6
- float 'cpu'
7
- string 'cpu_units'
8
- float 'memory'
9
- string 'memory_units'
10
- float 'electricity_draw'
11
- string 'electricity_draw_units'
12
- end
13
-
14
- import "a list of server types and their characteristics",
15
- :url => 'https://spreadsheets.google.com/pub?key=0AkCJNpm9Ks6JdGExaW1ic2c0d2s1ZmpzeUdOa2kyRlE&hl=en&gid=0&output=csv' do
16
- key 'name'
17
- store 'data_center_company_name'
18
- store 'cpu', :units_field_name => 'cpu_units'
19
- store 'memory', :units_field_name => 'memory_units'
20
- store 'electricity_draw', :units_field_name => 'electricity_draw_units'
21
- end
22
-
23
- # FIXME TODO verify that data center company name appears in data_center_companies
24
-
25
- verify "Data center company name should never be missing" do
26
- ServerType.all.each do |server|
27
- unless server.data_center_company_name.present?
28
- raise "Invalid data center company name for ServerType #{server.name}: #{server.data_center_company_name}"
29
- end
30
- end
31
- end
32
-
33
- verify "Electricity draw should be more than zero" do
34
- ServerType.all.each do |server|
35
- unless server.electricity_draw > 0
36
- raise "Invalid electricity draw for ServerType #{server.name}: #{server.electricity_draw} (should be > 0)"
37
- end
38
- end
39
- end
40
-
41
- verify "Electricity draw units should be kilowatts" do
42
- ServerType.all.each do |server|
43
- unless server.electricity_draw_units == 'kilowatts'
44
- raise "Invalid electricity draw units for ServerType #{server.name}: #{server.electricity_draw_units} (should be kilowatts)"
45
- end
46
- end
47
- end
48
- end
49
- end
@@ -1,10 +0,0 @@
1
- class ServerTypeAlias < ActiveRecord::Base
2
- set_primary_key :name
3
-
4
- belongs_to :server_type, :foreign_key => 'server_type_name'
5
- belongs_to :platform, :foreign_key => 'platform_name', :class_name => 'ComputationPlatform'
6
-
7
- data_miner do
8
- tap "Brighter Planet's server type data", Earth.taps_server
9
- end
10
- end
@@ -1,30 +0,0 @@
1
- ServerTypeAlias.class_eval do
2
- data_miner do
3
- schema Earth.database_options do
4
- string 'name'
5
- string 'server_type_name'
6
- string 'platform_name'
7
- end
8
-
9
- import "a list of server type aliases and their characteristics",
10
- :url => 'https://spreadsheets.google.com/pub?key=0AkCJNpm9Ks6JdDdkVlBzSUYweFN0OHBreEN6YTdTZ3c&hl=en&gid=0&output=csv' do
11
- key 'name', :field_name => 'alias'
12
- store 'server_type_name'
13
- store 'platform_name'
14
- end
15
-
16
- # FIXME TODO verify that server type name appears in server_types
17
- # FIXME TODO verify that platform name appears in computation_platforms
18
-
19
- verify "Server type name and platform name should never be missing" do
20
- ServerTypeAlias.all.each do |server_alias|
21
- [:server_type_name, :platform_name].each do |x|
22
- test_item = server_alias.send(x)
23
- unless test_item.present?
24
- raise "Invalid #{x} for ServerTypeAlias #{server_alias.name}: #{test_item}"
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end