embulk-input-jira 0.1.1 → 0.1.2

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: 5bea1dca849c8fe41b89bbc707fbd6e072e2ddf0
4
- data.tar.gz: abb98d90679b466fe387d3fbbb77ffd65487d3b6
3
+ metadata.gz: 441278ed326462319e899a2eba3b5efe30ff058f
4
+ data.tar.gz: ec83de64e07a2242fd3a86999a85b32e388a3ee1
5
5
  SHA512:
6
- metadata.gz: 80947daf57ffd31f089ff321a8b2e190687118e1d373873899103b9ad63a2fde8b66ed15948e1843283d93fa401272dd033fe8825a782c00a4efb3df3a7540d7
7
- data.tar.gz: 7be5a408bdcbe5331b1c70a89166f39f0be49986b7ba619b4aad9d4fc8c5bb955905234f2ccaf9542fc35d0c746623a1f4d78e201af9abb001e769efffa03970
6
+ metadata.gz: 7fcac9dae0446d2d1edeb69d0159ef434888133b3ccb3077d1a8fe940738a43847ceb8a4638c1e98f2cef4cd3974593d4ad8212d20e101557854d20f40da794c
7
+ data.tar.gz: d10a82d30fab2ac8aae723be5b438bb8dca614d808463148a4dd51ebe859887ec4f12c6daf658038899b0b4fa684c712f78536ad946e8886757f137bf18eeb4f
data/.travis.yml CHANGED
@@ -17,6 +17,7 @@ before_install:
17
17
  rvm get head
18
18
  rvm use jruby-9.0.1.0 --install
19
19
  ruby -v
20
+ gem i bundler
20
21
  fi
21
22
 
22
23
  rvm:
data/.travis.yml.erb CHANGED
@@ -17,6 +17,7 @@ before_install:
17
17
  rvm get head
18
18
  rvm use jruby-9.0.1.0 --install
19
19
  ruby -v
20
+ gem i bundler
20
21
  fi
21
22
 
22
23
  rvm:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.2 - 2016-03-25
