embulk-input-elasticsearch 0.3.5 → 0.3.6

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: c40bf4a901edaa1d60167d30aab965d2dba2fa48
4
- data.tar.gz: 1a565534d57b45d03363fdc1f7535405fe054eee
3
+ metadata.gz: 5ec0ae29517a8e4b843226eb79c9353a8e2a5a8a
4
+ data.tar.gz: 126f307337464bb350737e6aef30b920dacdbb8c
5
5
  SHA512:
6
- metadata.gz: beedbb1fb8ad15cba9fa52d84b1c92d0f00b050b308e5efe03a60d190f34a9b79588ac1eeeb8cb2dcbae3e76ff9f34d85ed970015936ad76517a8fd516eb447d
7
- data.tar.gz: 45d30e6c0be97b35de24ed9ae309fb2d20deca4daef112b8d9bc75b7a845ceb2ea20f97fb518064749024359ede7f07c8d10676c6695c18ed4e78550bfda3870
6
+ metadata.gz: 58b66876e8accac787fefa4d621759ef216f2b87f31eaffaf2deb45386012e519ab1d269cc1307626a522783a30cb959335c5de0d1da20d5a0840af088105a9e
7
+ data.tar.gz: e92bf4881d21d53471cddc12faef687a81a9ab9453f1ed64ef4c329d548dca57076da415b46b34db32d1106de49a083bdf1eea5226d1abb70d87e6db49910eea
data/.gitignore CHANGED
@@ -4,3 +4,4 @@
4
4
  /.bundle/
5
5
  /vendor/
6
6
  /Gemfile.lock
7
+ *.jar
data/.travis.yml CHANGED
@@ -1,13 +1,17 @@
1
1
  language: ruby
2
- cache: bundler
3
- rvm:
4
- - jruby-9.0.5.0
5
- - jruby-9.1.5.0
6
- - jruby-head
7
- jdk:
8
- - openjdk7
9
- before_install:
10
- - gem install bundler
2
+ install: ./embulk.jar bundle install --path vendor/bundle
11
3
  matrix:
4
+ include:
5
+ - env: EMBULK_VERSION=0.9.15
6
+ rvm: jruby-9.1.5.0 # bundled jruby version
7
+ jdk: openjdk8 # embulk 0.9.x uses jdk8
8
+ - env: EMBULK_VERSION=latest
9
+ rvm: jruby-9.1.5.0 # ?
10
+ jdk: openjdk8 # ?
12
11
  allow_failures:
13
- - rvm: jruby-head
12
+ - env: EMBULK_VERSION=latest
13
+ before_install:
14
+ - curl -o embulk.jar --create-dirs -L "http://dl.embulk.org/embulk-${EMBULK_VERSION}.jar"
15
+ - chmod +x embulk.jar
16
+ - ./embulk.jar gem install bundler
17
+ script: ./embulk.jar bundle exec rake test
data/README.md CHANGED
@@ -72,6 +72,23 @@ in:
72
72
  * json
73
73
  * boolean
74
74
 
75
+ ## test
76
+
77
+ ### setup
78
+
79
+ ```
80
+ curl -o embulk.jar --create-dirs -L "http://dl.embulk.org/embulk-latest.jar"
81
+ chmod +x embulk.jar
82
+ ./embulk.jar gem install bundler
83
+ ./embulk.jar bundle install --path vendor/bundle
84
+ ```
85
+
86
+ ### run test
87
+
88
+ ```
89
+ ./embulk.jar bundle exec rake test
90
+ ```
91
+
75
92
  ## Build
76
93
 
77
94
  ```
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-input-elasticsearch"
4
- spec.version = "0.3.5"
4
+ spec.version = "0.3.6"
5
5
  spec.authors = ["toyama0919"]
6
6
  spec.summary = "Elasticsearch input plugin for Embulk"
7
7
  spec.description = "Loads records from Elasticsearch. parallel query support."
@@ -1,6 +1,7 @@
1
1
  require_relative 'elasticsearch/connection'
2
2
  require_relative 'elasticsearch/input_thread'
3
3
  require_relative 'elasticsearch/converter'
4
+ require_relative 'elasticsearch/error'
4
5
 
5
6
  module Embulk
6
7
  module Input
@@ -73,8 +73,8 @@ module Embulk
73
73
  sleep 2**retries
74
74
  retry
75
75
  end
76
- Embulk.logger.error "Could not search to Elasticsearch after #{retries} retries. #{e.message}"
77
- return nil
76
+ msg = "Could not search to Elasticsearch after #{retries} retries. #{e.message}"
77
+ raise Elasticsearch::ConnectionError.new e, msg
78
78
  end
79
79
  end
80
80
 
@@ -40,7 +40,7 @@ module Embulk
40
40
  when "json"
41
41
  value
42
42
  else
43
- raise "Unsupported type #{field['type']}"
43
+ raise Elasticsearch::TypecastError.new "Unsupported type #{field['type']}"
44
44
  end
45
45
  end
46
46
  end
@@ -0,0 +1,39 @@
1
+ module Embulk
2
+ module Input
3
+
4
+ class Elasticsearch < InputPlugin
5
+
6
+ module Traceable
7
+ def initialize(e, more_msg = nil)
8
+ message = e.is_a?(String) ? '' : "(#{e.class}) "
9
+ message << "#{e}#{more_msg}\n"
10
+ message << "\tat #{e.backtrace.join("\n\tat ")}\n" if e.respond_to?(:backtrace)
11
+
12
+ while e.respond_to?(:cause) and e.cause
13
+ # Java Exception cannot follow the JRuby causes.
14
+ message << "Caused by (#{e.cause.class}) #{e.cause}\n"
15
+ message << "\tat #{e.cause.backtrace.join("\n\tat ")}\n" if e.cause.respond_to?(:backtrace)
16
+ e = e.cause
17
+ end
18
+
19
+ super(message)
20
+ end
21
+ end
22
+
23
+ class ConfigError < ::Embulk::ConfigError
24
+ include Traceable
25
+ end
26
+
27
+ class ConnectionError < ConfigError
28
+ end
29
+
30
+ class DataError < ::Embulk::DataError
31
+ include Traceable
32
+ end
33
+
34
+ class TypecastError < DataError
35
+ end
36
+
37
+ end
38
+ end
39
+ end
data/test/helper.rb CHANGED
@@ -4,7 +4,13 @@ require 'test/unit'
4
4
 
5
5
  # require 'embulk/java/bootstrap'
6
6
  require 'embulk'
7
- Embulk.setup
7
+ begin
8
+ # Embulk ~> 0.8.x
9
+ Embulk.setup
10
+ rescue NotImplementedError
11
+ # Embulk ~> 0.9.x
12
+ require 'embulk/java/bootstrap'
13
+ end
8
14
  Embulk.logger = Embulk::Logger.new('/dev/null')
9
15
 
10
16
  APP_ROOT = File.expand_path('../', __dir__)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - toyama0919
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-23 00:00:00.000000000 Z
11
+ date: 2019-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -112,6 +112,7 @@ files:
112
112
  - lib/embulk/input/elasticsearch.rb
113
113
  - lib/embulk/input/elasticsearch/connection.rb
114
114
  - lib/embulk/input/elasticsearch/converter.rb
115
+ - lib/embulk/input/elasticsearch/error.rb
115
116
  - lib/embulk/input/elasticsearch/input_thread.rb
116
117
  - test/helper.rb
117
118
  - test/test_converter.rb