You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.

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.

Returns:

  • (String)

    the current value of ami_version



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

def ami_version
  @ami_version
end

#availability_zone_nameString (readonly)

Returns the current value of availability_zone_name

Returns:

  • (String)

    the current value of availability_zone_name



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

def availability_zone_name
  @availability_zone_name
end

#bootstrap_actionsArray<Hash> (readonly)

Returns the current value of bootstrap_actions

Returns:

  • (Array<Hash>)

    the current value of bootstrap_actions



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

def bootstrap_actions
  @bootstrap_actions
end

#created_atTime (readonly)

Returns the current value of created_at

Returns:

  • (Time)

    the current value of created_at



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

def created_at
  @created_at
end

#ec2_key_nameString (readonly)

Returns the current value of ec2_key_name

Returns:

  • (String)

    the current value of ec2_key_name



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

def ec2_key_name
  @ec2_key_name
end

#ec2_subnet_idString (readonly)

Returns the current value of ec2_subnet_id

Returns:

  • (String)

    the current value of ec2_subnet_id



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

def ec2_subnet_id
  @ec2_subnet_id
end

#ended_atTime (readonly)

Returns the current value of ended_at

Returns:

  • (Time)

    the current value of ended_at



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

def ended_at
  @ended_at
end

#hadoop_versionString (readonly)

Returns the current value of hadoop_version

Returns:

  • (String)

    the current value of hadoop_version



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

def hadoop_version
  @hadoop_version
end

#instance_countInteger (readonly)

Returns the current value of instance_count

Returns:

  • (Integer)

    the current value of instance_count



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

def instance_count
  @instance_count
end

#instance_group_detailsArray<Hash> (readonly)

Returns the current value of instance_group_details

Returns:

  • (Array<Hash>)

    the current value of instance_group_details



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

Returns:

  • (String)


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)

Returns the current value of keep_job_flow_alive_when_no_steps

Returns:

  • (Boolean)

    the current value of keep_job_flow_alive_when_no_steps



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)

Returns the current value of last_state_change_reason

Returns:

  • (String)

    the current value of last_state_change_reason



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.

Returns:

  • (String, nil)

    the current value of log_uri



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

def log_uri
  @log_uri
end

#master_instance_idString (readonly)

Returns the current value of master_instance_id

Returns:

  • (String)

    the current value of master_instance_id



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

def master_instance_id
  @master_instance_id
end

#master_instance_typeString (readonly)

Returns the current value of master_instance_type

Returns:

  • (String)

    the current value of master_instance_type



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)

Returns the current value of master_public_dns_name

Returns:

  • (String)

    the current value of master_public_dns_name



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.

Returns:

  • (String)

    the current value of name



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

def name
  @name
end

#normalized_instance_hoursInteger (readonly)

Returns the current value of normalized_instance_hours

Returns:

  • (Integer)

    the current value of normalized_instance_hours



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

def normalized_instance_hours
  @normalized_instance_hours
end

#ready_atTime (readonly)

Returns the current value of ready_at

Returns:

  • (Time)

    the current value of ready_at



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

def ready_at
  @ready_at
end

#slave_instance_idString (readonly)

Returns the current value of slave_instance_id

Returns:

  • (String)

    the current value of slave_instance_id



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

def slave_instance_id
  @slave_instance_id
end

#started_atTime (readonly)

Returns the current value of started_at

Returns:

  • (Time)

    the current value of started_at



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

def started_at
  @started_at
end

#stateString (readonly)

Returns the current value of state

Returns:

  • (String)

    the current value of state



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

def state
  @state
end

#step_detailsArray<Hash> (readonly)

Returns the current value of step_details

Returns:

  • (Array<Hash>)

    the current value of step_details



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.

Returns:

  • (Array<String>)

    the current value of supported_products



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

def supported_products
  @supported_products
end

#termination_protectedBoolean (readonly)

Returns the current value of termination_protected

Returns:

  • (Boolean)

    the current value of termination_protected



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' }
    ],
  }
}])
emr.job_flows['job-flow-id'].add_steps([{

Parameters:

  • steps (Array<Hash>)

    A list of one or more steps to add. Each step should be a hash with the following structure: * :name - required - (String) The name of the job flow step. * :action_on_failure - (String) Specifies the action to take if the job flow step fails. * :hadoop_jar_step - required - (Hash) Specifies the JAR file used for the job flow step. * :properties - (Array) A list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function. * :key - (String) The unique identifier of a key value pair. * :value - (String) The value part of the identified key. * :jar - required - (String) A path to a JAR file run during the step. * :main_class - (String) The name of the main class in the specified Java file. If not specified, the JAR file should specify a Main-Class in its manifest file. * :args - (Array) A list of command line arguments passed to the JAR file's main function when executed.

Returns:

  • (nil)


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

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?

Returns:



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.

Returns:

  • (nil)


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

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.

Returns:

  • (nil)


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

def enable_termination_protection
  set_termination_protection(true)
end

#exists?Boolean

Returns true if the job flow exists.

Returns:

  • (Boolean)

    Returns true if the job flow exists.



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

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

#instance_groupsInstanceGroupCollection



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

def instance_groups
  InstanceGroupCollection.new(self)
end

#master_instanceEC2::Instance?

Returns:



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

Parameters:

  • state (Boolean)

Returns:

  • (nil)


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

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

Parameters:

  • state (Boolean)

Returns:

  • (nil)


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

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?

Returns:



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.

Returns:

  • (nil)


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

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