2
+ * [enhancement] Retry on guess [#42](https://github.com/treasure-data/embulk-input-jira/pull/42)
3
+
1
4
  ## 0.1.1 - 2015-12-04
2
5
 
3
6
  * [maintenance] Update dependency
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "embulk-input-jira"
3
- spec.version = "0.1.1"
3
+ spec.version = "0.1.2"
4
4
  spec.authors = ["uu59", "yoshihara"]
5
5
  spec.summary = "Jira input plugin for Embulk"
6
6
  spec.description = "Loads records from Jira."
@@ -58,9 +58,15 @@ module Embulk
58
58
  jira_config.auth_type = "basic"
59
59
  end
60
60
 
61
+ retry_limit = config.param(:retry_limit, :integer, default: 5)
62
+ retry_initial_wait_sec = config.param(:retry_initial_wait_sec, :integer, default: 1)
63
+ retryer = retryer(retry_limit, retry_initial_wait_sec)
64
+
61
65
  # TODO: we use 0..10 issues to guess config?
62
- records = jira.search_issues(jql, max_results: GUESS_RECORDS_COUNT).map do |issue|
63
- issue.to_record
66
+ records = retryer.with_retry do
67
+ jira.search_issues(jql, max_results: GUESS_RECORDS_COUNT).map do |issue|
68
+ issue.to_record
69
+ end
64
70
  end
65
71
 
66
72
  columns = JiraInputPluginUtils.guess_columns(records)
@@ -82,13 +88,7 @@ module Embulk
82
88
  config.auth_type = "basic"
83
89
  end
84
90
  @jql = task[:jql]
85
- @retryer = PerfectRetry.new do |config|
86
- config.limit = task[:retry_limit]
87
- config.sleep = proc{|n| task[:retry_initial_wait_sec] ** n}
88
- config.dont_rescues = [Embulk::ConfigError]
89
- config.logger = Embulk.logger
90
- config.log_level = nil
91
- end
91
+ @retryer = self.class.retryer(task[:retry_limit], task[:retry_initial_wait_sec])
92
92
  end
93
93
 
94
94
  def run
@@ -119,6 +119,16 @@ module Embulk
119
119
  Embulk.logger
120
120
  end
121
121
 
122
+ def self.retryer(limit, initial_wait)
123
+ PerfectRetry.new do |config|
124
+ config.limit = limit
125
+ config.sleep = proc{|n| initial_wait + (2 ** n)}
126
+ config.dont_rescues = [Embulk::ConfigError]
127
+ config.logger = Embulk.logger
128
+ config.log_level = nil
129
+ end
130
+ end
131
+
122
132
  def logger
123
133
  self.class.logger
124
134
  end
@@ -137,6 +137,8 @@ describe Embulk::Input::Jira do
137
137
  allow(config).to receive(:param).with(:password, :string).and_return(password)
138
138
  allow(config).to receive(:param).with(:uri, :string).and_return(uri)
139
139
  allow(config).to receive(:param).with(:jql, :string).and_return(jql)
140
+ allow(config).to receive(:param).with(:retry_limit, :integer, anything).and_return(0)
141
+ allow(config).to receive(:param).with(:retry_initial_wait_sec, :integer, anything).and_return(0)
140
142
  end
141
143
 
142
144
  it "setup Embulk::Input::JiraApi::Client" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-jira
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - uu59
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-04 00:00:00.000000000 Z
12
+ date: 2016-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.5.0
20
20
  name: jiralicious
@@ -22,13 +22,13 @@ dependencies:
22
22
  type: :runtime
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: 0.5.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.6.0
34
34
  name: parallel
@@ -36,13 +36,13 @@ dependencies:
36
36
  type: :runtime
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ~>
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.6.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.3'
48
48
  name: perfect_retry
@@ -50,13 +50,13 @@ dependencies:
50
50
  type: :runtime
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0.3'
56
56
  - !ruby/object:Gem::Dependency
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.0'
62
62
  name: bundler
@@ -64,13 +64,13 @@ dependencies:
64
64
  type: :development
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '10.0'
76
76
  name: rake
@@ -78,13 +78,13 @@ dependencies:
78
78
  type: :development
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">="
81
+ - - '>='
82
82
  - !ruby/object:Gem::Version
83
83
  version: '10.0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: 3.2.0
90
90
  name: rspec
@@ -92,19 +92,19 @@ dependencies:
92
92
  type: :development
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - "~>"
95
+ - - ~>
96
96
  - !ruby/object:Gem::Version
97
97
  version: 3.2.0
98
98
  - !ruby/object:Gem::Dependency
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.6.12
104
- - - "!="
104
+ - - '!='
105
105
  - !ruby/object:Gem::Version
106
106
  version: 0.6.22
107
- - - "<"
107
+ - - <
108
108
  - !ruby/object:Gem::Version
109
109
  version: '1.0'
110
110
  name: embulk
@@ -112,19 +112,19 @@ dependencies:
112
112
  type: :development
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.6.12
118
- - - "!="
118
+ - - '!='
119
119
  - !ruby/object:Gem::Version
120
120
  version: 0.6.22
121
- - - "<"
121
+ - - <
122
122
  - !ruby/object:Gem::Version
123
123
  version: '1.0'
124
124
  - !ruby/object:Gem::Dependency
125
125
  requirement: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - ">="
127
+ - - '>='
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  name: simplecov
@@ -132,13 +132,13 @@ dependencies:
132
132
  type: :development
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - ">="
135
+ - - '>='
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  - !ruby/object:Gem::Dependency
139
139
  requirement: !ruby/object:Gem::Requirement
140
140
  requirements:
141
- - - ">="
141
+ - - '>='
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  name: pry
@@ -146,13 +146,13 @@ dependencies:
146
146
  type: :development
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - ">="
149
+ - - '>='
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  - !ruby/object:Gem::Dependency
153
153
  requirement: !ruby/object:Gem::Requirement
154
154
  requirements:
155
- - - ">="
155
+ - - '>='
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  name: codeclimate-test-reporter
@@ -160,13 +160,13 @@ dependencies:
160
160
  type: :development
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - ">="
163
+ - - '>='
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  - !ruby/object:Gem::Dependency
167
167
  requirement: !ruby/object:Gem::Requirement
168
168
  requirements:
169
- - - ">="
169
+ - - '>='
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
172
  name: everyleaf-embulk_helper
@@ -174,7 +174,7 @@ dependencies:
174
174
  type: :development
175
175
  version_requirements: !ruby/object:Gem::Requirement
176
176
  requirements:
177
- - - ">="
177
+ - - '>='
178
178
  - !ruby/object:Gem::Version
179
179
  version: '0'
180
180
  description: Loads records from Jira.
@@ -185,9 +185,9 @@ executables: []
185
185
  extensions: []
186
186
  extra_rdoc_files: []
187
187
  files:
188
- - ".gitignore"
189
- - ".travis.yml"
190
- - ".travis.yml.erb"
188
+ - .gitignore
189
+ - .travis.yml
190
+ - .travis.yml.erb
191
191
  - CHANGELOG.md
192
192
  - Gemfile
193
193
  - LICENSE
@@ -242,17 +242,17 @@ require_paths:
242
242
  - lib
243
243
  required_ruby_version: !ruby/object:Gem::Requirement
244
244
  requirements:
245
- - - ">="
245
+ - - '>='
246
246
  - !ruby/object:Gem::Version
247
247
  version: '0'
248
248
  required_rubygems_version: !ruby/object:Gem::Requirement
249
249
  requirements:
250
- - - ">="
250
+ - - '>='
251
251
  - !ruby/object:Gem::Version
252
252
  version: '0'
253
253
  requirements: []
254
254
  rubyforge_project:
255
- rubygems_version: 2.4.8
255
+ rubygems_version: 2.4.6
256
256
  signing_key:
257
257
  specification_version: 4
258
258
  summary: Jira input plugin for Embulk