elasticity 6.0.12 → 6.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f96e8b15d696c580e01a6957b7981806190c86ef
4
- data.tar.gz: aa9fc8328096b4fc7cf0649b0bb3f82eaf416e8f
3
+ metadata.gz: 790344a0151805b2c9d98ab1a5550da16098a618
4
+ data.tar.gz: ac2ca4a93b59437f4fdb904bc5d7985c3914c4e2
5
5
  SHA512:
6
- metadata.gz: 709475923787784aaf6e38c3825a730cf462966b3cf7c10c1f26314d259743e21b462a2d3f36e4d4e077a79b16ec62da65d058ffbd8bdb78ccf915f994a3da36
7
- data.tar.gz: 4b5a0731398a0e7cf22f144c853a99d76fbc27ed3cbbf0d18c9ed46d1a4803e76d9872833fb86a96fb4cb23393b0315b74d84eee418e45838ad48a33ace0d2df
6
+ metadata.gz: 027b587b86c8065a88b6cf614a646677c5ed36c317a88ce90b43c22bbc52ea39fe8b2e4cb12f77b02694a5992261b744721b872dfbe0650610c439063aeb5de6
7
+ data.tar.gz: d54e84b75052fcf456cfb4a98f8532e7328b45479551064a3cacbd6d0eeaa4356447accc85ff67ffd613d5a1246796a6a260317b5acd1afb4ff9ea19bea54641
data/.travis.yml CHANGED
@@ -5,4 +5,4 @@ rvm:
5
5
  before_install:
6
6
  - gem update --system
7
7
  - gem --version
