elasticity 0.6 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mediawiki +33 -11
- data/lib/elasticity.rb +1 -0
- data/lib/elasticity/emr.rb +100 -15
- data/lib/elasticity/job_flow.rb +8 -2
- data/lib/elasticity/job_flow_step.rb +32 -0
- data/lib/elasticity/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/add_jobflow_steps/add_multiple_steps.yml +252 -0
- data/spec/lib/elasticity/emr_spec.rb +131 -0
- data/spec/lib/elasticity/job_flow_spec.rb +27 -7
- data/spec/lib/elasticity/job_flow_step_spec.rb +61 -0
- metadata +9 -4
data/README.mediawiki
CHANGED
@@ -54,7 +54,29 @@ Some combinations of the options will be rejected by Amazon and some once-valid
|
|
54
54
|
|
55
55
|
== AddJobFlowSteps ==
|
56
56
|
|
57
|
-
|
57
|
+
AddJobFlowSteps adds the specified steps to the specified job flow.
|
58
|
+
|
59
|
+
<pre>
|
60
|
+
emr = Elasticity::EMR.new(ENV["AWS_ACCESS_KEY_ID"], ENV["AWS_SECRET_KEY"])
|
61
|
+
jobflow_id = emr.run_job_flow(...)
|
62
|
+
emr.add_jobflow_steps(jobflow_id, {
|
63
|
+
:steps => [
|
64
|
+
{
|
65
|
+
:action_on_failure => "TERMINATE_JOB_FLOW",
|
66
|
+
:hadoop_jar_step => {
|
67
|
+
:args => [
|
68
|
+
"s3://elasticmapreduce/libs/pig/pig-script",
|
69
|
+
"--base-path",
|
70
|
+
"s3://elasticmapreduce/libs/pig/",
|
71
|
+
"--install-pig"
|
72
|
+
],
|
73
|
+
:jar => "s3://elasticmapreduce/libs/script-runner/script-runner.jar"
|
74
|
+
},
|
75
|
+
:name => "Setup Pig"
|
76
|
+
}
|
77
|
+
]
|
78
|
+
})
|
79
|
+
</pre>
|
58
80
|
|
59
81
|
== DescribeJobFlows ==
|
60
82
|
|
@@ -119,9 +141,9 @@ RunJobFlow creates and starts a new job flow. Specifying the arguments to RunJo
|
|
119
141
|
:hadoop_jar_step => {
|
120
142
|
:args => [
|
121
143
|
"s3://elasticmapreduce/libs/pig/pig-script",
|
122
|
-
|
123
|
-
|
124
|
-
|
144
|
+
"--base-path",
|
145
|
+
"s3://elasticmapreduce/libs/pig/",
|
146
|
+
"--install-pig"
|
125
147
|
],
|
126
148
|
:jar => "s3://elasticmapreduce/libs/script-runner/script-runner.jar"
|
127
149
|
},
|
@@ -132,13 +154,13 @@ RunJobFlow creates and starts a new job flow. Specifying the arguments to RunJo
|
|
132
154
|
:hadoop_jar_step => {
|
133
155
|
:args => [
|
134
156
|
"s3://elasticmapreduce/libs/pig/pig-script",
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
157
|
+
"--run-pig-script",
|
158
|
+
"--args",
|
159
|
+
"-p",
|
160
|
+
"INPUT=s3n://elasticmapreduce/samples/pig-apache/input",
|
161
|
+
"-p",
|
162
|
+
"OUTPUT=s3n://slif-elasticity/pig-apache/output/2011-04-19",
|
163
|
+
"s3n://elasticmapreduce/samples/pig-apache/do-reports.pig"
|
142
164
|
],
|
143
165
|
:jar => "s3://elasticmapreduce/libs/script-runner/script-runner.jar"
|
144
166
|
},
|
data/lib/elasticity.rb
CHANGED
data/lib/elasticity/emr.rb
CHANGED
@@ -20,20 +20,19 @@ module Elasticity
|
|
20
20
|
# not all of these options are required (or valid!) at once. Please see the
|
21
21
|
# EMR docs for details although even then you're going to need to experiment :)
|
22
22
|
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
23
|
+
# instance_group_config = {
|
24
|
+
# :bid_price => 5,
|
25
|
+
# :instance_count => 1,
|
26
|
+
# :instance_role => "TASK",
|
27
|
+
# :market => "SPOT",
|
28
|
+
# :name => "Go Canucks Go!"
|
29
|
+
# :type => "m1.small",
|
30
|
+
# }
|
31
31
|
#
|
32
|
-
# add_instance_groups takes an array of {}.
|
33
|
-
#
|
34
|
-
# Returns an array of the instance IDs that were created by the specified configs.
|
32
|
+
# add_instance_groups takes an array of {}. Returns an array of the instance IDs
|
33
|
+
# that were created by the specified configs.
|
35
34
|
#
|
36
|
-
#
|
35
|
+
# ["ig-2GOVEN6HVJZID", "ig-1DU9M2UQMM051", "ig-3DZRW4Y2X4S", ...]
|
37
36
|
def add_instance_groups(jobflow_id, instance_group_configs)
|
38
37
|
params = {
|
39
38
|
:operation => "AddInstanceGroups",
|
@@ -55,6 +54,38 @@ module Elasticity
|
|
55
54
|
end
|
56
55
|
end
|
57
56
|
|
57
|
+
# Add a step (or steps) to the specified job flow.
|
58
|
+
#
|
59
|
+
# emr.add_jobflow_step("j-123", {
|
60
|
+
# :steps => [
|
61
|
+
# {
|
62
|
+
# :action_on_failure => "TERMINATE_JOB_FLOW",
|
63
|
+
# :hadoop_jar_step => {
|
64
|
+
# :args => [
|
65
|
+
# "s3://elasticmapreduce/libs/pig/pig-script",
|
66
|
+
# "--base-path",
|
67
|
+
# "s3://elasticmapreduce/libs/pig/",
|
68
|
+
# "--install-pig"
|
69
|
+
# ],
|
70
|
+
# :jar => "s3://elasticmapreduce/libs/script-runner/script-runner.jar"
|
71
|
+
# },
|
72
|
+
# :name => "Setup Pig"
|
73
|
+
# }
|
74
|
+
# ]
|
75
|
+
# })
|
76
|
+
def add_jobflow_steps(jobflow_id, steps_config)
|
77
|
+
params = {
|
78
|
+
:operation => "AddJobFlowSteps",
|
79
|
+
:job_flow_id => jobflow_id
|
80
|
+
}.merge!(steps_config)
|
81
|
+
begin
|
82
|
+
aws_result = @aws_request.aws_emr_request(EMR.convert_ruby_to_aws(params))
|
83
|
+
yield aws_result if block_given?
|
84
|
+
rescue RestClient::BadRequest => e
|
85
|
+
raise ArgumentError, EMR.parse_error_response(e.http_body)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
58
89
|
# Set the number of instances in the specified instance groups to the
|
59
90
|
# specified counts. Note that this modifies the *request* count, which
|
60
91
|
# is not the same as the *running* count. I.e. you request instances
|
@@ -62,7 +93,7 @@ module Elasticity
|
|
62
93
|
#
|
63
94
|
# Takes a {} of instance group IDs => desired instance count.
|
64
95
|
#
|
65
|
-
#
|
96
|
+
# {"ig-1" => 40, "ig-2" => 5, ...}
|
66
97
|
def modify_instance_groups(instance_group_config)
|
67
98
|
params = {
|
68
99
|
:operation => "ModifyInstanceGroups",
|
@@ -76,7 +107,61 @@ module Elasticity
|
|
76
107
|
end
|
77
108
|
end
|
78
109
|
|
79
|
-
#
|
110
|
+
# Start a job flow with the specified configuration. This is a very thin
|
111
|
+
# wrapper around the AWS API, so in order to use it directly you'll need
|
112
|
+
# to have the PDF API reference handy, which can be found here:
|
113
|
+
#
|
114
|
+
# http://awsdocs.s3.amazonaws.com/ElasticMapReduce/20090331/emr-api-20090331.pdf
|
115
|
+
#
|
116
|
+
# Here is a sample job flow configuration that should help. This job flow
|
117
|
+
# starts by installing Pig then running a Pig script. It is based off of the
|
118
|
+
# Pig demo script from Amazon.
|
119
|
+
#
|
120
|
+
# emr.run_job_flow({
|
121
|
+
# :name => "Elasticity Test Flow (EMR Pig Script)",
|
122
|
+
# :instances => {
|
123
|
+
# :ec2_key_name => "sharethrough-dev",
|
124
|
+
# :hadoop_version => "0.20",
|
125
|
+
# :instance_count => 2,
|
126
|
+
# :master_instance_type => "m1.small",
|
127
|
+
# :placement => {
|
128
|
+
# :availability_zone => "us-east-1a"
|
129
|
+
# },
|
130
|
+
# :slave_instance_type => "m1.small",
|
131
|
+
# },
|
132
|
+
# :steps => [
|
133
|
+
# {
|
134
|
+
# :action_on_failure => "TERMINATE_JOB_FLOW",
|
135
|
+
# :hadoop_jar_step => {
|
136
|
+
# :args => [
|
137
|
+
# "s3://elasticmapreduce/libs/pig/pig-script",
|
138
|
+
# "--base-path",
|
139
|
+
# "s3://elasticmapreduce/libs/pig/",
|
140
|
+
# "--install-pig"
|
141
|
+
# ],
|
142
|
+
# :jar => "s3://elasticmapreduce/libs/script-runner/script-runner.jar"
|
143
|
+
# },
|
144
|
+
# :name => "Setup Pig"
|
145
|
+
# },
|
146
|
+
# {
|
147
|
+
# :action_on_failure => "TERMINATE_JOB_FLOW",
|
148
|
+
# :hadoop_jar_step => {
|
149
|
+
# :args => [
|
150
|
+
# "s3://elasticmapreduce/libs/pig/pig-script",
|
151
|
+
# "--run-pig-script",
|
152
|
+
# "--args",
|
153
|
+
# "-p",
|
154
|
+
# "INPUT=s3n://elasticmapreduce/samples/pig-apache/input",
|
155
|
+
# "-p",
|
156
|
+
# "OUTPUT=s3n://slif-elasticity/pig-apache/output/2011-04-19",
|
157
|
+
# "s3n://elasticmapreduce/samples/pig-apache/do-reports.pig"
|
158
|
+
# ],
|
159
|
+
# :jar => "s3://elasticmapreduce/libs/script-runner/script-runner.jar"
|
160
|
+
# },
|
161
|
+
# :name => "Run Pig Script"
|
162
|
+
# }
|
163
|
+
# ]
|
164
|
+
# })
|
80
165
|
def run_job_flow(job_flow_config)
|
81
166
|
params = {
|
82
167
|
:operation => "RunJobFlow",
|
@@ -99,7 +184,7 @@ module Elasticity
|
|
99
184
|
#
|
100
185
|
# Takes an [] of job flow IDs.
|
101
186
|
#
|
102
|
-
#
|
187
|
+
# ["j-1B4D1XP0C0A35", "j-1YG2MYL0HVYS5", ...]
|
103
188
|
def set_termination_protection(jobflow_ids, protection_enabled=true)
|
104
189
|
params = {
|
105
190
|
:operation => "SetTerminationProtection",
|
data/lib/elasticity/job_flow.rb
CHANGED
@@ -5,21 +5,27 @@ module Elasticity
|
|
5
5
|
attr_accessor :name
|
6
6
|
attr_accessor :jobflow_id
|
7
7
|
attr_accessor :state
|
8
|
+
attr_accessor :steps
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@steps = []
|
12
|
+
end
|
8
13
|
|
9
14
|
class << self
|
10
15
|
|
11
16
|
# Create a jobflow from an AWS <member> (Nokogiri::XML::Element):
|
12
|
-
#
|
17
|
+
# /DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member
|
13
18
|
def from_member_element(xml_element)
|
14
19
|
jobflow = JobFlow.new
|
15
20
|
jobflow.name = xml_element.xpath("./Name").text
|
16
21
|
jobflow.jobflow_id = xml_element.xpath("./JobFlowId").text
|
17
22
|
jobflow.state = xml_element.xpath("./ExecutionStatusDetail/State").text
|
23
|
+
jobflow.steps = JobFlowStep.from_members_nodeset(xml_element.xpath("./Steps/member"))
|
18
24
|
jobflow
|
19
25
|
end
|
20
26
|
|
21
27
|
# Create JobFlows from a collection of AWS <member> nodes (Nokogiri::XML::NodeSet):
|
22
|
-
#
|
28
|
+
# /DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows
|
23
29
|
def from_members_nodeset(members_nodeset)
|
24
30
|
jobflows = []
|
25
31
|
members_nodeset.each do |member|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Elasticity
|
2
|
+
|
3
|
+
class JobFlowStep
|
4
|
+
|
5
|
+
attr_accessor :name
|
6
|
+
attr_accessor :state
|
7
|
+
|
8
|
+
class << self
|
9
|
+
|
10
|
+
# Create a job flow from an AWS <member> (Nokogiri::XML::Element):
|
11
|
+
# /DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member/Steps/member
|
12
|
+
def from_member_element(xml_element)
|
13
|
+
job_flow_step = JobFlowStep.new
|
14
|
+
job_flow_step.name = xml_element.xpath("./StepConfig/Name").text
|
15
|
+
job_flow_step.state = xml_element.xpath("./ExecutionStatusDetail/State").text
|
16
|
+
job_flow_step
|
17
|
+
end
|
18
|
+
|
19
|
+
# Create JobFlowSteps from a collection of AWS <member> nodes (Nokogiri::XML::NodeSet):
|
20
|
+
# /DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member/Steps/member
|
21
|
+
def from_members_nodeset(members_nodeset)
|
22
|
+
jobflow_steps = []
|
23
|
+
members_nodeset.each do |member|
|
24
|
+
jobflow_steps << from_member_element(member)
|
25
|
+
end
|
26
|
+
jobflow_steps
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
data/lib/elasticity/version.rb
CHANGED
@@ -0,0 +1,252 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :get
|
5
|
+
uri: !ruby/regexp /^http:\/\/elasticmapreduce.amazonaws.com:80\/\?.*Operation=RunJobFlow/
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- "*/*; q=0.5, application/xml"
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
response: !ruby/struct:VCR::Response
|
13
|
+
status: !ruby/struct:VCR::ResponseStatus
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
x-amzn-requestid:
|
18
|
+
- 71b9eb69-6d61-11e0-9ddc-a168e244afdb
|
19
|
+
content-type:
|
20
|
+
- text/xml
|
21
|
+
date:
|
22
|
+
- Sat, 23 Apr 2011 04:23:30 GMT
|
23
|
+
content-length:
|
24
|
+
- "296"
|
25
|
+
body: |
|
26
|
+
<RunJobFlowResponse xmlns="http://elasticmapreduce.amazonaws.com/doc/2009-03-31">
|
27
|
+
<RunJobFlowResult>
|
28
|
+
<JobFlowId>j-F0UCD5851OKV</JobFlowId>
|
29
|
+
</RunJobFlowResult>
|
30
|
+
<ResponseMetadata>
|
31
|
+
<RequestId>71b9eb69-6d61-11e0-9ddc-a168e244afdb</RequestId>
|
32
|
+
</ResponseMetadata>
|
33
|
+
</RunJobFlowResponse>
|
34
|
+
|
35
|
+
http_version: "1.1"
|
36
|
+
- !ruby/struct:VCR::HTTPInteraction
|
37
|
+
request: !ruby/struct:VCR::Request
|
38
|
+
method: :get
|
39
|
+
uri: !ruby/regexp /^http:\/\/elasticmapreduce.amazonaws.com:80\/\?.*Operation=AddJobFlowSteps/
|
40
|
+
body:
|
41
|
+
headers:
|
42
|
+
accept:
|
43
|
+
- "*/*; q=0.5, application/xml"
|
44
|
+
accept-encoding:
|
45
|
+
- gzip, deflate
|
46
|
+
response: !ruby/struct:VCR::Response
|
47
|
+
status: !ruby/struct:VCR::ResponseStatus
|
48
|
+
code: 200
|
49
|
+
message: OK
|
50
|
+
headers:
|
51
|
+
x-amzn-requestid:
|
52
|
+
- 71e1712c-6d61-11e0-b6c0-e9580d1f7304
|
53
|
+
content-type:
|
54
|
+
- text/xml
|
55
|
+
date:
|
56
|
+
- Sat, 23 Apr 2011 04:23:31 GMT
|
57
|
+
content-length:
|
58
|
+
- "221"
|
59
|
+
body: |
|
60
|
+
<AddJobFlowStepsResponse xmlns="http://elasticmapreduce.amazonaws.com/doc/2009-03-31">
|
61
|
+
<ResponseMetadata>
|
62
|
+
<RequestId>71e1712c-6d61-11e0-b6c0-e9580d1f7304</RequestId>
|
63
|
+
</ResponseMetadata>
|
64
|
+
</AddJobFlowStepsResponse>
|
65
|
+
|
66
|
+
http_version: "1.1"
|
67
|
+
- !ruby/struct:VCR::HTTPInteraction
|
68
|
+
request: !ruby/struct:VCR::Request
|
69
|
+
method: :get
|
70
|
+
uri: !ruby/regexp /^http:\/\/elasticmapreduce.amazonaws.com:80\/\?.*Operation=DescribeJobFlows/
|
71
|
+
body:
|
72
|
+
headers:
|
73
|
+
accept:
|
74
|
+
- "*/*; q=0.5, application/xml"
|
75
|
+
accept-encoding:
|
76
|
+
- gzip, deflate
|
77
|
+
response: !ruby/struct:VCR::Response
|
78
|
+
status: !ruby/struct:VCR::ResponseStatus
|
79
|
+
code: 200
|
80
|
+
message: OK
|
81
|
+
headers:
|
82
|
+
x-amzn-requestid:
|
83
|
+
- 720bb591-6d61-11e0-8835-2b8f31bf243b
|
84
|
+
content-type:
|
85
|
+
- text/xml
|
86
|
+
date:
|
87
|
+
- Sat, 23 Apr 2011 04:23:31 GMT
|
88
|
+
content-encoding:
|
89
|
+
- gzip
|
90
|
+
vary:
|
91
|
+
- Accept-Encoding
|
92
|
+
transfer-encoding:
|
93
|
+
- chunked
|
94
|
+
body: !binary |
|
95
|
+
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67w+9S
|
250
|
+
9yph3/P4t/8HTfYMqCsnAgA=
|
251
|
+
|
252
|
+
http_version: "1.1"
|
@@ -117,6 +117,137 @@ describe Elasticity::EMR do
|
|
117
117
|
|
118
118
|
end
|
119
119
|
|
120
|
+
describe "#add_jobflow_steps" do
|
121
|
+
|
122
|
+
describe "integration happy path" do
|
123
|
+
use_vcr_cassette "add_jobflow_steps/add_multiple_steps", :record => :none
|
124
|
+
|
125
|
+
before do
|
126
|
+
@setup_pig_step = {
|
127
|
+
:action_on_failure => "TERMINATE_JOB_FLOW",
|
128
|
+
:hadoop_jar_step => {
|
129
|
+
:args => [
|
130
|
+
"s3://elasticmapreduce/libs/pig/pig-script",
|
131
|
+
"--base-path",
|
132
|
+
"s3://elasticmapreduce/libs/pig/",
|
133
|
+
"--install-pig"
|
134
|
+
],
|
135
|
+
:jar => "s3://elasticmapreduce/libs/script-runner/script-runner.jar"
|
136
|
+
},
|
137
|
+
:name => "Setup Pig"
|
138
|
+
}
|
139
|
+
@emr = Elasticity::EMR.new(AWS_ACCESS_KEY_ID, AWS_SECRET_KEY)
|
140
|
+
@jobflow_id = @emr.run_job_flow({
|
141
|
+
:name => "Elasticity Test Flow (EMR Pig Script)",
|
142
|
+
:instances => {
|
143
|
+
:ec2_key_name => "sharethrough-dev",
|
144
|
+
:instance_count => 2,
|
145
|
+
:master_instance_type => "m1.small",
|
146
|
+
:slave_instance_type => "m1.small",
|
147
|
+
},
|
148
|
+
:steps => [@setup_pig_step]
|
149
|
+
})
|
150
|
+
end
|
151
|
+
|
152
|
+
it "should add a job flow step to the specified job flow" do
|
153
|
+
@emr.add_jobflow_steps(@jobflow_id, {
|
154
|
+
:steps => [
|
155
|
+
@setup_pig_step.merge(:name => "Setup Pig 2"),
|
156
|
+
@setup_pig_step.merge(:name => "Setup Pig 3")
|
157
|
+
]
|
158
|
+
})
|
159
|
+
jobflow = @emr.describe_jobflows.select { |jf| jf.jobflow_id = @jobflow_id }.first
|
160
|
+
jobflow.steps.map(&:name).should == ["Setup Pig", "Setup Pig 2", "Setup Pig 3"]
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
describe "unit tests" do
|
166
|
+
|
167
|
+
it "should add the specified steps to the job flow" do
|
168
|
+
aws_request = Elasticity::AwsRequest.new(AWS_ACCESS_KEY_ID, AWS_SECRET_KEY)
|
169
|
+
aws_request.should_receive(:aws_emr_request).with({
|
170
|
+
"Operation" => "AddJobFlowSteps",
|
171
|
+
"JobFlowId" => "j-1",
|
172
|
+
"Steps.member.1.Name" => "Step 1",
|
173
|
+
"Steps.member.1.ActionOnFailure" => "TERMINATE_JOB_FLOW",
|
174
|
+
"Steps.member.1.HadoopJarStep.Jar" => "jar1",
|
175
|
+
"Steps.member.1.HadoopJarStep.Args.member.1" => "arg1-1",
|
176
|
+
"Steps.member.1.HadoopJarStep.Args.member.2" => "arg1-2",
|
177
|
+
"Steps.member.2.Name" => "Step 2",
|
178
|
+
"Steps.member.2.ActionOnFailure" => "CONTINUE",
|
179
|
+
"Steps.member.2.HadoopJarStep.Jar" => "jar2",
|
180
|
+
"Steps.member.2.HadoopJarStep.Args.member.1" => "arg2-1",
|
181
|
+
"Steps.member.2.HadoopJarStep.Args.member.2" => "arg2-2",
|
182
|
+
})
|
183
|
+
Elasticity::AwsRequest.should_receive(:new).and_return(aws_request)
|
184
|
+
emr = Elasticity::EMR.new(AWS_ACCESS_KEY_ID, AWS_SECRET_KEY)
|
185
|
+
emr.add_jobflow_steps("j-1", {
|
186
|
+
:steps => [
|
187
|
+
{
|
188
|
+
:action_on_failure => "TERMINATE_JOB_FLOW",
|
189
|
+
:name => "Step 1",
|
190
|
+
:hadoop_jar_step => {
|
191
|
+
:args => ["arg1-1", "arg1-2"],
|
192
|
+
:jar => "jar1",
|
193
|
+
}
|
194
|
+
},
|
195
|
+
{
|
196
|
+
:action_on_failure => "CONTINUE",
|
197
|
+
:name => "Step 2",
|
198
|
+
:hadoop_jar_step => {
|
199
|
+
:args => ["arg2-1", "arg2-2"],
|
200
|
+
:jar => "jar2",
|
201
|
+
}
|
202
|
+
}
|
203
|
+
]
|
204
|
+
})
|
205
|
+
end
|
206
|
+
|
207
|
+
context "when there is an error" do
|
208
|
+
before do
|
209
|
+
@error_message = "2 validation errors detected: Value null at 'steps' failed to satisfy constraint: Member must not be null; Value null at 'jobFlowId' failed to satisfy constraint: Member must not be null"
|
210
|
+
@error_xml = <<-ERROR
|
211
|
+
<ErrorResponse xmlns="http://elasticmapreduce.amazonaws.com/doc/2009-03-31">
|
212
|
+
<Error>
|
213
|
+
<Message>#{@error_message}</Message>
|
214
|
+
</Error>
|
215
|
+
</ErrorResponse>
|
216
|
+
ERROR
|
217
|
+
end
|
218
|
+
|
219
|
+
it "should raise an ArgumentError with the error message" do
|
220
|
+
aws_request = Elasticity::AwsRequest.new("aws_access_key_id", "aws_secret_key")
|
221
|
+
@exception = RestClient::BadRequest.new
|
222
|
+
@exception.should_receive(:http_body).and_return(@error_xml)
|
223
|
+
aws_request.should_receive(:aws_emr_request).and_raise(@exception)
|
224
|
+
Elasticity::AwsRequest.should_receive(:new).and_return(aws_request)
|
225
|
+
emr = Elasticity::EMR.new("aws_access_key_id", "aws_secret_key")
|
226
|
+
lambda {
|
227
|
+
emr.add_jobflow_steps("", {})
|
228
|
+
}.should raise_error(ArgumentError, @error_message)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
context "when a block is given" do
|
233
|
+
it "should yield the XML result" do
|
234
|
+
aws_request = Elasticity::AwsRequest.new("aws_access_key_id", "aws_secret_key")
|
235
|
+
aws_request.should_receive(:aws_emr_request).and_return("xml_response")
|
236
|
+
Elasticity::AwsRequest.should_receive(:new).and_return(aws_request)
|
237
|
+
emr = Elasticity::EMR.new("aws_access_key_id", "aws_secret_key")
|
238
|
+
xml_result = nil
|
239
|
+
emr.add_jobflow_steps("", {}) do |xml|
|
240
|
+
xml_result = xml
|
241
|
+
end
|
242
|
+
xml_result.should == "xml_response"
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|
250
|
+
|
120
251
|
describe "#describe_jobflows" do
|
121
252
|
|
122
253
|
describe "integration happy path" do
|
@@ -8,26 +8,44 @@ describe Elasticity::JobFlow do
|
|
8
8
|
<DescribeJobFlowsResult>
|
9
9
|
<JobFlows>
|
10
10
|
<member>
|
11
|
+
<JobFlowId>j-p</JobFlowId>
|
12
|
+
<Name>Pig Job</Name>
|
11
13
|
<ExecutionStatusDetail>
|
12
14
|
<State>TERMINATED</State>
|
13
15
|
</ExecutionStatusDetail>
|
14
|
-
<
|
15
|
-
|
16
|
+
<Steps>
|
17
|
+
<member>
|
18
|
+
<StepConfig>
|
19
|
+
<Name>Setup Hive</Name>
|
20
|
+
</StepConfig>
|
21
|
+
<ExecutionStatusDetail>
|
22
|
+
<State>FAILED</State>
|
23
|
+
</ExecutionStatusDetail>
|
24
|
+
</member>
|
25
|
+
<member>
|
26
|
+
<StepConfig>
|
27
|
+
<Name>Run Hive Script</Name>
|
28
|
+
</StepConfig>
|
29
|
+
<ExecutionStatusDetail>
|
30
|
+
<State>PENDING</State>
|
31
|
+
</ExecutionStatusDetail>
|
32
|
+
</member>
|
33
|
+
</Steps>
|
16
34
|
</member>
|
17
35
|
<member>
|
36
|
+
<JobFlowId>j-h</JobFlowId>
|
37
|
+
<Name>Hive Job</Name>
|
18
38
|
<ExecutionStatusDetail>
|
19
39
|
<State>TERMINATED</State>
|
20
40
|
</ExecutionStatusDetail>
|
21
|
-
<JobFlowId>j-h</JobFlowId>
|
22
|
-
<Name>Hive Job</Name>
|
23
41
|
</member>
|
24
42
|
</JobFlows>
|
25
43
|
</DescribeJobFlowsResult>
|
26
44
|
</DescribeJobFlowsResponse>
|
27
45
|
JOBFLOWS
|
28
|
-
|
29
|
-
|
30
|
-
@members_nodeset =
|
46
|
+
describe_jobflows_document = Nokogiri::XML(describe_jobflows_xml)
|
47
|
+
describe_jobflows_document.remove_namespaces!
|
48
|
+
@members_nodeset = describe_jobflows_document.xpath('/DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member')
|
31
49
|
end
|
32
50
|
|
33
51
|
describe ".from_xml" do
|
@@ -36,6 +54,8 @@ describe Elasticity::JobFlow do
|
|
36
54
|
jobflow.name.should == "Pig Job"
|
37
55
|
jobflow.jobflow_id.should == "j-p"
|
38
56
|
jobflow.state.should == "TERMINATED"
|
57
|
+
jobflow.steps.map(&:name).should == ["Setup Hive", "Run Hive Script"]
|
58
|
+
jobflow.steps.map(&:state).should == ["FAILED", "PENDING"]
|
39
59
|
end
|
40
60
|
end
|
41
61
|
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Elasticity::JobFlowStep do
|
4
|
+
|
5
|
+
before do
|
6
|
+
describe_jobflows_xml = <<-JOBFLOWS
|
7
|
+
<DescribeJobFlowsResponse xmlns="http://elasticmapreduce.amazonaws.com/doc/2009-03-31">
|
8
|
+
<DescribeJobFlowsResult>
|
9
|
+
<JobFlows>
|
10
|
+
<member>
|
11
|
+
<JobFlowId>j-p</JobFlowId>
|
12
|
+
<Name>Pig Job</Name>
|
13
|
+
<ExecutionStatusDetail>
|
14
|
+
<State>TERMINATED</State>
|
15
|
+
</ExecutionStatusDetail>
|
16
|
+
<Steps>
|
17
|
+
<member>
|
18
|
+
<StepConfig>
|
19
|
+
<Name>Setup Hive</Name>
|
20
|
+
</StepConfig>
|
21
|
+
<ExecutionStatusDetail>
|
22
|
+
<State>FAILED</State>
|
23
|
+
</ExecutionStatusDetail>
|
24
|
+
</member>
|
25
|
+
<member>
|
26
|
+
<StepConfig>
|
27
|
+
<Name>Run Hive Script</Name>
|
28
|
+
</StepConfig>
|
29
|
+
<ExecutionStatusDetail>
|
30
|
+
<State>PENDING</State>
|
31
|
+
</ExecutionStatusDetail>
|
32
|
+
</member>
|
33
|
+
</Steps>
|
34
|
+
</member>
|
35
|
+
</JobFlows>
|
36
|
+
</DescribeJobFlowsResult>
|
37
|
+
</DescribeJobFlowsResponse>
|
38
|
+
JOBFLOWS
|
39
|
+
describe_jobflows_document = Nokogiri::XML(describe_jobflows_xml)
|
40
|
+
describe_jobflows_document.remove_namespaces!
|
41
|
+
@members_nodeset = describe_jobflows_document.xpath('/DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member/Steps/member')
|
42
|
+
end
|
43
|
+
|
44
|
+
describe ".from_xml" do
|
45
|
+
it "should return a JobFlowStep with the appropriate fields initialized" do
|
46
|
+
jobflow_step = Elasticity::JobFlowStep.from_member_element(@members_nodeset[0])
|
47
|
+
jobflow_step.name.should == "Setup Hive"
|
48
|
+
jobflow_step.state.should == "FAILED"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe ".from_steps_nodeset" do
|
53
|
+
it "should return JobFlowSteps with the appropriate fields initialized" do
|
54
|
+
jobflow_steps = Elasticity::JobFlowStep.from_members_nodeset(@members_nodeset)
|
55
|
+
jobflow_steps.map(&:name).should == ["Setup Hive", "Run Hive Script"]
|
56
|
+
jobflow_steps.map(&:state).should == ["FAILED", "PENDING"]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: "0.6"
|
9
|
+
version: "1.0"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Robert Slifka
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-04-
|
17
|
+
date: 2011-04-22 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -127,9 +127,11 @@ files:
|
|
127
127
|
- lib/elasticity/aws_request.rb
|
128
128
|
- lib/elasticity/emr.rb
|
129
129
|
- lib/elasticity/job_flow.rb
|
130
|
+
- lib/elasticity/job_flow_step.rb
|
130
131
|
- lib/elasticity/version.rb
|
131
132
|
- spec/fixtures/vcr_cassettes/add_instance_groups/one_group_successful.yml
|
132
133
|
- spec/fixtures/vcr_cassettes/add_instance_groups/one_group_unsuccessful.yml
|
134
|
+
- spec/fixtures/vcr_cassettes/add_jobflow_steps/add_multiple_steps.yml
|
133
135
|
- spec/fixtures/vcr_cassettes/describe_jobflows/all_jobflows.yml
|
134
136
|
- spec/fixtures/vcr_cassettes/direct/terminate_jobflow.yml
|
135
137
|
- spec/fixtures/vcr_cassettes/modify_instance_groups/set_instances_to_3.yml
|
@@ -140,6 +142,7 @@ files:
|
|
140
142
|
- spec/lib/elasticity/aws_request_spec.rb
|
141
143
|
- spec/lib/elasticity/emr_spec.rb
|
142
144
|
- spec/lib/elasticity/job_flow_spec.rb
|
145
|
+
- spec/lib/elasticity/job_flow_step_spec.rb
|
143
146
|
- spec/spec_helper.rb
|
144
147
|
has_rdoc: true
|
145
148
|
homepage: http://www.github.com/rslifka/elasticity
|
@@ -178,6 +181,7 @@ summary: Programmatic access to Amazon's Elastic Map Reduce service.
|
|
178
181
|
test_files:
|
179
182
|
- spec/fixtures/vcr_cassettes/add_instance_groups/one_group_successful.yml
|
180
183
|
- spec/fixtures/vcr_cassettes/add_instance_groups/one_group_unsuccessful.yml
|
184
|
+
- spec/fixtures/vcr_cassettes/add_jobflow_steps/add_multiple_steps.yml
|
181
185
|
- spec/fixtures/vcr_cassettes/describe_jobflows/all_jobflows.yml
|
182
186
|
- spec/fixtures/vcr_cassettes/direct/terminate_jobflow.yml
|
183
187
|
- spec/fixtures/vcr_cassettes/modify_instance_groups/set_instances_to_3.yml
|
@@ -188,4 +192,5 @@ test_files:
|
|
188
192
|
- spec/lib/elasticity/aws_request_spec.rb
|
189
193
|
- spec/lib/elasticity/emr_spec.rb
|
190
194
|
- spec/lib/elasticity/job_flow_spec.rb
|
195
|
+
- spec/lib/elasticity/job_flow_step_spec.rb
|
191
196
|
- spec/spec_helper.rb
|