elasticity 6.0.1 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/HISTORY.md +7 -0
- data/README.md +1 -0
- data/lib/elasticity/cluster_status.rb +3 -3
- data/lib/elasticity/cluster_step_status.rb +3 -3
- data/lib/elasticity/job_flow.rb +12 -1
- data/lib/elasticity/version.rb +1 -1
- data/spec/lib/elasticity/aws_request_v4_spec.rb +1 -1
- data/spec/lib/elasticity/cluster_status_spec.rb +27 -6
- data/spec/lib/elasticity/cluster_step_status_spec.rb +28 -6
- data/spec/lib/elasticity/job_flow_spec.rb +43 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: affb1ae0de5df89c0061fabfde695f56ac0f4845
|
4
|
+
data.tar.gz: 43c2bdd9e155587f28288c42271c4561b787e3aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ec9e99c8fda33defb4dc9bfb318080740920201c25080f87310036b85970831a194e0a0d0b41a2361d9af95240ca327fab4554deb622044123d6abce5af6347
|
7
|
+
data.tar.gz: 4aa6636cfd730be45dd3829ed8db82951167b056f5fa76e7aabac6efa02f1ded0a2f49e70164661aff0119178ea9cb68ad07b600167102cdca649786bd867183
|
data/HISTORY.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 6.0.2 - July 20, 2015
|
2
|
+
|
3
|
+
- Including PR [#111](https://github.com/rslifka/elasticity/pull/111) - "Handle steps status that hasn't run yet". Thank you [@robert2d](https://github.com/robert2d)!
|
4
|
+
- Including PR [#112](https://github.com/rslifka/elasticity/pull/112) - "Parse Dates when step/cluster still starting". Thank you [@robert2d](https://github.com/robert2d)!
|
5
|
+
- Including PR [#113](https://github.com/rslifka/elasticity/pull/113) - "Add job flow steps remove extra steps key". Thank you [@robert2d](https://github.com/robert2d)!
|
6
|
+
- Including PR [#114](https://github.com/rslifka/elasticity/pull/114) - "Allow tags to be set on runJobFlow". Thank you [@robert2d](https://github.com/robert2d)!
|
7
|
+
|
1
8
|
## 6.0.1 - July 19, 2015
|
2
9
|
|
3
10
|
- Including PR [#110](https://github.com/rslifka/elasticity/pull/110) - "Send bid price as string to aws api". Thank you [@robert2d](https://github.com/robert2d)!
|
data/README.md
CHANGED
@@ -119,6 +119,7 @@ jobflow.ami_version = 'latest'
|
|
119
119
|
jobflow.log_uri = nil
|
120
120
|
jobflow.enable_debugging = false # Requires a log_uri to enable
|
121
121
|
|
122
|
+
jobflow.tags = {name: "app-name", department: 'marketing'}
|
122
123
|
jobflow.ec2_key_name = nil
|
123
124
|
jobflow.visible_to_all_users = false
|
124
125
|
jobflow.placement = 'us-east-1a'
|
@@ -20,8 +20,8 @@ module Elasticity
|
|
20
20
|
c.cluster_id = cluster_data['Id']
|
21
21
|
c.state = cluster_data['Status']['State']
|
22
22
|
c.created_at = Time.at(cluster_data['Status']['Timeline']['CreationDateTime'])
|
23
|
-
c.ready_at = Time.at(cluster_data['Status']['Timeline']['ReadyDateTime'])
|
24
|
-
c.ended_at = Time.at(cluster_data['Status']['Timeline']['EndDateTime'])
|
23
|
+
c.ready_at = cluster_data['Status']['Timeline']['ReadyDateTime'] ? Time.at(cluster_data['Status']['Timeline']['ReadyDateTime']) : nil
|
24
|
+
c.ended_at = cluster_data['Status']['Timeline']['EndDateTime'] ? Time.at(cluster_data['Status']['Timeline']['EndDateTime']) : nil
|
25
25
|
c.last_state_change_reason = cluster_data['Status']['StateChangeReason']['Code']
|
26
26
|
c.master_public_dns_name = cluster_data['MasterPublicDnsName']
|
27
27
|
c.normalized_instance_hours = cluster_data['NormalizedInstanceHours']
|
@@ -35,4 +35,4 @@ module Elasticity
|
|
35
35
|
|
36
36
|
end
|
37
37
|
|
38
|
-
end
|
38
|
+
end
|
@@ -31,8 +31,8 @@ module Elasticity
|
|
31
31
|
c.state_change_reason = s['Status']['StateChangeReason']['Code']
|
32
32
|
c.state_change_reason_message = s['Status']['StateChangeReason']['Message']
|
33
33
|
c.created_at = Time.at(s['Status']['Timeline']['CreationDateTime'])
|
34
|
-
c.started_at = Time.at(s['Status']['Timeline']['StartDateTime'])
|
35
|
-
c.ended_at = Time.at(s['Status']['Timeline']['EndDateTime'])
|
34
|
+
c.started_at = s['Status']['Timeline']['StartDateTime'] ? Time.at(s['Status']['Timeline']['StartDateTime']) : nil
|
35
|
+
c.ended_at = s['Status']['Timeline']['EndDateTime'] ? Time.at(s['Status']['Timeline']['EndDateTime']) : nil
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -48,4 +48,4 @@ module Elasticity
|
|
48
48
|
|
49
49
|
end
|
50
50
|
|
51
|
-
end
|
51
|
+
end
|
data/lib/elasticity/job_flow.rb
CHANGED
@@ -13,6 +13,7 @@ module Elasticity
|
|
13
13
|
attr_accessor :name
|
14
14
|
attr_accessor :instance_count
|
15
15
|
attr_accessor :log_uri
|
16
|
+
attr_accessor :tags
|
16
17
|
attr_accessor :master_instance_type
|
17
18
|
attr_accessor :slave_instance_type
|
18
19
|
attr_accessor :ami_version
|
@@ -126,7 +127,7 @@ module Elasticity
|
|
126
127
|
jobflow_steps.concat(jobflow_step.aws_installation_steps)
|
127
128
|
end
|
128
129
|
jobflow_steps << jobflow_step.to_aws_step(self)
|
129
|
-
emr.add_jobflow_steps(@jobflow_id,
|
130
|
+
emr.add_jobflow_steps(@jobflow_id, jobflow_steps)
|
130
131
|
else
|
131
132
|
@jobflow_steps << jobflow_step
|
132
133
|
end
|
@@ -186,12 +187,22 @@ module Elasticity
|
|
186
187
|
steps.insert(0, Elasticity::SetupHadoopDebuggingStep.new.to_aws_step(self)) if @enable_debugging
|
187
188
|
config[:steps] = steps
|
188
189
|
config[:log_uri] = @log_uri if @log_uri
|
190
|
+
config[:tags] = jobflow_tags if @tags
|
189
191
|
config[:job_flow_role] = @job_flow_role if @job_flow_role
|
190
192
|
config[:service_role] = @service_role if @service_role
|
191
193
|
config[:bootstrap_actions] = @bootstrap_actions.map{|a| a.to_aws_bootstrap_action} unless @bootstrap_actions.empty?
|
192
194
|
config
|
193
195
|
end
|
194
196
|
|
197
|
+
def jobflow_tags
|
198
|
+
@tags.map do |key, value|
|
199
|
+
{
|
200
|
+
key: key.to_s,
|
201
|
+
value: value
|
202
|
+
}
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
195
206
|
def jobflow_preamble
|
196
207
|
preamble = {
|
197
208
|
:name => @name,
|
data/lib/elasticity/version.rb
CHANGED
@@ -123,7 +123,7 @@ describe Elasticity::AwsRequestV4 do
|
|
123
123
|
|
124
124
|
describe '.aws_v4_signature' do
|
125
125
|
it 'should create the proper signature' do
|
126
|
-
subject.send(:aws_v4_signature).should == '
|
126
|
+
subject.send(:aws_v4_signature).should == '05d406786907e37181060b8c744b5aea8451a7da93f20cacb6c6fd846cfcfa5d'
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -1,6 +1,16 @@
|
|
1
1
|
describe Elasticity::ClusterStatus do
|
2
2
|
|
3
3
|
let(:cluster_state) { 'TERMINATED' }
|
4
|
+
let(:timeline) do
|
5
|
+
<<-JSON
|
6
|
+
{
|
7
|
+
"CreationDateTime": 1436788464.415,
|
8
|
+
"EndDateTime": 1436791032.097,
|
9
|
+
"ReadyDateTime": 1436788842.195
|
10
|
+
}
|
11
|
+
JSON
|
12
|
+
end
|
13
|
+
|
4
14
|
let(:aws_cluster_status) do
|
5
15
|
<<-JSON
|
6
16
|
{
|
@@ -32,11 +42,7 @@ describe Elasticity::ClusterStatus do
|
|
32
42
|
"Code": "ALL_STEPS_COMPLETED",
|
33
43
|
"Message": "Steps completed"
|
34
44
|
},
|
35
|
-
"Timeline": {
|
36
|
-
"CreationDateTime": 1436788464.415,
|
37
|
-
"EndDateTime": 1436791032.097,
|
38
|
-
"ReadyDateTime": 1436788842.195
|
39
|
-
}
|
45
|
+
"Timeline": #{timeline}
|
40
46
|
},
|
41
47
|
"Tags": [
|
42
48
|
{
|
@@ -67,6 +73,21 @@ describe Elasticity::ClusterStatus do
|
|
67
73
|
expect(subject.master_public_dns_name).to eql('ec2-54-81-173-103.compute-1.amazonaws.com')
|
68
74
|
expect(subject.normalized_instance_hours).to eql(2)
|
69
75
|
end
|
76
|
+
|
77
|
+
context 'when cluster is brand new' do
|
78
|
+
let(:timeline) do
|
79
|
+
<<-JSON
|
80
|
+
{
|
81
|
+
"CreationDateTime": 1436788464.415
|
82
|
+
}
|
83
|
+
JSON
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'defaults ready_at and ended_at correctly' do
|
87
|
+
expect(subject.ready_at).not_to be
|
88
|
+
expect(subject.ended_at).not_to be
|
89
|
+
end
|
90
|
+
end
|
70
91
|
end
|
71
92
|
|
72
93
|
describe '#active?' do
|
@@ -95,4 +116,4 @@ describe Elasticity::ClusterStatus do
|
|
95
116
|
|
96
117
|
end
|
97
118
|
|
98
|
-
end
|
119
|
+
end
|
@@ -1,5 +1,15 @@
|
|
1
1
|
describe Elasticity::ClusterStepStatus do
|
2
2
|
|
3
|
+
let(:timeline) do
|
4
|
+
<<-JSON
|
5
|
+
{
|
6
|
+
"CreationDateTime": 1436788464.416,
|
7
|
+
"StartDateTime": 1436788841.237,
|
8
|
+
"EndDateTime": 1436790944.162
|
9
|
+
}
|
10
|
+
JSON
|
11
|
+
end
|
12
|
+
|
3
13
|
let(:aws_cluster_steps) do
|
4
14
|
<<-JSON
|
5
15
|
{
|
@@ -27,11 +37,7 @@ describe Elasticity::ClusterStepStatus do
|
|
27
37
|
"Code": "ALL_STEPS_COMPLETED",
|
28
38
|
"Message": "Steps completed"
|
29
39
|
},
|
30
|
-
"Timeline": {
|
31
|
-
"CreationDateTime": 1436788464.416,
|
32
|
-
"EndDateTime": 1436790944.162,
|
33
|
-
"StartDateTime": 1436788841.237
|
34
|
-
}
|
40
|
+
"Timeline": #{timeline}
|
35
41
|
}
|
36
42
|
}
|
37
43
|
]
|
@@ -62,6 +68,22 @@ describe Elasticity::ClusterStepStatus do
|
|
62
68
|
expect(status.started_at).to eql(Time.at(1436788841.237))
|
63
69
|
expect(status.ended_at).to eql(Time.at(1436790944.162))
|
64
70
|
end
|
71
|
+
|
72
|
+
context 'newly created step that hasn\'t started yet' do
|
73
|
+
let(:timeline) do
|
74
|
+
<<-JSON
|
75
|
+
{
|
76
|
+
"CreationDateTime": 1436788464.416
|
77
|
+
}
|
78
|
+
JSON
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'sets started_at and ended_at to nil' do
|
82
|
+
status = cluster_step_statuses[0]
|
83
|
+
expect(status.started_at).not_to be
|
84
|
+
expect(status.ended_at).not_to be
|
85
|
+
end
|
86
|
+
end
|
65
87
|
end
|
66
88
|
|
67
89
|
describe '.installed_steps' do
|
@@ -77,4 +99,4 @@ describe Elasticity::ClusterStepStatus do
|
|
77
99
|
end
|
78
100
|
end
|
79
101
|
|
80
|
-
end
|
102
|
+
end
|
@@ -24,7 +24,7 @@ describe Elasticity::JobFlow do
|
|
24
24
|
expect(subject.service_role).to eql(nil)
|
25
25
|
end
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
describe '#placement=' do
|
29
29
|
|
30
30
|
context 'when the placement is set' do
|
@@ -218,9 +218,7 @@ describe Elasticity::JobFlow do
|
|
218
218
|
let(:additional_step) { Elasticity::PigStep.new('_') }
|
219
219
|
|
220
220
|
it 'should submit the step' do
|
221
|
-
emr.should_receive(:add_jobflow_steps).with('RUNNING_JOBFLOW_ID',
|
222
|
-
:steps => [additional_step.to_aws_step(running_jobflow)]
|
223
|
-
})
|
221
|
+
emr.should_receive(:add_jobflow_steps).with('RUNNING_JOBFLOW_ID', [additional_step.to_aws_step(running_jobflow)])
|
224
222
|
running_jobflow.add_step(additional_step)
|
225
223
|
end
|
226
224
|
end
|
@@ -229,9 +227,7 @@ describe Elasticity::JobFlow do
|
|
229
227
|
let(:additional_step) { Elasticity::HiveStep.new('_') }
|
230
228
|
|
231
229
|
it 'should submit the installation step and the step' do
|
232
|
-
emr.should_receive(:add_jobflow_steps).with('RUNNING_JOBFLOW_ID',
|
233
|
-
:steps => Elasticity::HiveStep.aws_installation_steps << additional_step.to_aws_step(running_jobflow)
|
234
|
-
})
|
230
|
+
emr.should_receive(:add_jobflow_steps).with('RUNNING_JOBFLOW_ID', Elasticity::HiveStep.aws_installation_steps << additional_step.to_aws_step(running_jobflow))
|
235
231
|
running_jobflow.add_step(additional_step)
|
236
232
|
end
|
237
233
|
end
|
@@ -243,9 +239,7 @@ describe Elasticity::JobFlow do
|
|
243
239
|
let(:additional_step) { Elasticity::CustomJarStep.new('jar') }
|
244
240
|
|
245
241
|
it 'should submit the step' do
|
246
|
-
emr.should_receive(:add_jobflow_steps).with('RUNNING_JOBFLOW_ID',
|
247
|
-
:steps => [additional_step.to_aws_step(running_jobflow)]
|
248
|
-
})
|
242
|
+
emr.should_receive(:add_jobflow_steps).with('RUNNING_JOBFLOW_ID', [additional_step.to_aws_step(running_jobflow)])
|
249
243
|
running_jobflow.add_step(additional_step)
|
250
244
|
end
|
251
245
|
|
@@ -336,6 +330,45 @@ describe Elasticity::JobFlow do
|
|
336
330
|
|
337
331
|
end
|
338
332
|
|
333
|
+
describe 'tags' do
|
334
|
+
|
335
|
+
context 'when a tag is specified' do
|
336
|
+
let(:jobflow_with_tags) do
|
337
|
+
Elasticity::JobFlow.new.tap do |jf|
|
338
|
+
jf.tags = {
|
339
|
+
name: 'app-name',
|
340
|
+
contact: 'admin@example.com'
|
341
|
+
}
|
342
|
+
end
|
343
|
+
end
|
344
|
+
it 'should incorporate it into the jobflow config' do
|
345
|
+
jobflow_with_tags.send(:jobflow_config).should be_a_hash_including(
|
346
|
+
tags: [
|
347
|
+
{
|
348
|
+
key: 'name',
|
349
|
+
value: 'app-name'
|
350
|
+
}, {
|
351
|
+
key: 'contact',
|
352
|
+
value: 'admin@example.com'
|
353
|
+
}
|
354
|
+
]
|
355
|
+
)
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
context 'when a tag is not specified' do
|
360
|
+
let(:jobflow_with_no_tags) do
|
361
|
+
Elasticity::JobFlow.new.tap do |jf|
|
362
|
+
jf.tags = nil
|
363
|
+
end
|
364
|
+
end
|
365
|
+
it 'should not make space for it in the jobflow config' do
|
366
|
+
jobflow_with_no_tags.send(:jobflow_config).should_not have_key(:tags)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
end
|
371
|
+
|
339
372
|
describe 'job flow role' do
|
340
373
|
|
341
374
|
context 'when a job flow role is specified' do
|