Skip to content

Instantly share code, notes, and snippets.

@srockstyle
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save srockstyle/11304559 to your computer and use it in GitHub Desktop.

Select an option

Save srockstyle/11304559 to your computer and use it in GitHub Desktop.
Job_flowのaws-sdkを使った設定例 for Ruby
emr = AWS::EMR.new({
:access_key_id => AWS_ACCESS_KEY,
:secret_access_key => AWS_SECRET_KEY,
:region => "#{AWS_REGION}",
:emr_endpoint => "#{ENDPOINT_EMR}"
})
emr_result = emr.job_flows.create(
"#{BATCHNAME}", {
:log_uri => "s3://#{S3BUCKET}/batch_logs",
:ami_version => 'latest',
:instances => {
:ec2_key_name => "#{KEYFILE_ADDR}",
:instance_count => "#{INSTANCE_COUNT}",
:master_instance_type => "#{INSTANCE_TYPE}",
:slave_instance_type => "#{INSTANCE_TYPE}",
:termination_protected => false,
},
:steps =>
[{
:name => "#{BATCHNAME}",
:action_on_failure => 'CONTINUE',
:hadoop_jar_step => {
:jar => '/home/hadoop/contrib/streaming/hadoop-streaming.jar',
:args => [
"-mapper","ruby s3://#{S3BUCKET}/mapper/mapper.rb",
"-reducer","ruby s3://#{S3BUCKET}/reducer/reducer.rb",
"-input","s3://#{S3BUCKET}/#{BATCHNAME}/input",
"-output","s3://#{S3BUCKET}/#{BATCHNAME}/output",
]}}],
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment