class AWS::EMR::InstanceGroup

@attr_reader [String] market

@attr_reader [String] instance_role

@attr_reader [String,nil] bid_price

@attr_reader [String] instance_type

@attr_reader [String] instance_request_count

@attr_reader [String] instance_running_count

@attr_reader [String] state

@attr_reader [String] last_state_change_reason

@attr_reader [Time] created_at

@attr_reader [Time] started_at

@attr_reader [Time] ready_at

@attr_reader [Time] ended_at

Attributes

id[R]

@return [String]

instance_group_id[R]

@return [String]

job_flow[R]

@return [JobFlow]

Public Class Methods

new(job_flow, instance_group_id, options = {}) click to toggle source

@private

Calls superclass method AWS::Core::Resource::new
# File lib/aws/emr/instance_group.rb, line 44
def initialize job_flow, instance_group_id, options = {}
  @job_flow = job_flow
  @instance_group_id = instance_group_id
  super
end

Public Instance Methods

exists?() click to toggle source

@return [Boolean] Returns true if the instance group exists.

# File lib/aws/emr/instance_group.rb, line 108
def exists?
  !!find_in_response(get_resource)
end
modify(options = {}) click to toggle source

@param [Hash] options @option options [Integer] :count The new target size for the

instance group.

@return [nil]

# File lib/aws/emr/instance_group.rb, line 100
def modify options = {}
  options[:instance_group_id] = instance_group_id
  options[:instance_count] = options.delete(:count) if options[:count]
  client.modify_instance_groups(:instance_groups => [options])
  nil
end
set_instance_count(count) click to toggle source

Modifies the target size of this instance group. @param [Integer] count @return (see modify)

# File lib/aws/emr/instance_group.rb, line 92
def set_instance_count count
  modify(:instance_count => count)
end

Protected Instance Methods

find_in_response(resp) click to toggle source
# File lib/aws/emr/instance_group.rb, line 122
def find_in_response resp
  data = nil
  resp.data[:job_flows].each do |job|
    if job[:job_flow_id] == job_flow.job_flow_id
      job[:instances][:instance_groups].each do |ig|
        if ig[:instance_group_id] == instance_group_id
          data = ig
        end
      end
    end
  end
  data
end
get_resource(attr = nil) click to toggle source
# File lib/aws/emr/instance_group.rb, line 118
def get_resource attr = nil
  client.describe_job_flows(:job_flow_ids => [job_flow.id])
end
resource_identifiers() click to toggle source
# File lib/aws/emr/instance_group.rb, line 114
def resource_identifiers
  [[:job_flow_id, job_flow.id], [:instance_group_id, id]]
end