Class: AWS::EMR::JobFlow

Inherits:
Core::Resource
  • Object
show all
Defined in:
lib/aws/emr/job_flow.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ami_versionString (readonly)

The version of the AMI used to initialize Amazon EC2 instances in the job flow.



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def ami_version
  @ami_version
end

#availability_zone_nameString (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def availability_zone_name
  @availability_zone_name
end

#bootstrap_actionsArray<Hash> (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def bootstrap_actions
  @bootstrap_actions
end

#created_atTime (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def created_at
  @created_at
end

#ec2_key_nameString (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def ec2_key_name
  @ec2_key_name
end

#ec2_subnet_idString (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def ec2_subnet_id
  @ec2_subnet_id
end

#ended_atTime (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def ended_at
  @ended_at
end

#hadoop_versionString (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def hadoop_version
  @hadoop_version
end

#instance_countInteger (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def instance_count
  @instance_count
end

#instance_group_detailsArray<Hash> (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def instance_group_details
  @instance_group_details
end

#job_flow_idString (readonly) Also known as: id



86
87
88
# File 'lib/aws/emr/job_flow.rb', line 86

def job_flow_id
  @job_flow_id
end

#keep_job_flow_alive_when_no_stepsBoolean (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def keep_job_flow_alive_when_no_steps
  @keep_job_flow_alive_when_no_steps
end

#last_state_change_reasonString (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def last_state_change_reason
  @last_state_change_reason
end

#log_uriString? (readonly)

The location in Amazon S3 where log files for the job are stored.



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def log_uri
  @log_uri
end

#master_instance_idString (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def master_instance_id
  @master_instance_id
end

#master_instance_typeObject (readonly)

attributes from :instances



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def master_instance_type
  @master_instance_type
end

#master_public_dns_nameString (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def master_public_dns_name
  @master_public_dns_name
end

#nameString (readonly)

The name of the job flow.



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def name
  @name
end

#normalized_instance_hoursInteger (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def normalized_instance_hours
  @normalized_instance_hours
end

#ready_atTime (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def ready_at
  @ready_at
end

#slave_instance_idString (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def slave_instance_id
  @slave_instance_id
end

#started_atTime (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def started_at
  @started_at
end

#stateObject (readonly)

attributes from :execution_status_detail



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def state
  @state
end

#step_detailsArray<Hash> (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def step_details
  @step_details
end

#supported_productsArray<String> (readonly)

A list of strings set by third party software when the job flow is launched. If you are not using third party software to manage the job flow this value is empty.



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def supported_products
  @supported_products
end

#termination_protectedBoolean (readonly)



75
76
77
# File 'lib/aws/emr/job_flow.rb', line 75

def termination_protected
  @termination_protected
end

Instance Method Details

#add_steps(*steps) ⇒ nil

Adds one (or more) steps to the current job flow.

emr.job_flows['job-flow-id'].add_steps([{
  :name => 'step-name',
  :action_on_failure => 'TERMINATE_JOB_FLOW',
  :hadoop_jar_step => {
    :jar => 'path/to/a/jar/file',
    :main_class => 'MainClassName',
    :args => %w(arg1 arg2 arg3)],
    :properties => [
      { :key => 'property-1-name', :value => 'property-1-value' }
      { :key => 'property-2-name', :value => 'property-2-value' }
    ],
  }
}])


233
234
235
236
237
238
239
# File 'lib/aws/emr/job_flow.rb', line 233

def add_steps *steps
  options = {}
  options[:job_flow_id] = job_flow_id
  options[:steps] = steps.flatten
  client.add_job_flow_steps(options)
  nil
end

#availability_zoneEC2::AvailabilityZone?



189
190
191
192
193
# File 'lib/aws/emr/job_flow.rb', line 189

def availability_zone
  if name = availability_zone_name
    AWS::EC2.new(:config => config).availability_zones[name]
  end
end

#disable_termination_protectionnil

Removes a lock on this job flow so the Amazon EC2 instances in the cluster may be terminated.



257
258
259
# File 'lib/aws/emr/job_flow.rb', line 257

def disable_termination_protection
  set_termination_protection(false)
end

#enable_termination_protectionnil

Locks this job flow so the Amazon EC2 instances in the cluster cannot be terminated by user intervention, an API call, or in the event of a job-flow error.



250
251
252
# File 'lib/aws/emr/job_flow.rb', line 250

def enable_termination_protection
  set_termination_protection(true)
end

#exists?Boolean



290
291
292
# File 'lib/aws/emr/job_flow.rb', line 290

def exists?
  !get_resource.data[:job_flows].empty?
end

#instance_groupsInstanceGroupCollection



242
243
244
# File 'lib/aws/emr/job_flow.rb', line 242

def instance_groups
  InstanceGroupCollection.new(self)
end

#master_instanceEC2::Instance?



175
176
177
178
179
# File 'lib/aws/emr/job_flow.rb', line 175

def master_instance
  if instance_id = master_instance_id
    AWS::EC2.new(:config => config).instances[instance_id]
  end
end

#set_termination_protection(state) ⇒ nil



263
264
265
266
267
268
269
# File 'lib/aws/emr/job_flow.rb', line 263

def set_termination_protection state
  options = {}
  options[:termination_protected] = state
  options[:job_flow_ids] = [job_flow_id]
  client.set_termination_protection(options)
  nil
end

#set_visible_to_all_users(state) ⇒ nil



273
274
275
276
277
278
279
# File 'lib/aws/emr/job_flow.rb', line 273

def set_visible_to_all_users state
  options = {}
  options[:visible_to_all_users] = state
  options[:job_flow_ids] = [job_flow_id]
  client.set_visible_to_all_users(options)
  nil
end

#slave_instanceEC2::Instance?



182
183
184
185
186
# File 'lib/aws/emr/job_flow.rb', line 182

def slave_instance
  if instance_id = slave_instance_id
    AWS::EC2.new(:config => config).instances[instance_id]
  end
end

#terminatenil Also known as: delete

Terminates the current job flow.



283
284
285
286
# File 'lib/aws/emr/job_flow.rb', line 283

def terminate
  client.terminate_job_flows(:job_flow_ids => [job_flow_id])
  nil
end