Module: Humboldt::EmrFlow::InstanceGroupConfiguration
- Extended by:
- InstanceGroupConfiguration
- Included in:
- InstanceGroupConfiguration
- Defined in:
- lib/humboldt/emr_flow.rb
Constant Summary collapse
- INSTANCE_GROUPS =
TODO: add ‘task’ group when support is added for ‘tasks’
%w[master core].freeze
- MASTER_INSTANCE_TYPE =
'm1.small'.freeze
- DEFAULT_CORE_INSTANCE_TYPE =
'c1.xlarge'.freeze
- DEFAULT_BID_PRICE =
'0.2'.freeze
- DEFAULT_CORE_INSTANCE_COUNT =
4
- INSTANCE_TYPE_MAPPINGS =
{ 'master' => MASTER_INSTANCE_TYPE, 'core' => DEFAULT_CORE_INSTANCE_TYPE }.freeze
- INSTANCE_COUNT_MAPPINGS =
{ 'master' => 1, 'core' => DEFAULT_CORE_INSTANCE_COUNT }.freeze
Instance Method Summary collapse
- #base_configuration(group) ⇒ Object
- #configure_market(group, configuration, spot_instances, bid_price) ⇒ Object
- #configure_type_and_count(group, configuration, options = {}) ⇒ Object
- #create(options) ⇒ Object
Instance Method Details
#base_configuration(group) ⇒ Object
165 166 167 |
# File 'lib/humboldt/emr_flow.rb', line 165 def base_configuration(group) {:name => "#{group.capitalize} Group", :instance_role => group.upcase} end |
#configure_market(group, configuration, spot_instances, bid_price) ⇒ Object
179 180 181 182 183 184 185 186 |
# File 'lib/humboldt/emr_flow.rb', line 179 def configure_market(group, configuration, spot_instances, bid_price) if spot_instances && (spot_instances.empty? || spot_instances.include?(group)) configuration[:market] = 'SPOT' configuration[:bid_price] = bid_price || DEFAULT_BID_PRICE else configuration[:market] = 'ON_DEMAND' end end |
#configure_type_and_count(group, configuration, options = {}) ⇒ Object
169 170 171 172 173 174 175 176 177 |
# File 'lib/humboldt/emr_flow.rb', line 169 def configure_type_and_count(group, configuration, = {}) if group == 'core' configuration[:instance_type] = [:instance_type] configuration[:instance_count] = [:instance_count] end configuration[:instance_type] ||= INSTANCE_TYPE_MAPPINGS[group] configuration[:instance_count] ||= INSTANCE_COUNT_MAPPINGS[group] end |
#create(options) ⇒ Object
188 189 190 191 192 193 194 195 |
# File 'lib/humboldt/emr_flow.rb', line 188 def create() INSTANCE_GROUPS.map do |group| configuration = base_configuration(group) configure_type_and_count(group, configuration, ) configure_market(group, configuration, [:spot_instances], [:bid_price]) configuration end end |