| Class | AWS::EMR::JobFlowCollection |
| In: |
lib/aws/emr/job_flow_collection.rb
|
| Parent: | Object |
# Creating a Job Flow
Call {create} to run a new job flow.
emr = AWS::EMR.new
job_flow = emr.job_flows.create('name',
:instances => {
:instance_count => 2,
:master_instance_type => 'm1.small',
:slave_instance_type => 'm1.small',
}
)
# Getting a Job Flow
You can get a job flow by its ID.
job_flow = emr.job_flows['j-123456678'] # makes no request
job_flow.exists? #=> true/false
# Enumerating Job Flows
You can enumerate all job flows, or filter them.
# all job flows
job_flows.each {|job_flow| ... }
# only job flows with a particular state
job_flows.with_state('ENDED').each {|job_flow| ... }
The filtering methods include:
Runs a job flow.
job_flow = emr.job_flows.create('name',
:instances => {
:instance_count => 2,
:master_instance_type => 'm1.small',
:slave_instance_type => 'm1.small',
}
)
See {Client#run_job_flow} for documentation on the complete list of accepted options. @param [String] name @param [Hash] options @see (Client#run_job_flow) @return [JobFlow]
Returns a new collection that will only enumerate job flows that were created after the given time.
# enumerate jobs that are at most 1 hour old
emr.job_flows.created_after(Time.now - 3600).each{|job| ... }
@param [Time,DateTime,Date,Integer] time @return [JobFlowCollection]
Returns a new collection that will only enumerate job flows that were created before the given time.
# enumerate jobs that are more than an hour old
emr.job_flows.created_before(Time.now - 3600).each{|job| ... }
@param [Time,DateTime,Date,Integer] time @return [JobFlowCollection]
Returns a new collection that will only enumerate job flows that have one of the given ids.
emr.job_flows.with_id('id1', 'id2', 'id3').each do |job_flow|
# ...
end
@param [String] ids One or more job flow ids to use as a filter. @return [JobFlowCollection]
Returns a new collection that will only enumerate job flows that have one of the given job flow states.
emr.job_flows.with_state('SHUTTING_DOWN', 'TERMINATED').each do |job|
# ...
end
@param [String] states One or more job flow states to use as a filter. @return [JobFlowCollection]