elasticity 2.5.2 → 2.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +6 -0
- data/README.md +3 -0
- data/lib/elasticity/job_flow.rb +3 -0
- data/lib/elasticity/job_flow_status.rb +11 -2
- data/lib/elasticity/version.rb +1 -1
- data/spec/lib/elasticity/aws_request_spec.rb +4 -0
- data/spec/lib/elasticity/job_flow_integration_spec.rb +3 -0
- data/spec/lib/elasticity/job_flow_spec.rb +9 -0
- data/spec/lib/elasticity/job_flow_status_spec.rb +24 -9
- data/spec/lib/elasticity/sync_to_s3_spec.rb +4 -3
- metadata +2 -2
data/HISTORY.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 2.5.3 - January 16, 2013
|
2
|
+
|
3
|
+
+ Added ```#visible_to_all_users``` to ```JobFlow```. Thanks to [dstumm](https://github.com/dstumm) for the contribution!
|
4
|
+
+ Added ```#ended_at``` to ```JobFlowStatus```.
|
5
|
+
+ Added ```#duration``` calculated field to ```JobFlowStatus```.
|
6
|
+
|
1
7
|
## 2.5.2 - November 29, 2012
|
2
8
|
|
3
9
|
+ Configuration of Hive installations via ```hive_site``` is now supported. See the README.md for details.
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
(2012-11-30) Taking requests! I have a few ideas for what might be cool features though I'd rather work on what the community wants. Go ahead and file an issue!
|
2
|
+
|
1
3
|
Elasticity provides programmatic access to Amazon's Elastic Map Reduce service. The aim is to conveniently abstract away the complex EMR REST API and make working with job flows more productive and more enjoyable.
|
2
4
|
|
3
5
|
[![Build Status](https://secure.travis-ci.org/rslifka/elasticity.png)](http://travis-ci.org/rslifka/elasticity) REE, 1.8.7, 1.9.2, 1.9.3
|
@@ -104,6 +106,7 @@ jobflow.log_uri = nil
|
|
104
106
|
|
105
107
|
jobflow.ec2_key_name = nil
|
106
108
|
jobflow.ec2_subnet_id = nil
|
109
|
+
jobflow.visible_to_all_users = false
|
107
110
|
jobflow.placement = 'us-east-1a'
|
108
111
|
jobflow.instance_count = 2
|
109
112
|
jobflow.master_instance_type = 'm1.small'
|
data/lib/elasticity/job_flow.rb
CHANGED
@@ -18,6 +18,7 @@ module Elasticity
|
|
18
18
|
attr_accessor :keep_job_flow_alive_when_no_steps
|
19
19
|
attr_accessor :ec2_subnet_id
|
20
20
|
attr_accessor :placement
|
21
|
+
attr_accessor :visible_to_all_users
|
21
22
|
|
22
23
|
attr_reader :access_key
|
23
24
|
attr_reader :secret_key
|
@@ -32,6 +33,7 @@ module Elasticity
|
|
32
33
|
|
33
34
|
@access_key = access
|
34
35
|
@secret_key = secret
|
36
|
+
@visible_to_all_users = false
|
35
37
|
|
36
38
|
@bootstrap_actions = []
|
37
39
|
@jobflow_steps = []
|
@@ -154,6 +156,7 @@ module Elasticity
|
|
154
156
|
preamble = {
|
155
157
|
:name => @name,
|
156
158
|
:ami_version => @ami_version,
|
159
|
+
:visible_to_all_users => @visible_to_all_users,
|
157
160
|
:instances => {
|
158
161
|
:keep_job_flow_alive_when_no_steps => @keep_job_flow_alive_when_no_steps,
|
159
162
|
:hadoop_version => @hadoop_version,
|
@@ -9,6 +9,8 @@ module Elasticity
|
|
9
9
|
attr_accessor :created_at
|
10
10
|
attr_accessor :started_at
|
11
11
|
attr_accessor :ready_at
|
12
|
+
attr_accessor :ended_at
|
13
|
+
attr_accessor :duration
|
12
14
|
attr_accessor :instance_count
|
13
15
|
attr_accessor :master_instance_type
|
14
16
|
attr_accessor :slave_instance_type
|
@@ -40,11 +42,18 @@ module Elasticity
|
|
40
42
|
|
41
43
|
jobflow.created_at = Time.parse(xml_element.xpath('./ExecutionStatusDetail/CreationDateTime').text.strip)
|
42
44
|
|
45
|
+
ready_at = xml_element.xpath('./ExecutionStatusDetail/ReadyDateTime').text.strip
|
46
|
+
jobflow.ready_at = (ready_at == '') ? (nil) : (Time.parse(ready_at))
|
47
|
+
|
43
48
|
started_at = xml_element.xpath('./ExecutionStatusDetail/StartDateTime').text.strip
|
44
49
|
jobflow.started_at = (started_at == '') ? (nil) : (Time.parse(started_at))
|
45
50
|
|
46
|
-
|
47
|
-
jobflow.
|
51
|
+
ended_at = xml_element.xpath('./ExecutionStatusDetail/EndDateTime').text.strip
|
52
|
+
jobflow.ended_at = (ended_at == '') ? (nil) : (Time.parse(ended_at))
|
53
|
+
|
54
|
+
if jobflow.ended_at && jobflow.started_at
|
55
|
+
jobflow.duration = ((jobflow.ended_at - jobflow.started_at) / 60).to_i
|
56
|
+
end
|
48
57
|
|
49
58
|
jobflow.instance_count = xml_element.xpath('./Instances/InstanceCount').text.strip
|
50
59
|
jobflow.master_instance_type = xml_element.xpath('./Instances/MasterInstanceType').text.strip
|
data/lib/elasticity/version.rb
CHANGED
@@ -28,6 +28,7 @@ describe 'Elasticity::JobFlow Integration Examples' do
|
|
28
28
|
:name => 'Elasticity Job Flow',
|
29
29
|
:log_uri => 's3n://slif-test/output/logs',
|
30
30
|
:ami_version => 'latest',
|
31
|
+
:visible_to_all_users => false,
|
31
32
|
:instances => {
|
32
33
|
:keep_job_flow_alive_when_no_steps => false,
|
33
34
|
:hadoop_version => '1.0.3',
|
@@ -115,6 +116,7 @@ describe 'Elasticity::JobFlow Integration Examples' do
|
|
115
116
|
:name => 'Elasticity Job Flow',
|
116
117
|
:log_uri => 's3n://slif-test/output/logs',
|
117
118
|
:ami_version => 'latest',
|
119
|
+
:visible_to_all_users => false,
|
118
120
|
:instances => {
|
119
121
|
:keep_job_flow_alive_when_no_steps => false,
|
120
122
|
:hadoop_version => '1.0.3',
|
@@ -201,6 +203,7 @@ describe 'Elasticity::JobFlow Integration Examples' do
|
|
201
203
|
:name => 'Elasticity Job Flow',
|
202
204
|
:log_uri => 's3n://slif-test/output/logs',
|
203
205
|
:ami_version => 'latest',
|
206
|
+
:visible_to_all_users => false,
|
204
207
|
:instances => {
|
205
208
|
:keep_job_flow_alive_when_no_steps => false,
|
206
209
|
:hadoop_version => '1.0.3',
|
@@ -18,6 +18,7 @@ describe Elasticity::JobFlow do
|
|
18
18
|
its(:ami_version) { should == 'latest' }
|
19
19
|
its(:keep_job_flow_alive_when_no_steps) { should == false }
|
20
20
|
its(:placement) { should == 'us-east-1a' }
|
21
|
+
its(:visible_to_all_users) { should == false }
|
21
22
|
|
22
23
|
describe '.initialize' do
|
23
24
|
it 'should set the access and secret keys to nil by default' do
|
@@ -350,6 +351,7 @@ describe Elasticity::JobFlow do
|
|
350
351
|
{
|
351
352
|
:name => 'Elasticity Job Flow',
|
352
353
|
:ami_version => 'latest',
|
354
|
+
:visible_to_all_users => false,
|
353
355
|
:instances => {
|
354
356
|
:keep_job_flow_alive_when_no_steps => false,
|
355
357
|
:hadoop_version => '1.0.3',
|
@@ -383,6 +385,13 @@ describe Elasticity::JobFlow do
|
|
383
385
|
end
|
384
386
|
end
|
385
387
|
|
388
|
+
context 'when jobflow visibility is modified' do
|
389
|
+
it 'should be reflected in the jobflow settings' do
|
390
|
+
subject.visible_to_all_users = true
|
391
|
+
subject.send(:jobflow_preamble).should be_a_hash_including({:visible_to_all_users => true})
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
386
395
|
end
|
387
396
|
|
388
397
|
describe '#run' do
|
@@ -26,6 +26,14 @@ describe Elasticity::JobFlowStatus do
|
|
26
26
|
XML
|
27
27
|
end
|
28
28
|
|
29
|
+
let(:started_at) do
|
30
|
+
<<-XML
|
31
|
+
<StartDateTime>
|
32
|
+
2011-10-04T21:49:17Z
|
33
|
+
</StartDateTime>
|
34
|
+
XML
|
35
|
+
end
|
36
|
+
|
29
37
|
let(:setup_config) do
|
30
38
|
hive_setup_config
|
31
39
|
end
|
@@ -45,12 +53,13 @@ describe Elasticity::JobFlowStatus do
|
|
45
53
|
<LastStateChangeReason>
|
46
54
|
Steps completed with errors
|
47
55
|
</LastStateChangeReason>
|
48
|
-
|
49
|
-
2011-10-04T21:49:17Z
|
50
|
-
</StartDateTime>
|
56
|
+
#{started_at}
|
51
57
|
<ReadyDateTime>
|
52
58
|
2011-10-04T21:49:18Z
|
53
59
|
</ReadyDateTime>
|
60
|
+
<EndDateTime>
|
61
|
+
2011-10-05T21:49:18Z
|
62
|
+
</EndDateTime>
|
54
63
|
<State>TERMINATED</State>
|
55
64
|
</ExecutionStatusDetail>
|
56
65
|
<Steps>
|
@@ -94,12 +103,6 @@ describe Elasticity::JobFlowStatus do
|
|
94
103
|
<CreationDateTime>
|
95
104
|
2011-10-04T22:49:16Z
|
96
105
|
</CreationDateTime>
|
97
|
-
<StartDateTime>
|
98
|
-
|
99
|
-
</StartDateTime>
|
100
|
-
<ReadyDateTime>
|
101
|
-
|
102
|
-
</ReadyDateTime>
|
103
106
|
<State>
|
104
107
|
TERMINATED
|
105
108
|
</State>
|
@@ -153,12 +156,22 @@ describe Elasticity::JobFlowStatus do
|
|
153
156
|
single_jobflow.created_at.should == Time.parse('2011-10-04T21:49:16Z')
|
154
157
|
single_jobflow.started_at.should == Time.parse('2011-10-04T21:49:17Z')
|
155
158
|
single_jobflow.ready_at.should == Time.parse('2011-10-04T21:49:18Z')
|
159
|
+
single_jobflow.ended_at.should == Time.parse('2011-10-05T21:49:18Z')
|
160
|
+
single_jobflow.duration.should == 1440
|
156
161
|
single_jobflow.master_instance_type.should == 'm1.small'
|
157
162
|
single_jobflow.slave_instance_type.should == 'm1.small'
|
158
163
|
single_jobflow.instance_count.should == '4'
|
159
164
|
single_jobflow.last_state_change_reason.should == 'Steps completed with errors'
|
160
165
|
single_jobflow.master_public_dns_name.should == 'ec2-107-22-77-99.compute-1.amazonaws.com'
|
161
166
|
end
|
167
|
+
|
168
|
+
context 'when the jobflow never started' do
|
169
|
+
let(:started_at) {}
|
170
|
+
it 'should have a nil duration' do
|
171
|
+
single_jobflow.started_at.should == nil
|
172
|
+
single_jobflow.duration.should == nil
|
173
|
+
end
|
174
|
+
end
|
162
175
|
end
|
163
176
|
|
164
177
|
describe '.from_jobflows_nodeset' do
|
@@ -169,6 +182,8 @@ describe Elasticity::JobFlowStatus do
|
|
169
182
|
multiple_jobflows.map(&:created_at).should == [Time.parse('2011-10-04T21:49:16Z'), Time.parse('2011-10-04T22:49:16Z')]
|
170
183
|
multiple_jobflows.map(&:started_at).should == [Time.parse('2011-10-04T21:49:17Z'), nil]
|
171
184
|
multiple_jobflows.map(&:ready_at).should == [Time.parse('2011-10-04T21:49:18Z'), nil]
|
185
|
+
multiple_jobflows.map(&:ended_at).should == [Time.parse('2011-10-05T21:49:18Z'), nil]
|
186
|
+
multiple_jobflows.map(&:duration).should == [1440, nil]
|
172
187
|
multiple_jobflows.map(&:master_instance_type).should == %w(m1.small c1.medium)
|
173
188
|
multiple_jobflows.map(&:slave_instance_type).should == %w(m1.small c1.medium)
|
174
189
|
multiple_jobflows.map(&:instance_count).should == %w(4 2)
|
@@ -181,9 +181,10 @@ describe Elasticity::SyncToS3 do
|
|
181
181
|
it 'should not write identical content' do
|
182
182
|
sync_to_s3.send(:sync_file, full_path, remote_dir)
|
183
183
|
last_modified = s3.directories[0].files.head(remote_path).last_modified
|
184
|
-
Timecop.
|
185
|
-
|
186
|
-
|
184
|
+
Timecop.freeze(Time.now + 60) do
|
185
|
+
sync_to_s3.send(:sync_file, full_path, remote_dir)
|
186
|
+
s3.directories[0].files.head(remote_path).last_modified.should == last_modified
|
187
|
+
end
|
187
188
|
end
|
188
189
|
|
189
190
|
context 'when remote dir is a corner case value' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|