8
- - gem install bundler
8
+ - gem install bundler -v 1.17.3
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 6.0.13 - January 17, 2019
2
+
3
+ - Including PR [#141](https://github.com/rslifka/elasticity/pull/140) - "Add the ability to customize timeouts ". Thank you [@BenFradet ](https://github.com/BenFradet )!
4
+
1
5
  ## 6.0.12 - February 7, 2017
2
6
 
3
7
  - Including PR [#140](https://github.com/rslifka/elasticity/pull/140) - "Update fog". Thank you [@BenFradet ](https://github.com/BenFradet )!
@@ -61,7 +65,7 @@ On the API side, all of the newer commands take `cluster_id` rather than `job_fl
61
65
 
62
66
  They've also begun deprecating APIs, starting with `DescribeJobFlows`. Given the sweeping set of changes, a major release was deemed appropriate.
63
67
 
64
- - [#88](https://github.com/rslifka/elasticity/issues/88) - Removed support for deprecated `DescribeJobFlows`.
68
+ - [#88](https://github.com/rslifka/elasticity/issues/88) - Removed support for deprecated `DescribeJobFlows`.
65
69
  - [#89](https://github.com/rslifka/elasticity/issues/89) - Add support for `AddTags`.
66
70
  - [#90](https://github.com/rslifka/elasticity/issues/90) - Add support for `RemoveTags`.
67
71
  - [#91](https://github.com/rslifka/elasticity/issues/91) - Add support for `SetVisibleToAllUsers`.
@@ -232,7 +236,7 @@ They've also begun deprecating APIs, starting with `DescribeJobFlows`. Given th
232
236
  ## 2.1 - July 7, 2012
233
237
 
234
238
  + TASK instance group support added.
235
- + SPOT instance support added for all instance group types.
239
+ + SPOT instance support added for all instance group types.
236
240
  + Removed name of jar from default name of ```CustomJarStep``` since the AWS UI already calls it out in a separate column when looking at job flow steps.
237
241
 
238
242
  ## 2.0 - June 26, 2012
@@ -8,10 +8,12 @@ module Elasticity
8
8
 
9
9
  attr_reader :host
10
10
  attr_reader :region
11
+ attr_reader :timeout
11
12
 
12
13
  # Supported values for options:
13
14
  # :region - AWS region (e.g. us-west-1)
14
15
  # :secure - true or false, default true.
16
+ # :timeout - the timeout, in seconds, when making a request to EMR, default 60.
15
17
  def initialize(options={})
16
18
  # There is a cryptic error if this isn't set
17
19
  if options.has_key?(:region) && options[:region] == nil
@@ -21,12 +23,21 @@ module Elasticity
21
23
  @region = options[:region]
22
24
 
23
25
  @host = "elasticmapreduce.#@region.amazonaws.com"
26
+
27
+ options[:timeout] = 60 unless options[:timeout]
28
+ @timeout = options[:timeout]
24
29
  end
25
30
 
26
31
  def submit(ruby_service_hash)
27
32
  aws_request = AwsRequestV4.new(self, ruby_service_hash)
28
33
  begin
29
- RestClient.post(aws_request.url, aws_request.payload, aws_request.headers)
34
+ RestClient.execute(
35
+ :method => :post,
36
+ :url => aws_request.url,
37
+ :payload => aws_request.payload,
38
+ :headers => aws_request.headers,
39
+ :timeout => @timeout
40
+ )
30
41
  rescue RestClient::BadRequest => e
31
42
  type, message = AwsSession.parse_error_response(e.http_body)
32
43
  raise ThrottlingException, message if type == 'ThrottlingException'
@@ -33,6 +33,7 @@ module Elasticity
33
33
  attr_accessor :additional_info
34
34
  attr_accessor :additional_master_security_groups
35
35
  attr_accessor :additional_slave_security_groups
36
+ attr_accessor :timeout
36
37
 
37
38
  def initialize
38
39
  @action_on_failure = 'TERMINATE_JOB_FLOW'
@@ -55,6 +56,8 @@ module Elasticity
55
56
  @instance_count = 2
56
57
  @master_instance_type = 'm1.small'
57
58
  @slave_instance_type = 'm1.small'
59
+
60
+ @timeout = 60
58
61
  end
59
62
 
60
63
  def self.from_jobflow_id(jobflow_id, region = 'us-east-1')
@@ -207,7 +210,7 @@ module Elasticity
207
210
  end
208
211
 
209
212
  def emr
210
- @emr ||= Elasticity::EMR.new(:region => @region)
213
+ @emr ||= Elasticity::EMR.new(:region => @region, :timeout => @timeout)
211
214
  end
212
215
 
213
216
  def is_jobflow_running?
@@ -1,3 +1,3 @@
1
1
  module Elasticity
2
- VERSION = '6.0.12'
2
+ VERSION = '6.0.13'
3
3
  end
@@ -144,7 +144,7 @@ describe Elasticity::AwsRequestV4 do
144
144
 
145
145
  describe '.aws_v4_signature' do
146
146
  it 'should create the proper signature' do
147
- subject.send(:aws_v4_signature).should == '71d7f2adf5b01990b09d7d10910b9a0312ded30bacf05ea8e8a05cc72ab389d1'
147
+ subject.send(:aws_v4_signature).should == '86798537f9f4310015aac337d493c4b4abb5113109e04a9898c845d09d2d8bdf'
148
148
  end
149
149
  end
150
150
 
@@ -35,6 +35,18 @@ describe Elasticity::AwsSession do
35
35
  end
36
36
  end
37
37
 
38
+ context 'when :timeout is specified' do
39
+ it 'should be assigned' do
40
+ Elasticity::AwsSession.new(:region => 'TEST_REGION', :timeout => 120).timeout.should == 120
41
+ end
42
+ end
43
+
44
+ context 'when :timeout is not specified' do
45
+ it 'should be 60' do
46
+ Elasticity::AwsSession.new(:region => 'TEST_REGION').timeout.should == 60
47
+ end
48
+ end
49
+
38
50
  end
39
51
 
40
52
  describe '#host' do
@@ -66,7 +78,13 @@ describe Elasticity::AwsSession do
66
78
  @request.should_receive(:headers).and_return('TEST_HEADERS')
67
79
 
68
80
  Elasticity::AwsRequestV4.should_receive(:new).with(subject, {}).and_return(@request)
69
- RestClient.should_receive(:post).with('TEST_URL', 'TEST_PAYLOAD', 'TEST_HEADERS')
81
+ RestClient.should_receive(:execute).with(
82
+ :method => :post,
83
+ :url => 'TEST_URL',
84
+ :payload => 'TEST_PAYLOAD',
85
+ :headers => 'TEST_HEADERS',
86
+ :timeout => 60
87
+ )
70
88
  end
71
89
 
72
90
  it 'should POST a properly assembled request' do
@@ -89,7 +107,7 @@ describe Elasticity::AwsSession do
89
107
  end
90
108
 
91
109
  it 'should raise an Argument error with the body of the error' do
92
- RestClient.should_receive(:post).and_raise(error)
110
+ RestClient.should_receive(:execute).and_raise(error)
93
111
  expect {
94
112
  subject.submit({})
95
113
  }.to raise_error(ArgumentError, "AWS EMR API Error (#{error_type}): #{error_message}")
@@ -98,7 +116,7 @@ describe Elasticity::AwsSession do
98
116
  context 'EMR API rate limit hit' do
99
117
  let(:error_type) { 'ThrottlingException' }
100
118
  it 'should raise a Throttling error with the body of the error' do
101
- RestClient.should_receive(:post).and_raise(error)
119
+ RestClient.should_receive(:execute).and_raise(error)
102
120
  expect {
103
121
  subject.submit({})
104
122
  }.to raise_error(Elasticity::ThrottlingException, "AWS EMR API Error (#{error_type}): #{error_message}")
@@ -3,7 +3,8 @@ describe 'Elasticity::JobFlow Integration Examples' do
3
3
  let(:emr) { double('Elasticity::EMR') }
4
4
 
5
5
  before do
6
- Elasticity::EMR.should_receive(:new).with(:region => 'us-west-1').and_return(emr)
6
+ Elasticity::EMR.should_receive(:new).with(:region => 'us-west-1', :timeout => 60)
7
+ .and_return(emr)
7
8
  end
8
9
 
9
10
  describe 'Hive' do
@@ -243,4 +244,4 @@ describe 'Elasticity::JobFlow Integration Examples' do
243
244
 
244
245
  end
245
246
 
246
- end
247
+ end
@@ -30,6 +30,7 @@ describe Elasticity::JobFlow do
30
30
  expect(subject.jobflow_id).to eql(nil)
31
31
  expect(subject.additional_master_security_groups).to eql(nil)
32
32
  expect(subject.additional_slave_security_groups).to eql(nil)
33
+ expect(subject.timeout).to eql(60)
33
34
  end
34
35
  end
35
36
 
@@ -708,7 +709,7 @@ describe Elasticity::JobFlow do
708
709
  let(:emr) { double('Elasticity::EMR', :run_job_flow => 'JOBFLOW_ID') }
709
710
 
710
711
  it 'should run the job with the supplied EMR credentials' do
711
- Elasticity::EMR.stub(:new).with(:region => 'us-east-1').and_return(emr)
712
+ Elasticity::EMR.stub(:new).with(:region => 'us-east-1', :timeout => 60).and_return(emr)
712
713
  emr.should_receive(:run_job_flow)
713
714
  jobflow_with_steps.run
714
715
  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.12
4
+ version: 6.0.13
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-06-14 00:00:00.000000000 Z
11
+ date: 2019-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client