ruby-aws 1.6.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +4 -0
- data.tar.gz.sig +0 -0
- data/{History.txt → History.md} +16 -0
- data/Manifest.txt +2 -2
- data/NOTICE.txt +1 -1
- data/{README.txt → README.md} +2 -2
- data/Rakefile +2 -2
- data/lib/amazon/util/data_reader.rb +2 -2
- data/lib/amazon/util/user_data_store.rb +1 -1
- data/lib/amazon/webservices/mechanical_turk_requester.rb +13 -2
- data/lib/amazon/webservices/mturk/mechanical_turk_error_handler.rb +9 -6
- data/lib/ruby-aws/version.rb +2 -2
- data/samples/mturk/reviewer/Reviewer.rb +1 -1
- data/samples/mturk/simple_survey/SimpleSurvey.rb +14 -7
- data/samples/mturk/site_category/site_category.properties +9 -1
- data/test/mturk/test_error_handler.rb +285 -19
- metadata +59 -72
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 95dee8cb700ed6360aaabd138e3b63958e0d2196
|
4
|
+
data.tar.gz: f3e9386d6974434ac4bda8cd54c28a9a39c7622c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f1403ccfc9c3082692ede2791110dac1b9f587d7194b5d74dfe2a3823f6874fd7dac9dfd5fa3a1eab9822e037c8386fe8845b92ebd6f3d3f56f53b3ef8722736
|
7
|
+
data.tar.gz: 960a5ad5fef9d51f9759b3174e3afbfd40068c4b81037ed6d17b7bb8bee751cc4e87743377c619229c114212827c88f382c7c18de88fd17689791df8a183f18c
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
CHANGED
Binary file
|
data/{History.txt → History.md}
RENAMED
@@ -1,3 +1,19 @@
|
|
1
|
+
== 1.7.1 / 2014-10-20
|
2
|
+
|
3
|
+
=== 1 minor update
|
4
|
+
* Correctly generate version.rb
|
5
|
+
|
6
|
+
== 1.7.0 / 2014-10-17
|
7
|
+
|
8
|
+
=== 1 major enhancement
|
9
|
+
* Update MechanicalTurk WSDL version to 2013-11-15 (Qualification Requirement Set Comparators: In/NotIn/DoesNotExist)
|
10
|
+
|
11
|
+
=== 4 minor updates
|
12
|
+
* Improve retriable error detection
|
13
|
+
* Add constants for new QualificationTypeIds
|
14
|
+
* Updates for Hoe and Ruby deprecations
|
15
|
+
* Rename markdown files w/ .md extension
|
16
|
+
|
1
17
|
== 1.6.0 / 2012-08-23
|
2
18
|
|
3
19
|
=== 1 major enhancement
|
data/Manifest.txt
CHANGED
data/NOTICE.txt
CHANGED
data/{README.txt → README.md}
RENAMED
@@ -86,11 +86,11 @@ Amazon Web Services, please visit our {Rubyforge project page}[http://rubyforge.
|
|
86
86
|
|
87
87
|
If you have any comments, questions, or feedback concerning the Mechanical
|
88
88
|
Turk service in general, please visit the {Amazon Mechanical Turk discussion
|
89
|
-
forums}[
|
89
|
+
forums}[https://forums.aws.amazon.com/forum.jspa?forumID=11]
|
90
90
|
|
91
91
|
== License
|
92
92
|
|
93
|
-
Copyright (c) 2007 Amazon Technologies, Inc.
|
93
|
+
Copyright (c) 2007-2014 Amazon Technologies, Inc.
|
94
94
|
|
95
95
|
Licensed under the Apache License, Version 2.0 (the "License");
|
96
96
|
you may not use this file except in compliance with the License.
|
data/Rakefile
CHANGED
@@ -6,8 +6,8 @@ require './lib/ruby-aws/version.rb'
|
|
6
6
|
|
7
7
|
Hoe.spec 'ruby-aws' do
|
8
8
|
self.version = RubyAWS::VERSION.dup
|
9
|
-
self.rubyforge_name = 'ruby-aws'
|
10
9
|
developer 'David J Parrott', 'valthon@nothlav.net'
|
10
|
+
license 'APLv2'
|
11
11
|
extra_deps << ['highline','>= 1.2.7']
|
12
12
|
extra_deps << ['nokogiri','>= 1.4']
|
13
13
|
need_tar
|
@@ -21,7 +21,7 @@ end
|
|
21
21
|
task :gitversion do
|
22
22
|
gv = `git describe --dirty`.chomp.gsub(/^v/,'').gsub('-','.')
|
23
23
|
File.open('lib/ruby-aws/version.rb', File::WRONLY | File::CREAT | File::TRUNC ) do |f|
|
24
|
-
f << "# Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.\n"
|
24
|
+
f << "# Copyright:: Copyright (c) 2007-2014 Amazon Technologies, Inc.\n"
|
25
25
|
f << "# License:: Apache License, Version 2.0\n"
|
26
26
|
f << "\n"
|
27
27
|
f << "module RubyAWS\n"
|
@@ -32,7 +32,7 @@ class DataReader
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def load( filename, format=:Tabular )
|
35
|
-
return {} unless File.
|
35
|
+
return {} unless File.exist? filename
|
36
36
|
raw_data = File.read( filename )
|
37
37
|
case format
|
38
38
|
when :Tabular
|
@@ -50,7 +50,7 @@ class DataReader
|
|
50
50
|
|
51
51
|
def save( filename, format=:Tabular, force_headers=false )
|
52
52
|
return if @data.nil? or @data.empty?
|
53
|
-
existing = File.
|
53
|
+
existing = File.exist?( filename ) && File.size( filename ) > 0
|
54
54
|
File.open( filename, 'a+' ) {|f|
|
55
55
|
f << case format
|
56
56
|
when :Tabular
|
@@ -64,7 +64,7 @@ class UserDataStore
|
|
64
64
|
def saveNamespace(name)
|
65
65
|
filename = File.join( @base, name )
|
66
66
|
# kill old config before saving
|
67
|
-
File.delete filename if File.
|
67
|
+
File.delete filename if File.exist? filename
|
68
68
|
# now save out the data
|
69
69
|
DataReader.save( filename, @data[name], :Properties ) unless @data[name].keys.empty?
|
70
70
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
|
1
|
+
# Copyright:: Copyright (c) 2007-2014 Amazon Technologies, Inc.
|
2
2
|
# License:: Apache License, Version 2.0
|
3
3
|
|
4
4
|
require 'erb'
|
@@ -13,14 +13,25 @@ module WebServices
|
|
13
13
|
|
14
14
|
class MechanicalTurkRequester < Amazon::WebServices::Util::ConvenienceWrapper
|
15
15
|
|
16
|
-
WSDL_VERSION = "
|
16
|
+
WSDL_VERSION = "2013-11-15"
|
17
17
|
|
18
|
+
# Deprecated qualification type IDs
|
18
19
|
ABANDONMENT_RATE_QUALIFICATION_TYPE_ID = "00000000000000000070";
|
19
20
|
APPROVAL_RATE_QUALIFICATION_TYPE_ID = "000000000000000000L0";
|
20
21
|
REJECTION_RATE_QUALIFICATION_TYPE_ID = "000000000000000000S0";
|
21
22
|
RETURN_RATE_QUALIFICATION_TYPE_ID = "000000000000000000E0";
|
22
23
|
SUBMISSION_RATE_QUALIFICATION_TYPE_ID = "00000000000000000000";
|
24
|
+
|
25
|
+
# Current qualification type IDs
|
23
26
|
LOCALE_QUALIFICATION_TYPE_ID = "00000000000000000071";
|
27
|
+
TOTAL_NUMBER_OF_HITS_APPROVED_QUALIFICATION_TYPE_ID = "00000000000000000040";
|
28
|
+
ADULT_QUALIFICATION_TYPE_ID = "00000000000000000060";
|
29
|
+
PHOTO_MODERATION_MASTERS_QUALIFICATION_TYPE_ID = "21VZU98JHSTLZ5BPP4A9NOBJEK3DPG";
|
30
|
+
PHOTO_MODERATION_MASTERS_SANDBOX_QUALIFICATION_TYPE_ID = "2TGBB6BFMFFOM08IBMAFGGESC1UWJX";
|
31
|
+
CATEGORIZATION_MASTERS_QUALIFICATION_TYPE_ID = "2NDP2L92HECWY8NS8H3CK0CP5L9GHO";
|
32
|
+
CATEGORIZATION_MASTERS_SANDBOX_QUALIFICATION_TYPE_ID = "2F1KVCNHMVHV8E9PBUB2A4J79LU20F";
|
33
|
+
MASTERS_QUALIFICATION_TYPE_ID = "2F1QJWKUDD8XADTFD2Q0G6UTO95ALH";
|
34
|
+
MASTERS_SANDBOX_QUALIFICATION_TYPE_ID = "2ARFPLSP75KLA8M8DH1HTEQVJT3SY6";
|
24
35
|
|
25
36
|
DEFAULT_THREADCOUNT = 10
|
26
37
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
|
1
|
+
# Copyright:: Copyright (c) 2007-2014 Amazon Technologies, Inc.
|
2
2
|
# License:: Apache License, Version 2.0
|
3
3
|
|
4
4
|
require 'amazon/util/logging'
|
@@ -45,7 +45,7 @@ class MechanicalTurkErrorHandler
|
|
45
45
|
validateResponse( response )
|
46
46
|
return response
|
47
47
|
rescue Exception => error
|
48
|
-
case handleError( error,method )
|
48
|
+
case handleError( error,method,args )
|
49
49
|
when :RetryWithBackoff
|
50
50
|
retry if doBackoff( try )
|
51
51
|
when :RetryImmediate
|
@@ -70,11 +70,14 @@ class MechanicalTurkErrorHandler
|
|
70
70
|
return false
|
71
71
|
end
|
72
72
|
|
73
|
-
def handleError( error, method )
|
73
|
+
def handleError( error, method, args )
|
74
74
|
log "Handling error: #{error.inspect}"
|
75
|
+
idempotent = args.none? {|params| params[:UniqueRequestToken].nil? || params[:UniqueRequestToken].empty? }
|
76
|
+
retryable = methodRetryable( method ) || idempotent
|
77
|
+
|
75
78
|
case error.class.to_s
|
76
|
-
when 'Timeout::Error','SOAP::HTTPStreamError'
|
77
|
-
if
|
79
|
+
when 'Timeout::Error','SOAP::HTTPStreamError','Errno::ECONNRESET','Errno::EPIPE'
|
80
|
+
if retryable
|
78
81
|
return :RetryImmediate
|
79
82
|
else
|
80
83
|
return :Unknown
|
@@ -89,7 +92,7 @@ class MechanicalTurkErrorHandler
|
|
89
92
|
when 'Amazon::WebServices::Util::ValidationException'
|
90
93
|
case error.message
|
91
94
|
when 'AWS.ServiceUnavailable'
|
92
|
-
return :RetryWithBackoff if
|
95
|
+
return :RetryWithBackoff if retryable
|
93
96
|
end
|
94
97
|
return :Fail
|
95
98
|
when 'RuntimeError'
|
data/lib/ruby-aws/version.rb
CHANGED
@@ -88,7 +88,7 @@ begin
|
|
88
88
|
if @getResults
|
89
89
|
raise "missing input file" unless @inputFile
|
90
90
|
raise "missing output file" unless @outputFile
|
91
|
-
raise "input file does not exist: #{@inputFile}" unless File.
|
91
|
+
raise "input file does not exist: #{@inputFile}" unless File.exist? @inputFile
|
92
92
|
end
|
93
93
|
rescue => e
|
94
94
|
puts e.message
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
# Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
|
3
|
+
# Copyright:: Copyright (c) 2007-2014 Amazon Technologies, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
|
6
6
|
begin ; require 'rubygems' ; rescue LoadError ; end
|
@@ -50,14 +50,21 @@ def createSimpleSurvey
|
|
50
50
|
questionFile = rootDir + "/simple_survey.question"
|
51
51
|
|
52
52
|
|
53
|
-
# This is an example of
|
54
|
-
# This is a built-in qualification -- user must be based in the
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
# This is an example of using qualification requirements.
|
54
|
+
# This is a built-in qualification -- user must be based in the United States, Canada, or Great Britain
|
55
|
+
locationQualReq = { :QualificationTypeId => Amazon::WebServices::MechanicalTurkRequester::LOCALE_QUALIFICATION_TYPE_ID,
|
56
|
+
:Comparator => 'In',
|
57
|
+
:LocaleValue => [{:Country => 'US'},
|
58
|
+
{:Country => 'CA'},
|
59
|
+
{:Country => 'GB'}] }
|
60
|
+
|
61
|
+
# This is a built-in qualification -- user must have had greater than 1000 HTIs approved
|
62
|
+
numHITsApprovedQualReq = { :QualificationTypeId => Amazon::WebServices::MechanicalTurkRequester::NUMBER_OF_HITS_APPROVED_QUALIFICATION_TYPE_ID,
|
63
|
+
:Comparator => 'GreaterThan',
|
64
|
+
:IntegerValue => 1000 }
|
58
65
|
|
59
66
|
# The create HIT method takes in an array of QualificationRequirements since a HIT can have multiple qualifications.
|
60
|
-
qualReqs = [
|
67
|
+
qualReqs = [locationQualReq, numHITsApprovedQualReq]
|
61
68
|
|
62
69
|
# Loading the question (QuestionForm) file
|
63
70
|
question = File.read( questionFile )
|
@@ -30,7 +30,7 @@ AutoApprovalDelayInSeconds:3600
|
|
30
30
|
## Qualification Properties
|
31
31
|
######################################
|
32
32
|
|
33
|
-
# In this example, two system qualifications are specified for the HIT.
|
33
|
+
# In this example, two system qualifications and one location qualification are specified for the HIT.
|
34
34
|
|
35
35
|
# this is a built-in qualification -- user must have an approval rate of 25% or greater
|
36
36
|
QualificationRequirement.1.QualificationTypeId:000000000000000000L0
|
@@ -43,3 +43,11 @@ QualificationRequirement.2.QualificationTypeId:00000000000000000070
|
|
43
43
|
QualificationRequirement.2.Comparator:LessThan
|
44
44
|
QualificationRequirement.2.IntegerValue:51
|
45
45
|
QualificationRequirement.2.RequiredToPreview:true
|
46
|
+
|
47
|
+
# this is a built-in qualification -- user must be based in the United States, Canada, or Great Britain
|
48
|
+
QualificationRequirement.3.QualificationTypeId:00000000000000000071
|
49
|
+
QualificationRequirement.3.Comparator:In
|
50
|
+
QualificationRequirement.3.LocaleValue.1.Country:US
|
51
|
+
QualificationRequirement.3.LocaleValue.2.Country:CA
|
52
|
+
QualificationRequirement.3.LocaleValue.3.Country:GB
|
53
|
+
QualificationRequirement.3.RequiredToPreview:true
|
@@ -1,56 +1,83 @@
|
|
1
|
-
# Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
|
1
|
+
# Copyright:: Copyright (c) 2007-2014 Amazon Technologies, Inc.
|
2
2
|
# License:: Apache License, Version 2.0
|
3
3
|
|
4
4
|
require 'test/unit/testcase'
|
5
5
|
require 'ruby-aws'
|
6
6
|
require 'amazon/webservices/util/mock_transport'
|
7
7
|
require 'timeout'
|
8
|
+
require 'amazon/webservices/util/validation_exception'
|
8
9
|
|
9
10
|
class TestErrorHandler < Test::Unit::TestCase
|
11
|
+
RETRYABLE_ATTEMPT_COUNT = 7
|
10
12
|
|
11
13
|
def setup
|
12
14
|
@mock = Amazon::WebServices::Util::MockTransport.new
|
13
15
|
@mturk = Amazon::WebServices::MechanicalTurkRequester.new( :Transport => @mock, :AWSAccessKey => 'bogus', :AWSAccessKeyId => 'fake' )
|
14
16
|
end
|
15
17
|
|
16
|
-
def
|
17
|
-
|
18
|
+
def testTimeoutOnceRetryable
|
18
19
|
# mock will timeout first time, return success on second call
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
sleep(5)
|
27
|
-
end
|
20
|
+
should_fail = true
|
21
|
+
@mock.listen do |call|
|
22
|
+
Timeout.timeout(1) do
|
23
|
+
if should_fail
|
24
|
+
should_fail = false
|
25
|
+
sleep(2)
|
26
|
+
end
|
28
27
|
end
|
29
28
|
nil
|
30
29
|
end
|
31
30
|
|
32
|
-
assert_equal false, toggle
|
33
31
|
# invoke a retryable call once, should auto-retry and return success
|
34
32
|
@mturk.getAccountBalance
|
35
33
|
assert_equal 2, @mock.call_buffer.size, "Should have retried once"
|
36
34
|
@mock.each {|call| assert_equal :GetAccountBalance, call.name, "Should have been a GetAccountBalance call" }
|
35
|
+
end
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
def testTimeoutOnceNotRetryable
|
38
|
+
# mock will timeout first time, return success on second call
|
39
|
+
should_fail = true
|
40
|
+
@mock.listen do |call|
|
41
|
+
Timeout.timeout(1) do
|
42
|
+
if should_fail
|
43
|
+
should_fail = false
|
44
|
+
sleep(2)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
|
50
|
+
# invoking a non-retryable call will throw an exception
|
41
51
|
begin
|
42
52
|
@mturk.grantBonus
|
43
53
|
fail "Should have thrown an exception"
|
44
54
|
rescue Timeout::Error
|
45
55
|
# expect this exception
|
46
56
|
end
|
47
|
-
assert_equal true, toggle
|
48
57
|
assert_equal :GrantBonus, @mock.next.name
|
49
58
|
assert_nil @mock.next
|
50
59
|
end
|
51
60
|
|
52
|
-
def
|
61
|
+
def testTimeoutOnceRetryableUniqueRequestToken
|
62
|
+
# mock will timeout first time, return success on second call
|
63
|
+
should_fail = true
|
64
|
+
@mock.listen do |call|
|
65
|
+
Timeout.timeout(1) do
|
66
|
+
if should_fail
|
67
|
+
should_fail = false
|
68
|
+
sleep(2)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
nil
|
72
|
+
end
|
53
73
|
|
74
|
+
# invoke call with an idempotency once, should auto-retry and return success
|
75
|
+
@mturk.grantBonus :UniqueRequestToken => 'UniqueTokenValue'
|
76
|
+
assert_equal 2, @mock.call_buffer.size, "Should have retried once"
|
77
|
+
@mock.each {|call| assert_equal :GrantBonus, call.name, "Should have been a GrantBonus call" }
|
78
|
+
end
|
79
|
+
|
80
|
+
def testTimeoutAlways
|
54
81
|
#mock will always timeout
|
55
82
|
@mock.listen do |call|
|
56
83
|
Timeout.timeout(1) { sleep(2) }
|
@@ -63,12 +90,251 @@ class TestErrorHandler < Test::Unit::TestCase
|
|
63
90
|
# expect this exception
|
64
91
|
end
|
65
92
|
|
66
|
-
|
93
|
+
RETRYABLE_ATTEMPT_COUNT.times do
|
94
|
+
assert_equal :SearchHITs, @mock.next.name
|
95
|
+
end
|
96
|
+
assert_nil @mock.next
|
97
|
+
end
|
98
|
+
|
99
|
+
def testResetConnectionOnceRetryable
|
100
|
+
# mock will reset connection first time, return success on second call
|
101
|
+
should_fail = true
|
102
|
+
@mock.listen do |call|
|
103
|
+
if should_fail
|
104
|
+
should_fail = false
|
105
|
+
raise Errno::ECONNRESET
|
106
|
+
end
|
107
|
+
nil
|
108
|
+
end
|
109
|
+
|
110
|
+
# invoke a retryable call once, should auto-retry and return success
|
111
|
+
@mturk.getAccountBalance
|
112
|
+
assert_equal 2, @mock.call_buffer.size, "Should have retried once"
|
113
|
+
@mock.each {|call| assert_equal :GetAccountBalance, call.name, "Should have been a GetAccountBalance call" }
|
114
|
+
end
|
115
|
+
|
116
|
+
def testResetConnectionOnceNotRetryable
|
117
|
+
# mock will reset connection first time, return success on second call
|
118
|
+
should_fail = true
|
119
|
+
@mock.listen do |call|
|
120
|
+
if should_fail
|
121
|
+
should_fail = false
|
122
|
+
raise Errno::ECONNRESET
|
123
|
+
end
|
124
|
+
nil
|
125
|
+
end
|
126
|
+
|
127
|
+
# invoking a non-retryable call will throw an exception
|
128
|
+
begin
|
129
|
+
@mturk.grantBonus
|
130
|
+
fail "Should have thrown an exception"
|
131
|
+
rescue Errno::ECONNRESET
|
132
|
+
# expect this exception
|
133
|
+
end
|
134
|
+
assert_equal :GrantBonus, @mock.next.name
|
135
|
+
assert_nil @mock.next
|
136
|
+
end
|
137
|
+
|
138
|
+
def testResetConnectionOnceRetryableUniqueRequestToken
|
139
|
+
# mock will reset connection first time, return success on second call
|
140
|
+
should_fail = true
|
141
|
+
@mock.listen do |call|
|
142
|
+
if should_fail
|
143
|
+
should_fail = false
|
144
|
+
raise Errno::ECONNRESET
|
145
|
+
end
|
146
|
+
nil
|
147
|
+
end
|
148
|
+
|
149
|
+
# invoke call with an idempotency once, should auto-retry and return success
|
150
|
+
@mturk.grantBonus :UniqueRequestToken => 'UniqueTokenValue'
|
151
|
+
assert_equal 2, @mock.call_buffer.size, "Should have retried once"
|
152
|
+
@mock.each {|call| assert_equal :GrantBonus, call.name, "Should have been a GrantBonus call" }
|
153
|
+
end
|
154
|
+
|
155
|
+
def testResetConnectionAlways
|
156
|
+
#mock will always reset connection
|
157
|
+
@mock.listen do |call|
|
158
|
+
raise Errno::ECONNRESET
|
159
|
+
end
|
160
|
+
|
161
|
+
begin
|
162
|
+
@mturk.searchHITs
|
163
|
+
fail "Should have thrown an exception"
|
164
|
+
rescue Errno::ECONNRESET
|
165
|
+
# expect this exception
|
166
|
+
end
|
167
|
+
|
168
|
+
RETRYABLE_ATTEMPT_COUNT.times do
|
169
|
+
assert_equal :SearchHITs, @mock.next.name
|
170
|
+
end
|
171
|
+
assert_nil @mock.next
|
172
|
+
end
|
173
|
+
|
174
|
+
def testPipeBrokenOnceRetryable
|
175
|
+
# mock will break pipe first time, return success on second call
|
176
|
+
should_fail = true
|
177
|
+
@mock.listen do |call|
|
178
|
+
if should_fail
|
179
|
+
should_fail = false
|
180
|
+
raise Errno::EPIPE
|
181
|
+
end
|
182
|
+
nil
|
183
|
+
end
|
184
|
+
|
185
|
+
# invoke a retryable call once, should auto-retry and return success
|
186
|
+
@mturk.getAccountBalance
|
187
|
+
assert_equal 2, @mock.call_buffer.size, "Should have retried once"
|
188
|
+
@mock.each {|call| assert_equal :GetAccountBalance, call.name, "Should have been a GetAccountBalance call" }
|
189
|
+
end
|
190
|
+
|
191
|
+
def testPipeBrokenOnceNotRetryable
|
192
|
+
# mock will break pipe first time, return success on second call
|
193
|
+
should_fail = true
|
194
|
+
@mock.listen do |call|
|
195
|
+
if should_fail
|
196
|
+
should_fail = false
|
197
|
+
raise Errno::EPIPE
|
198
|
+
end
|
199
|
+
nil
|
200
|
+
end
|
201
|
+
|
202
|
+
# invoking a non-retryable call will throw an exception
|
203
|
+
begin
|
204
|
+
@mturk.grantBonus
|
205
|
+
fail "Should have thrown an exception"
|
206
|
+
rescue Errno::EPIPE
|
207
|
+
# expect this exception
|
208
|
+
end
|
209
|
+
assert_equal :GrantBonus, @mock.next.name
|
210
|
+
assert_nil @mock.next
|
211
|
+
end
|
212
|
+
|
213
|
+
def testPipeBrokenOnceRetryableUniqueRequestToken
|
214
|
+
# mock will reset connection first time, return success on second call
|
215
|
+
should_fail = true
|
216
|
+
@mock.listen do |call|
|
217
|
+
if should_fail
|
218
|
+
should_fail = false
|
219
|
+
raise Errno::EPIPE
|
220
|
+
end
|
221
|
+
nil
|
222
|
+
end
|
223
|
+
|
224
|
+
# invoke call with an idempotency once, should auto-retry and return success
|
225
|
+
@mturk.grantBonus :UniqueRequestToken => 'UniqueTokenValue'
|
226
|
+
assert_equal 2, @mock.call_buffer.size, "Should have retried once"
|
227
|
+
@mock.each {|call| assert_equal :GrantBonus, call.name, "Should have been a GrantBonus call" }
|
228
|
+
end
|
229
|
+
|
230
|
+
def testPipeBrokenAlways
|
231
|
+
#mock will always break pipe
|
232
|
+
@mock.listen do |call|
|
233
|
+
raise Errno::EPIPE
|
234
|
+
end
|
235
|
+
|
236
|
+
begin
|
237
|
+
@mturk.searchHITs
|
238
|
+
fail "Should have thrown an exception"
|
239
|
+
rescue Errno::EPIPE
|
240
|
+
# expect this exception
|
241
|
+
end
|
242
|
+
|
243
|
+
RETRYABLE_ATTEMPT_COUNT.times do
|
67
244
|
assert_equal :SearchHITs, @mock.next.name
|
68
245
|
end
|
69
246
|
assert_nil @mock.next
|
70
247
|
end
|
71
248
|
|
249
|
+
def testServiceUnavailableOnceRetryable
|
250
|
+
# mock will break pipe first time, return success on second call
|
251
|
+
should_fail = true
|
252
|
+
@mock.listen do |call|
|
253
|
+
if should_fail
|
254
|
+
should_fail = false
|
255
|
+
raise Amazon::WebServices::Util::ValidationException.new(nil, 'AWS.ServiceUnavailable')
|
256
|
+
end
|
257
|
+
nil
|
258
|
+
end
|
259
|
+
|
260
|
+
# invoke a retryable call once, should auto-retry and return success
|
261
|
+
@mturk.getAccountBalance
|
262
|
+
assert_equal 2, @mock.call_buffer.size, "Should have retried once"
|
263
|
+
@mock.each {|call| assert_equal :GetAccountBalance, call.name, "Should have been a GetAccountBalance call" }
|
264
|
+
end
|
265
|
+
|
266
|
+
def testServiceUnavailableOnceNotRetryable
|
267
|
+
# mock will break pipe first time, return success on second call
|
268
|
+
should_fail = true
|
269
|
+
@mock.listen do |call|
|
270
|
+
if should_fail
|
271
|
+
should_fail = false
|
272
|
+
raise Amazon::WebServices::Util::ValidationException.new(nil, 'AWS.ServiceUnavailable')
|
273
|
+
end
|
274
|
+
nil
|
275
|
+
end
|
276
|
+
|
277
|
+
# invoking a non-retryable call will throw an exception
|
278
|
+
begin
|
279
|
+
@mturk.grantBonus
|
280
|
+
fail "Should have thrown an exception"
|
281
|
+
rescue Amazon::WebServices::Util::ValidationException
|
282
|
+
# expect this exception
|
283
|
+
end
|
284
|
+
assert_equal :GrantBonus, @mock.next.name
|
285
|
+
assert_nil @mock.next
|
286
|
+
end
|
287
|
+
|
288
|
+
def testServiceUnavailableOnceRetryableUniqueRequestToken
|
289
|
+
# mock will reset connection first time, return success on second call
|
290
|
+
should_fail = true
|
291
|
+
@mock.listen do |call|
|
292
|
+
if should_fail
|
293
|
+
should_fail = false
|
294
|
+
raise Amazon::WebServices::Util::ValidationException.new(nil, 'AWS.ServiceUnavailable')
|
295
|
+
end
|
296
|
+
nil
|
297
|
+
end
|
298
|
+
|
299
|
+
# invoke call with an idempotency once, should auto-retry and return success
|
300
|
+
@mturk.grantBonus :UniqueRequestToken => 'UniqueTokenValue'
|
301
|
+
assert_equal 2, @mock.call_buffer.size, "Should have retried once"
|
302
|
+
@mock.each {|call| assert_equal :GrantBonus, call.name, "Should have been a GrantBonus call" }
|
303
|
+
end
|
304
|
+
|
305
|
+
def testServiceUnavailableAlways
|
306
|
+
#mock will always break pipe
|
307
|
+
@mock.listen do |call|
|
308
|
+
raise Amazon::WebServices::Util::ValidationException.new(nil, 'AWS.ServiceUnavailable')
|
309
|
+
end
|
310
|
+
|
311
|
+
begin
|
312
|
+
@mturk.searchHITs
|
313
|
+
fail "Should have thrown an exception"
|
314
|
+
rescue Amazon::WebServices::Util::ValidationException
|
315
|
+
# expect this exception
|
316
|
+
end
|
317
|
+
|
318
|
+
RETRYABLE_ATTEMPT_COUNT.times do
|
319
|
+
assert_equal :SearchHITs, @mock.next.name
|
320
|
+
end
|
321
|
+
assert_nil @mock.next
|
322
|
+
end
|
323
|
+
|
324
|
+
def testGenericValidationException
|
325
|
+
@mock.listen do |call|
|
326
|
+
raise Amazon::WebServices::Util::ValidationException.new(nil, 'Blah blah')
|
327
|
+
end
|
328
|
+
|
329
|
+
begin
|
330
|
+
@mturk.searchHITs
|
331
|
+
fail "Should have thrown an exception"
|
332
|
+
rescue Amazon::WebServices::Util::ValidationException
|
333
|
+
# expect this exception
|
334
|
+
end
|
335
|
+
assert_equal :SearchHITs, @mock.next.name
|
336
|
+
assert_nil @mock.next
|
337
|
+
end
|
72
338
|
|
73
339
|
def testRuntimeError
|
74
340
|
@mock.listen do |call|
|
metadata
CHANGED
@@ -1,130 +1,118 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.7.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- David J Parrott
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain:
|
12
|
-
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
NUFsbWU1UGpRck5EZ0JZM0krZUxUUWtzaGR2YjdGeGUzb2VMclJCbWlTTWll
|
35
|
-
b25tNyttL21WazEzCjQxN1MreDMycCtNK28rY3ZSVnNxWUNOR3ZadExjQ2dS
|
36
|
-
SzVUdEtjNlJlYVRIRXFUdVNJYmhIWndnc3QrZG15MEkKNk1sS2JmWFkwT0ow
|
37
|
-
OUh0Tm1zQnJobXQ3eldmWFlqaWhCSlRCamZkVHZGa0R3TFhNaDRlckhmVlhk
|
38
|
-
NEU4Z1pyQQpIdTFqVE5ZUi9VMGxLQWJEZUpCV1drNEV4c3VIdVhSOFNKQlpC
|
39
|
-
R1p6Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
40
|
-
date: 2012-09-11 00:00:00.000000000 Z
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDSjCCAjKgAwIBAgIBAjANBgkqhkiG9w0BAQUFADBLMRkwFwYDVQQDDBBydWJ5
|
14
|
+
LWF3cy1kZXZlbG9wMRkwFwYKCZImiZPyLGQBGRYJcnVieWZvcmdlMRMwEQYKCZIm
|
15
|
+
iZPyLGQBGRYDb3JnMB4XDTE0MTAxNzIyMzgyOVoXDTE1MTAxNzIyMzgyOVowSzEZ
|
16
|
+
MBcGA1UEAwwQcnVieS1hd3MtZGV2ZWxvcDEZMBcGCgmSJomT8ixkARkWCXJ1Ynlm
|
17
|
+
b3JnZTETMBEGCgmSJomT8ixkARkWA29yZzCCASIwDQYJKoZIhvcNAQEBBQADggEP
|
18
|
+
ADCCAQoCggEBAMJ6D+5H3x+H81ugh3PcQhgA+GkZBqBcebjwKTCUdUO6TOg6PHwP
|
19
|
+
NcJTuAO4gI47EHkkR47kDdyHzdJIs2lVWctgut5PAT/Q3PsyyUfg3vQL9jhf994G
|
20
|
+
kpNlawivDSo2xubzb1eBeVIF3dtMek4ttA7T1ickv/7oYQrhTpv3AgPoVVcxcva/
|
21
|
+
DPXXBgepcMhdj0h4a+5YAW2t1m4DLYhX2tbzL2sLBZm07awUrOiUkJ9FalN2nevq
|
22
|
+
sdI6KFVaPf94iRDq7OoMCEPS5JwGzDJ5otIt6twj2cKfqOiUJD2Fgb6Y4a80KSXF
|
23
|
+
16kC+80frHhiIb+sGhANsgo8wB0L+BmMgyECAwEAAaM5MDcwCQYDVR0TBAIwADAL
|
24
|
+
BgNVHQ8EBAMCBLAwHQYDVR0OBBYEFN8sX6rx1b95BqTPZMSlDkGHUQByMA0GCSqG
|
25
|
+
SIb3DQEBBQUAA4IBAQBJZE0lH6ticfB+qRoa1dhQmC/iod6u3w0ZnDDkw+an0t/s
|
26
|
+
lUVQ3S8+8E1rs/VvPwuqI72/HF4PBYuvHMfZXiqsxNMQL2hrEDu6F7bx+K6+brpG
|
27
|
+
ERzK5uFNo2o6TFe2upe+IlA4MN8d/qyMSH5sQuikg79shg+kakVJJdqYVcIBDGah
|
28
|
+
RANSg7dXSpR0s1BQJ50qlye64u9JqiW25T4i3Uap/fD3wrlj0SlVwvasQ4qi3cgf
|
29
|
+
tlC13CXjOWGW+hn+n/swny4LFXOus/qZixxiMAePSmN3QUC+bl/GvdBqZz0uPmQc
|
30
|
+
QRVpdW2BFol3aw2mXmdYxaOwHvTxcB7DHmkfOf2h
|
31
|
+
-----END CERTIFICATE-----
|
32
|
+
date: 2014-10-20 00:00:00.000000000 Z
|
41
33
|
dependencies:
|
42
34
|
- !ruby/object:Gem::Dependency
|
43
35
|
name: highline
|
44
36
|
requirement: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
37
|
requirements:
|
47
|
-
- -
|
38
|
+
- - ">="
|
48
39
|
- !ruby/object:Gem::Version
|
49
40
|
version: 1.2.7
|
50
41
|
type: :runtime
|
51
42
|
prerelease: false
|
52
43
|
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
44
|
requirements:
|
55
|
-
- -
|
45
|
+
- - ">="
|
56
46
|
- !ruby/object:Gem::Version
|
57
47
|
version: 1.2.7
|
58
48
|
- !ruby/object:Gem::Dependency
|
59
49
|
name: nokogiri
|
60
50
|
requirement: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
51
|
requirements:
|
63
|
-
- -
|
52
|
+
- - ">="
|
64
53
|
- !ruby/object:Gem::Version
|
65
54
|
version: '1.4'
|
66
55
|
type: :runtime
|
67
56
|
prerelease: false
|
68
57
|
version_requirements: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
58
|
requirements:
|
71
|
-
- -
|
59
|
+
- - ">="
|
72
60
|
- !ruby/object:Gem::Version
|
73
61
|
version: '1.4'
|
74
62
|
- !ruby/object:Gem::Dependency
|
75
63
|
name: rdoc
|
76
64
|
requirement: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
65
|
requirements:
|
79
|
-
- - ~>
|
66
|
+
- - "~>"
|
80
67
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
68
|
+
version: '4.0'
|
82
69
|
type: :development
|
83
70
|
prerelease: false
|
84
71
|
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
72
|
requirements:
|
87
|
-
- - ~>
|
73
|
+
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
75
|
+
version: '4.0'
|
90
76
|
- !ruby/object:Gem::Dependency
|
91
77
|
name: hoe
|
92
78
|
requirement: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
79
|
requirements:
|
95
|
-
- - ~>
|
80
|
+
- - "~>"
|
96
81
|
- !ruby/object:Gem::Version
|
97
|
-
version: '3.
|
82
|
+
version: '3.13'
|
98
83
|
type: :development
|
99
84
|
prerelease: false
|
100
85
|
version_requirements: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
86
|
requirements:
|
103
|
-
- - ~>
|
87
|
+
- - "~>"
|
104
88
|
- !ruby/object:Gem::Version
|
105
|
-
version: '3.
|
106
|
-
description:
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
89
|
+
version: '3.13'
|
90
|
+
description: |-
|
91
|
+
Libraries for Amazon Web Services (ruby-aws) is a set of libraries and tools
|
92
|
+
designed to make it easier for you to build solutions leveraging Amazon Web
|
93
|
+
Services like Amazon Mechanical Turk. The goals of the libraries are:
|
94
|
+
|
95
|
+
* To abstract you from the "muck" of using web services
|
96
|
+
* To simplify using the various Amazon Web Service APIs
|
97
|
+
* To allow you to focus more on solving the business problem
|
98
|
+
and less on managing technical details
|
112
99
|
email: ruby-aws-develop@rubyforge.org
|
113
100
|
executables:
|
114
101
|
- ruby-aws
|
115
102
|
extensions: []
|
116
103
|
extra_rdoc_files:
|
117
|
-
- History.
|
104
|
+
- History.md
|
118
105
|
- LICENSE.txt
|
119
106
|
- Manifest.txt
|
120
107
|
- NOTICE.txt
|
121
|
-
- README.
|
108
|
+
- README.md
|
122
109
|
files:
|
123
|
-
-
|
110
|
+
- ".gemtest"
|
111
|
+
- History.md
|
124
112
|
- LICENSE.txt
|
125
113
|
- Manifest.txt
|
126
114
|
- NOTICE.txt
|
127
|
-
- README.
|
115
|
+
- README.md
|
128
116
|
- Rakefile
|
129
117
|
- bin/ruby-aws
|
130
118
|
- lib/amazon/util.rb
|
@@ -192,32 +180,31 @@ files:
|
|
192
180
|
- test/unit/test_question_generator.rb
|
193
181
|
- test/unit/test_threadpool.rb
|
194
182
|
- test/unit/test_user_data_store.rb
|
195
|
-
- .gemtest
|
196
183
|
homepage: http://rubyforge.org/projects/ruby-aws/
|
197
|
-
licenses:
|
184
|
+
licenses:
|
185
|
+
- APLv2
|
186
|
+
metadata: {}
|
198
187
|
post_install_message:
|
199
188
|
rdoc_options:
|
200
|
-
- --main
|
201
|
-
- README.
|
189
|
+
- "--main"
|
190
|
+
- README.md
|
202
191
|
require_paths:
|
203
192
|
- lib
|
204
193
|
required_ruby_version: !ruby/object:Gem::Requirement
|
205
|
-
none: false
|
206
194
|
requirements:
|
207
|
-
- -
|
195
|
+
- - ">="
|
208
196
|
- !ruby/object:Gem::Version
|
209
197
|
version: '0'
|
210
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
|
-
none: false
|
212
199
|
requirements:
|
213
|
-
- -
|
200
|
+
- - ">="
|
214
201
|
- !ruby/object:Gem::Version
|
215
202
|
version: '0'
|
216
203
|
requirements: []
|
217
|
-
rubyforge_project:
|
218
|
-
rubygems_version:
|
204
|
+
rubyforge_project:
|
205
|
+
rubygems_version: 2.2.0.rc.1
|
219
206
|
signing_key:
|
220
|
-
specification_version:
|
207
|
+
specification_version: 4
|
221
208
|
summary: Ruby libraries for working with Amazon Web Services ( Mechanical Turk )
|
222
209
|
test_files:
|
223
210
|
- test/test_ruby-aws.rb
|
metadata.gz.sig
CHANGED
Binary file
|