embulk-input-jira 0.0.7 → 0.1.0

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: ca9d7bf53b7dfbddcab977bd9eabfd501101f598
4
- data.tar.gz: eb730c8f99fec521569b2e41d62f4b37259be270
3
+ metadata.gz: cadf45e98287f889deb94f4bfbd0e7d59f5d4d20
4
+ data.tar.gz: 6d984f2036a083042d1d281fcb7dd83160cc20bd
5
5
  SHA512:
6
- metadata.gz: fa62f3678e0bdb883b86ef423e4d3e35a739099752f8efe990ae2cf62eba312b0774001ce29d1def0f8e91fb817938838c5278e64d7b041f4843e721728791c5
7
- data.tar.gz: 2485a99590ab6e6933e8d4c8c85c83244a8037ac0afaef8979e0bf96c07e4ea72bd84a1c98424422f7725c6e2d6720b650479a5ff6a9993ad10a3a7838dad57f
6
+ metadata.gz: 2f80d9490c44aa09d7a1edef199cce5e9bdf28d9e42caea371a593b68c52b69bad570c3c87f6c8269b53dfca980a8d19d6c9f65d7ab7088c022002a90ee16fb6
7
+ data.tar.gz: 15a60a4562600873deffa9415df7bc5c8c8ab2ab3e78907e01208d521a09c3596d7a92b87190371f823c97e39ff9141ba42337e0bd302ef5cffe3303304c22d5
@@ -1,3 +1,7 @@
1
+ ## 0.1.0 - 2015-11-09
2
+
3
+ * [enhancement] Add retry options and retry handling [#41](https://github.com/treasure-data/embulk-input-jira/pull/41)
4
+
1
5
  ## 0.0.7 - 2015-10-06
2
6
 
3
7
  * [enhancement] Supports embulk.0.7 [#40](https://github.com/treasure-data/embulk-input-jira/pull/40)
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  [![Build Status](https://travis-ci.org/treasure-data/embulk-input-jira.svg)](https://travis-ci.org/treasure-data/embulk-input-jira)
2
2
  [![Code Climate](https://codeclimate.com/github/treasure-data/embulk-input-jira/badges/gpa.svg)](https://codeclimate.com/github/treasure-data/embulk-input-jira)
3
3
  [![Test Coverage](https://codeclimate.com/github/treasure-data/embulk-input-jira/badges/coverage.svg)](https://codeclimate.com/github/treasure-data/embulk-input-jira/coverage)
4
+ [![Gem Version](https://badge.fury.io/rb/embulk-input-jira.svg)](https://badge.fury.io/rb/embulk-input-jira)
4
5
 
5
6
  # Jira input plugin for Embulk
6
7
 
@@ -22,6 +23,8 @@ Required Embulk version >= 0.6.12
22
23
  - **uri** JIRA API endpoint (string, required)
23
24
  - **jql** [JQL](https://confluence.atlassian.com/display/JIRA/Advanced+Searching) for extract target issues (string, required)
24
25
  - **columns** target issue attributes. You can generate this configuration by `guess` command (array, required)
26
+ - **retry_initial_wait_sec**: Wait seconds for exponential backoff initial value (integer, default: 1)
27
+ - **retry_limit**: Try to retry this times (integer, default: 5)
25
28
 
26
29
  ## Example
27
30
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "embulk-input-jira"
3
- spec.version = "0.0.7"
3
+ spec.version = "0.1.0"
4
4
  spec.authors = ["uu59", "yoshihara"]
5
5
  spec.summary = "Jira input plugin for Embulk"
6
6
  spec.description = "Loads records from Jira."
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.add_dependency 'jiralicious', ['~> 0.5.0']
16
16
  spec.add_dependency 'parallel', ['~> 1.6.0']
17
+ spec.add_dependency 'perfect_retry', ['~> 0.2']
17
18
  spec.add_development_dependency 'bundler', ['~> 1.0']
18
19
  spec.add_development_dependency 'rake', ['>= 10.0']
19
20
  spec.add_development_dependency 'rspec', "~> 3.2.0"
@@ -1,3 +1,4 @@
1
+ require "perfect_retry"
1
2
  require "embulk/input/jira_input_plugin_utils"
2
3
  require "embulk/input/jira_api"
3
4
 
@@ -27,6 +28,8 @@ module Embulk
27
28
  end
28
29
 
29
30
  task[:attributes] = attributes
31
+ task[:retry_limit] = config.param(:retry_limit, :integer, default: 5)
32
+ task[:retry_initial_wait_sec] = config.param(:retry_initial_wait_sec, :integer, default: 1)
30
33
 
31
34
  resume(task, columns, 1, &control)
32
35
  end
@@ -79,6 +82,11 @@ module Embulk
79
82
  config.auth_type = "basic"
80
83
  end
81
84
  @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
+ end
82
90
  end
83
91
 
84
92
  def run
@@ -89,12 +97,13 @@ module Embulk
89
97
 
90
98
  0.step(total_count, PER_PAGE).with_index(1) do |start_at, page|
91
99
  logger.debug "Fetching #{page} / #{last_page} page"
92
- @jira.search_issues(@jql, options.merge(start_at: start_at)).each do |issue|
93
- values = @attributes.map do |(attribute_name, type)|
94
- JiraInputPluginUtils.cast(issue[attribute_name], type)
100
+ @retryer.with_retry do
101
+ @jira.search_issues(@jql, options.merge(start_at: start_at)).each do |issue|
102
+ values = @attributes.map do |(attribute_name, type)|
103
+ JiraInputPluginUtils.cast(issue[attribute_name], type)
104
+ end
105
+ page_builder.add(values)
95
106
  end
96
-
97
- page_builder.add(values)
98
107
  end
99
108
  end
100
109
 
@@ -22,7 +22,9 @@ describe Embulk::Input::Jira do
22
22
  attributes: {
23
23
  "project.key" => :string,
24
24
  "comment.total" => :long
25
- }
25
+ },
26
+ retry_limit: 5,
27
+ retry_initial_wait_sec: 1,
26
28
  }
27
29
  end
28
30
 
@@ -46,6 +48,8 @@ describe Embulk::Input::Jira do
46
48
  allow(config).to receive(:param).with(:uri, :string).and_return(uri)
47
49
  allow(config).to receive(:param).with(:jql, :string).and_return(jql)
48
50
  allow(config).to receive(:param).with(:columns, :array).and_return(columns)
51
+ allow(config).to receive(:param).with(:retry_limit, :integer, default: 5).and_return(5)
52
+ allow(config).to receive(:param).with(:retry_initial_wait_sec, :integer, default: 1).and_return(1)
49
53
  end
50
54
 
51
55
  # NOTE: I should check other factor, but i don't know it...
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.0.7
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - uu59
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-06 00:00:00.000000000 Z
12
+ date: 2015-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.6.0
42
+ - !ruby/object:Gem::Dependency
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.2'
48
+ name: perfect_retry
49
+ prerelease: false
50
+ type: :runtime
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '0.2'
42
56
  - !ruby/object:Gem::Dependency
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements: