class AWS::EMR::JobFlow

@attr_reader [String] name

The name of the job flow.

@attr_reader [String] ami_version

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

@attr_reader [String,nil] log_uri

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

@attr_reader [Array<String>] supported_products

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.

@attr_reader [Array<Hash>] bootstrap_actions

@attr_reader [String] state

@attr_reader [Time] created_at

@attr_reader [Time] started_at

@attr_reader [Time] ready_at

@attr_reader [Time] ended_at

@attr_reader [String] last_state_change_reason

@attr_reader [String] master_instance_type

@attr_reader [String] master_public_dns_name

@attr_reader [String] master_instance_id

@attr_reader [String] slave_instance_id

@attr_reader [Integer] instance_count

@attr_reader [Integer] normalized_instance_hours

@attr_reader [String] ec2_key_name

@attr_reader [String] ec2_subnet_id

@attr_reader [String] availability_zone_name

@attr_reader [Boolean] keep_job_flow_alive_when_no_steps

@attr_reader [Boolean] termination_protected

@attr_reader [String] hadoop_version

@attr_reader [Array<Hash>] instance_group_details

@attr_reader [Array<Hash>] step_details

Attributes

id[R]

@return [String]

job_flow_id[R]

@return [String]

Public Class Methods

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

@param [String] #job_flow_id @param [Hash] options @private

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

Public Instance Methods

add_steps(*steps) click to toggle source

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' }
    ],
  }
}])

@param [Array<Hash>] steps 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<Hash>) 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<String>) A list of command line arguments passed
    to the JAR file's main function when executed.

@return [nil]

# 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_zone() click to toggle source

@return [EC2::AvailabilityZone,nil]

# 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
delete()
Alias for: terminate
disable_termination_protection() click to toggle source

Removes a lock on this job flow so the Amazon EC2 instances in the cluster may be terminated. @return [nil]

# File lib/aws/emr/job_flow.rb, line 257
def disable_termination_protection
  set_termination_protection(false)
end
enable_termination_protection() click to toggle source

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. @return [nil]

# File lib/aws/emr/job_flow.rb, line 250
def enable_termination_protection
  set_termination_protection(true)
end
exists?() click to toggle source

@return [Boolean] Returns true if the job flow exists.

# File lib/aws/emr/job_flow.rb, line 290
def exists?
  !get_resource.data[:job_flows].empty?
end
instance_groups() click to toggle source

@return [InstanceGroupCollection]

# File lib/aws/emr/job_flow.rb, line 242
def instance_groups
  InstanceGroupCollection.new(self)
end
master_instance() click to toggle source

@return [EC2::Instance,nil]

# 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) click to toggle source

@param [Boolean] state @return [nil]

# 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) click to toggle source

@param [Boolean] state @return [nil]

# 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_instance() click to toggle source

@return [EC2::Instance,nil]

# 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
terminate() click to toggle source

Terminates the current job flow. @return [nil]

# File lib/aws/emr/job_flow.rb, line 283
def terminate
  client.terminate_job_flows(:job_flow_ids => [job_flow_id])
  nil
end
Also aliased as: delete

Protected Instance Methods

get_resource(attr = nil) click to toggle source
# File lib/aws/emr/job_flow.rb, line 300
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/job_flow.rb, line 296
def resource_identifiers
  [[:job_flow_id, job_flow_id]]
end