elasticity 6.0.11 → 6.0.12
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 +6 -0
- data/elasticity.gemspec +1 -1
- data/lib/elasticity.rb +1 -1
- data/lib/elasticity/aws_request_v4.rb +6 -1
- data/lib/elasticity/aws_utils.rb +1 -1
- data/lib/elasticity/job_flow.rb +11 -1
- data/lib/elasticity/setup_hadoop_debugging_step.rb +3 -3
- data/lib/elasticity/version.rb +1 -1
- data/spec/lib/elasticity/aws_request_v4_spec.rb +24 -3
- data/spec/lib/elasticity/aws_utils_spec.rb +1 -1
- data/spec/lib/elasticity/job_flow_spec.rb +61 -1
- data/spec/lib/elasticity/setup_hadoop_debugging_step_spec.rb +7 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f96e8b15d696c580e01a6957b7981806190c86ef
|
4
|
+
data.tar.gz: aa9fc8328096b4fc7cf0649b0bb3f82eaf416e8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 709475923787784aaf6e38c3825a730cf462966b3cf7c10c1f26314d259743e21b462a2d3f36e4d4e077a79b16ec62da65d058ffbd8bdb78ccf915f994a3da36
|
7
|
+
data.tar.gz: 4b5a0731398a0e7cf22f144c853a99d76fbc27ed3cbbf0d18c9ed46d1a4803e76d9872833fb86a96fb4cb23393b0315b74d84eee418e45838ad48a33ace0d2df
|
data/HISTORY.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 6.0.12 - February 7, 2017
|
2
|
+
|
3
|
+
- Including PR [#140](https://github.com/rslifka/elasticity/pull/140) - "Update fog". Thank you [@BenFradet ](https://github.com/BenFradet )!
|
4
|
+
- Including PR [#138](https://github.com/rslifka/elasticity/pull/138) - "Make application configuration available". Thank you [@henryhu666](https://github.com/henryhu666)!
|
5
|
+
- Including PR [#136](https://github.com/rslifka/elasticity/pull/136) - "added security configuration attribute". Thank you [@devsaik](https://github.com/devsaik)!
|
6
|
+
|
1
7
|
## 6.0.11 - February 7, 2017
|
2
8
|
|
3
9
|
- Including PR [#134](https://github.com/rslifka/elasticity/pull/134) - "Spark step". Thank you [@BenFradet](https://github.com/BenFradet)!
|
data/elasticity.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = %q{Streamlined, programmatic access to Amazon's Elastic Map Reduce service, driven by the Sharethrough team's requirements for belting out EMR jobs.}
|
14
14
|
|
15
15
|
s.add_dependency('rest-client', '~> 1.0')
|
16
|
-
s.add_dependency('fog', '~> 1.0')
|
16
|
+
s.add_dependency('fog-aws', '~> 1.0')
|
17
17
|
s.add_dependency('unf', '~> 0.1')
|
18
18
|
|
19
19
|
s.add_development_dependency('factory_girl', '~> 4.0')
|
data/lib/elasticity.rb
CHANGED
@@ -51,7 +51,12 @@ module Elasticity
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def payload
|
54
|
-
|
54
|
+
configurations = @ruby_service_hash.delete(:configurations)
|
55
|
+
service_hash = AwsUtils.convert_ruby_to_aws_v4(@ruby_service_hash)
|
56
|
+
return service_hash.to_json if configurations.nil?
|
57
|
+
@ruby_service_hash[:configurations] = configurations
|
58
|
+
service_hash['Configurations'] = configurations
|
59
|
+
service_hash.to_json
|
55
60
|
end
|
56
61
|
|
57
62
|
private
|
data/lib/elasticity/aws_utils.rb
CHANGED
data/lib/elasticity/job_flow.rb
CHANGED
@@ -10,6 +10,7 @@ module Elasticity
|
|
10
10
|
|
11
11
|
attr_accessor :action_on_failure
|
12
12
|
attr_accessor :ec2_key_name
|
13
|
+
attr_accessor :security_configuration
|
13
14
|
attr_accessor :name
|
14
15
|
attr_accessor :instance_count
|
15
16
|
attr_accessor :log_uri
|
@@ -28,6 +29,7 @@ module Elasticity
|
|
28
29
|
attr_accessor :service_role
|
29
30
|
attr_accessor :jobflow_id
|
30
31
|
attr_accessor :aws_applications
|
32
|
+
attr_accessor :aws_configurations
|
31
33
|
attr_accessor :additional_info
|
32
34
|
attr_accessor :additional_master_security_groups
|
33
35
|
attr_accessor :additional_slave_security_groups
|
@@ -43,6 +45,7 @@ module Elasticity
|
|
43
45
|
|
44
46
|
@bootstrap_actions = []
|
45
47
|
@aws_applications = []
|
48
|
+
@aws_configurations = []
|
46
49
|
@jobflow_steps = []
|
47
50
|
@installed_steps = []
|
48
51
|
|
@@ -118,6 +121,11 @@ module Elasticity
|
|
118
121
|
@aws_applications << application
|
119
122
|
end
|
120
123
|
|
124
|
+
def add_configuration(configuration)
|
125
|
+
raise JobFlowRunningError, 'To add configurations, please create a new job flow.' if is_jobflow_running?
|
126
|
+
@aws_configurations << configuration
|
127
|
+
end
|
128
|
+
|
121
129
|
def set_master_instance_group(instance_group)
|
122
130
|
instance_group.role = 'MASTER'
|
123
131
|
@instance_groups[:master] = instance_group
|
@@ -210,15 +218,17 @@ module Elasticity
|
|
210
218
|
config = jobflow_preamble
|
211
219
|
validate_and_apply_ami_or_release_version(config)
|
212
220
|
steps = jobflow_steps
|
213
|
-
steps.insert(0, Elasticity::SetupHadoopDebuggingStep.new.to_aws_step(self)) if @enable_debugging
|
221
|
+
steps.insert(0, Elasticity::SetupHadoopDebuggingStep.new(@region).to_aws_step(self)) if @enable_debugging
|
214
222
|
config[:steps] = steps
|
215
223
|
config[:log_uri] = @log_uri if @log_uri
|
216
224
|
config[:tags] = jobflow_tags if @tags
|
217
225
|
config[:job_flow_role] = @job_flow_role if @job_flow_role
|
218
226
|
config[:service_role] = @service_role if @service_role
|
219
227
|
config[:additional_info] = @additional_info if @additional_info
|
228
|
+
config[:security_configuration] = @security_configuration if @security_configuration
|
220
229
|
config[:bootstrap_actions] = @bootstrap_actions.map(&:to_aws_bootstrap_action) unless @bootstrap_actions.empty?
|
221
230
|
config[:applications] = @aws_applications.map(&:to_hash) if valid_aws_applications?
|
231
|
+
config[:configurations] = @aws_configurations unless @aws_configurations.empty?
|
222
232
|
config
|
223
233
|
end
|
224
234
|
|
@@ -2,10 +2,10 @@ module Elasticity
|
|
2
2
|
|
3
3
|
class SetupHadoopDebuggingStep < CustomJarStep
|
4
4
|
|
5
|
-
def initialize
|
5
|
+
def initialize(region)
|
6
6
|
@name = 'Elasticity Setup Hadoop Debugging'
|
7
|
-
@jar =
|
8
|
-
@arguments = [
|
7
|
+
@jar = "s3://#{region}.elasticmapreduce/libs/script-runner/script-runner.jar"
|
8
|
+
@arguments = ["s3://#{region}.elasticmapreduce/libs/state-pusher/0.1/fetch"]
|
9
9
|
@action_on_failure = 'TERMINATE_JOB_FLOW'
|
10
10
|
end
|
11
11
|
|
data/lib/elasticity/version.rb
CHANGED
@@ -86,8 +86,29 @@ describe Elasticity::AwsRequestV4 do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
describe '#payload' do
|
89
|
-
|
90
|
-
|
89
|
+
context 'when no configurations are given' do
|
90
|
+
it 'should create the proper payload' do
|
91
|
+
subject.payload.should == '{"JobFlowIds":["TEST_JOBFLOW_ID"]}'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context 'when configurations are given' do
|
96
|
+
subject do
|
97
|
+
Elasticity::AwsRequestV4.new(
|
98
|
+
Elasticity::AwsSession.new,
|
99
|
+
{:operation => 'DescribeJobFlows', :job_flow_ids => ['TEST_JOBFLOW_ID'],
|
100
|
+
:configurations => [
|
101
|
+
'Classification' => 'capacity-scheduler',
|
102
|
+
'Properties' => {
|
103
|
+
'yarn.scheduler.capacity.resource-calculator' =>
|
104
|
+
'org.apache.hadoop.yarn.util.resource.DominantResourceCalculator'
|
105
|
+
}]
|
106
|
+
}
|
107
|
+
)
|
108
|
+
end
|
109
|
+
it 'should create the proper payload' do
|
110
|
+
subject.payload.should == '{"JobFlowIds":["TEST_JOBFLOW_ID"],"Configurations":[{"Classification":"capacity-scheduler","Properties":{"yarn.scheduler.capacity.resource-calculator":"org.apache.hadoop.yarn.util.resource.DominantResourceCalculator"}}]}'
|
111
|
+
end
|
91
112
|
end
|
92
113
|
end
|
93
114
|
|
@@ -123,7 +144,7 @@ describe Elasticity::AwsRequestV4 do
|
|
123
144
|
|
124
145
|
describe '.aws_v4_signature' do
|
125
146
|
it 'should create the proper signature' do
|
126
|
-
subject.send(:aws_v4_signature).should == '
|
147
|
+
subject.send(:aws_v4_signature).should == '71d7f2adf5b01990b09d7d10910b9a0312ded30bacf05ea8e8a05cc72ab389d1'
|
127
148
|
end
|
128
149
|
end
|
129
150
|
|
@@ -8,6 +8,7 @@ describe Elasticity::JobFlow do
|
|
8
8
|
it 'should set the fields appropriately' do
|
9
9
|
expect(subject.action_on_failure).to eql('TERMINATE_JOB_FLOW')
|
10
10
|
expect(subject.ec2_key_name).to eql(nil)
|
11
|
+
expect(subject.security_configuration).to eql(nil)
|
11
12
|
expect(subject.name).to eql('Elasticity Job Flow')
|
12
13
|
expect(subject.instance_count).to eql(2)
|
13
14
|
expect(subject.log_uri).to eql(nil)
|
@@ -16,6 +17,7 @@ describe Elasticity::JobFlow do
|
|
16
17
|
expect(subject.ami_version).to eql(nil)
|
17
18
|
expect(subject.release_label).to eql(nil)
|
18
19
|
expect(subject.aws_applications).to eql([])
|
20
|
+
expect(subject.aws_configurations).to eql([])
|
19
21
|
expect(subject.keep_job_flow_alive_when_no_steps).to eql(false)
|
20
22
|
expect(subject.ec2_subnet_id).to eql(nil)
|
21
23
|
expect(subject.placement).to eql('us-east-1a')
|
@@ -77,6 +79,18 @@ describe Elasticity::JobFlow do
|
|
77
79
|
end
|
78
80
|
end
|
79
81
|
|
82
|
+
describe '#security_configuration=' do
|
83
|
+
context 'when set' do
|
84
|
+
before do
|
85
|
+
subject.security_configuration = 'security configuration'
|
86
|
+
end
|
87
|
+
it 'security_configuration is a string' do
|
88
|
+
expect(subject.security_configuration).to eq('security configuration')
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
|
80
94
|
describe '#enable_debugging=' do
|
81
95
|
|
82
96
|
context 'when a log_uri is present' do
|
@@ -212,6 +226,31 @@ describe Elasticity::JobFlow do
|
|
212
226
|
|
213
227
|
end
|
214
228
|
|
229
|
+
describe '#add_configuration' do
|
230
|
+
let(:configuration) { {'Classification' => 'spark'} }
|
231
|
+
context 'when the jobflow is not yet started' do
|
232
|
+
it 'should not raise an error' do
|
233
|
+
expect {
|
234
|
+
subject.add_bootstrap_action(configuration)
|
235
|
+
}.to_not raise_error
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
context 'when the jobflow is already started' do
|
240
|
+
before do
|
241
|
+
Elasticity::EMR.any_instance.stub(:run_job_flow => '_')
|
242
|
+
subject.add_step(Elasticity::CustomJarStep.new('_'))
|
243
|
+
subject.run
|
244
|
+
end
|
245
|
+
it 'should raise an error' do
|
246
|
+
expect {
|
247
|
+
subject.add_configuration(configuration)
|
248
|
+
}.to raise_error(Elasticity::JobFlowRunningError, 'To add configurations, please create a new job flow.')
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
end
|
253
|
+
|
215
254
|
describe '#add_step' do
|
216
255
|
|
217
256
|
context 'when the jobflow is already running' do
|
@@ -312,7 +351,7 @@ describe Elasticity::JobFlow do
|
|
312
351
|
before do
|
313
352
|
jobflow_with_steps.log_uri = '_'
|
314
353
|
jobflow_with_steps.enable_debugging = true
|
315
|
-
aws_steps.insert(0, Elasticity::SetupHadoopDebuggingStep.new.to_aws_step(jobflow_with_steps))
|
354
|
+
aws_steps.insert(0, Elasticity::SetupHadoopDebuggingStep.new('us-east-1').to_aws_step(jobflow_with_steps))
|
316
355
|
end
|
317
356
|
it 'should incorporate the step to setup Hadoop debugging' do
|
318
357
|
jobflow_with_steps.send(:jobflow_config).should be_a_hash_including({:steps => aws_steps})
|
@@ -515,6 +554,27 @@ describe Elasticity::JobFlow do
|
|
515
554
|
end
|
516
555
|
end
|
517
556
|
|
557
|
+
describe 'aws_configurations' do
|
558
|
+
let(:configuration) {
|
559
|
+
{ 'Classification' => 'spark',
|
560
|
+
'Properties' => { 'prop' => 'valule'} }
|
561
|
+
}
|
562
|
+
|
563
|
+
let(:emr) { double(Elasticity::EMR, run_job_flow: true) }
|
564
|
+
|
565
|
+
before do
|
566
|
+
subject.stub(:emr).and_return(emr)
|
567
|
+
end
|
568
|
+
|
569
|
+
context 'with configurations' do
|
570
|
+
it 'sets the configurations as a part of its config' do
|
571
|
+
subject.instance_variable_set(:@aws_configurations, [configuration])
|
572
|
+
config = subject.send(:jobflow_config)
|
573
|
+
expect(config[:configurations]).to eql([configuration])
|
574
|
+
end
|
575
|
+
end
|
576
|
+
|
577
|
+
end
|
518
578
|
end
|
519
579
|
|
520
580
|
describe '#jobflow_instance_groups' do
|
@@ -1,14 +1,18 @@
|
|
1
1
|
describe Elasticity::SetupHadoopDebuggingStep do
|
2
2
|
|
3
|
+
subject do
|
4
|
+
Elasticity::SetupHadoopDebuggingStep.new('us-east-1')
|
5
|
+
end
|
6
|
+
|
3
7
|
it 'should be a CustomJarStep' do
|
4
8
|
expect(subject).to be_a(Elasticity::CustomJarStep)
|
5
9
|
end
|
6
10
|
|
7
11
|
it 'should set the appropriate fields' do
|
8
12
|
expect(subject.name).to eql('Elasticity Setup Hadoop Debugging')
|
9
|
-
expect(subject.jar).to eql('s3://elasticmapreduce/libs/script-runner/script-runner.jar')
|
10
|
-
expect(subject.arguments).to eql(['s3://elasticmapreduce/libs/state-pusher/0.1/fetch'])
|
13
|
+
expect(subject.jar).to eql('s3://us-east-1.elasticmapreduce/libs/script-runner/script-runner.jar')
|
14
|
+
expect(subject.arguments).to eql(['s3://us-east-1.elasticmapreduce/libs/state-pusher/0.1/fetch'])
|
11
15
|
expect(subject.action_on_failure).to eql('TERMINATE_JOB_FLOW')
|
12
16
|
end
|
13
17
|
|
14
|
-
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Slifka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: fog
|
28
|
+
name: fog-aws
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|