embulk 0.7.6-java → 0.7.7-java

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: 6e299148e196ac4521c81da16fe9073af066027e
4
- data.tar.gz: 968cca1d984cfbf079a26cee217656f56b69ab53
3
+ metadata.gz: 885a6d1fb403c2485fc750a61510292d09d608ef
4
+ data.tar.gz: 292732f9ef40bd7c9e447eb6e7f8d0808ecef751
5
5
  SHA512:
6
- metadata.gz: 28b9b3db6b11bedf305be41986d89941a404743a1d463a0f573e1bfc808ccc6503ebb8d05f7c83dbdb3403e9d8985e88194cd6e9ac1be65aa5507e89db2dd951
7
- data.tar.gz: 63e207246f689796fc132b43d4398fcd2725fc31d4a76e050e8b868de1572543add56ed15dc31b93c4db4164693dc100da448335db8e058ecbbe10046aa10156
6
+ metadata.gz: 01c5228b4b4ff13849d0221f5855523418e262b803088250c0eb951f2b4bf7cf6b17024723b83cfeb78f7b30f92bc6b6ce3b18567ed1f4d4999f2b1d498938cb
7
+ data.tar.gz: ed79c753d4484f0c62d19529f2215d746102f72892ffeb55c36cb1a14792c12964c354121e0c02c17a0c1b81d392479d131c9f206bfa23f0e4fd19e0be090a4c
data/build.gradle CHANGED
@@ -16,7 +16,7 @@ def release_projects = [project(":embulk-core"), project(":embulk-standards")]
16
16
 
17
17
  allprojects {
18
18
  group = 'org.embulk'
19
- version = '0.7.6'
19
+ version = '0.7.7'
20
20
 
21
21
  ext {
22
22
  jrubyVersion = '9.0.0.0'
@@ -163,10 +163,20 @@ public class BulkLoader
163
163
 
164
164
  public boolean isAllTasksCommitted()
165
165
  {
166
- if (outputTaskStates == null) {
166
+ // here can't assume that input tasks are committed when output tasks are
167
+ // committed because that's controlled by executor plugins. some executor
168
+ // plugins (especially mapreduce executor) may commit output tasks even
169
+ // when some input tasks failed. This is asemantically allowed behavior for
170
+ // executor plugins (as long as output plugin is atomic and idempotent).
171
+ if (inputTaskStates == null || outputTaskStates == null) {
167
172
  // not initialized
168
173
  return false;
169
174
  }
175
+ for (TaskState inputTaskState : inputTaskStates) {
176
+ if (!inputTaskState.isCommitted()) {
177
+ return false;
178
+ }
179
+ }
170
180
  for (TaskState outputTaskState : outputTaskStates) {
171
181
  if (!outputTaskState.isCommitted()) {
172
182
  return false;
@@ -175,6 +185,36 @@ public class BulkLoader
175
185
  return true;
176
186
  }
177
187
 
188
+ public int countUncommittedInputTasks()
189
+ {
190
+ if (inputTaskStates == null) {
191
+ // not initialized
192
+ return 0;
193
+ }
194
+ int count = 0;
195
+ for (TaskState inputTaskState : inputTaskStates) {
196
+ if (!inputTaskState.isCommitted()) {
197
+ count++;
198
+ }
199
+ }
200
+ return count;
201
+ }
202
+
203
+ public int countUncommittedOutputTasks()
204
+ {
205
+ if (outputTaskStates == null) {
206
+ // not initialized
207
+ return 0;
208
+ }
209
+ int count = 0;
210
+ for (TaskState outputTaskState : outputTaskStates) {
211
+ if (!outputTaskState.isCommitted()) {
212
+ count++;
213
+ }
214
+ }
215
+ return count;
216
+ }
217
+
178
218
  public boolean isAllTransactionsCommitted()
179
219
  {
180
220
  return inputConfigDiff != null && outputConfigDiff != null;
@@ -498,6 +538,11 @@ public class BulkLoader
498
538
  execute(task, executor, state);
499
539
  }
500
540
 
541
+ if (!state.isAllTasksCommitted()) {
542
+ throw new RuntimeException(String.format("%d input tasks and %d output tasks failed",
543
+ state.countUncommittedInputTasks(), state.countUncommittedOutputTasks()));
544
+ }
545
+
501
546
  return state.getAllOutputTaskReports();
502
547
  }
503
548
  });
@@ -563,6 +608,11 @@ public class BulkLoader
563
608
  execute(task, executor, state);
564
609
  }
565
610
 
611
+ if (!state.isAllTasksCommitted()) {
612
+ throw new RuntimeException(String.format("%d input tasks and %d output tasks failed",
613
+ state.countUncommittedInputTasks(), state.countUncommittedOutputTasks()));
614
+ }
615
+
566
616
  return state.getAllOutputTaskReports();
567
617
  }
568
618
  });
@@ -88,6 +88,38 @@ Environment variables are set to ``env`` variable.
88
88
  table: {{ env.pg_table }}
89
89
 
90
90
 
91
+ Including files
92
+ ~~~~~~~~~~~~~~~~~~
93
+
94
+ Configuration file can include another configuration file. To use it, configuration file name must end with ``.yml.liquid``.
95
+
96
+ File will be searched from the relative path of the input configuration file. And file name will be ``_<name>.yml.liquid``. For example, if you add ``{% include 'subdir/inc' %}`` tag to ``myconfig/config.yml.liquid`` file, it includes ``myconfig/subdir/_inc.yml.liquid`` file.
97
+
98
+ .. code-block:: yaml
99
+
100
+ # config.yml.liquid
101
+ {% include 'in_mysql' %}
102
+ out:
103
+ type: stdout
104
+
105
+ .. code-block:: yaml
106
+
107
+ # _in_mysql.yml.liquid
108
+ in:
109
+ type: mysql
110
+
111
+ With above 2 files, actual configuration file will be:
112
+
113
+ .. code-block:: yaml
114
+
115
+ # $ embulk run config.yml.liquid
116
+ in:
117
+ type: mysql
118
+ out:
119
+ type: stdout
120
+
121
+
122
+
91
123
  Local file input plugin
92
124
  ------------------
93
125
 
@@ -4,6 +4,7 @@ Release Notes
4
4
  .. toctree::
5
5
  :maxdepth: 1
6
6
 
7
+ release/release-0.7.7
7
8
  release/release-0.7.6
8
9
  release/release-0.7.5
9
10
  release/release-0.7.4
@@ -0,0 +1,13 @@
1
+ Release 0.7.7
2
+ ==================================
3
+
4
+ General Changes
5
+ ------------------
6
+
7
+ * Configuration file can use ``{% include 'path' %}`` tag to include another file. This is very useful to organize a complex configuration from multiple files. See documents for details.
8
+ * Fixed compatibility with mapreduce executor. Failure message includes appropriate cause instead of IllegalStateException.
9
+
10
+
11
+ Release Date
12
+ ------------------
13
+ 2015-10-28
data/lib/embulk/runner.rb CHANGED
@@ -113,7 +113,8 @@ module Embulk
113
113
  when /\.yml\.liquid$/
114
114
  require 'liquid'
115
115
  template_params = options[:template_params] || {}
116
- @embed.newConfigLoader.fromYamlString run_liquid(File.read(config), template_params)
116
+ template_include_path = File.expand_path(options[:template_include_path] || File.dirname(config)) unless options[:template_include_path] == false
117
+ @embed.newConfigLoader.fromYamlString run_liquid(File.read(config), template_params, template_include_path)
117
118
  when /\.yml$/
118
119
  @embed.newConfigLoader.fromYamlString File.read(config)
119
120
  else
@@ -129,9 +130,10 @@ module Embulk
129
130
  @embed.newConfigLoader.fromYamlString File.read(config)
130
131
  end
131
132
 
132
- def run_liquid(source, params)
133
+ def run_liquid(source, params, template_include_path)
133
134
  require 'liquid'
134
135
  template = Liquid::Template.parse(source)
136
+ template.registers[:file_system] = Liquid::LocalFileSystem.new(template_include_path, "_%s.yml.liquid") if template_include_path
135
137
 
136
138
  data = {
137
139
  "env" => ENV.to_h,
@@ -1,3 +1,3 @@
1
1
  module Embulk
2
- VERSION = '0.7.6'
2
+ VERSION = '0.7.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.7.7
5
5
  platform: java
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -133,8 +133,8 @@ files:
133
133
  - classpath/bval-jsr303-0.5.jar
134
134
  - classpath/commons-beanutils-core-1.8.3.jar
135
135
  - classpath/commons-lang3-3.1.jar
136
- - classpath/embulk-core-0.7.6.jar
137
- - classpath/embulk-standards-0.7.6.jar
136
+ - classpath/embulk-core-0.7.7.jar
137
+ - classpath/embulk-standards-0.7.7.jar
138
138
  - classpath/guava-18.0.jar
139
139
  - classpath/guice-4.0.jar
140
140
  - classpath/guice-multibindings-4.0.jar
@@ -438,6 +438,7 @@ files:
438
438
  - embulk-docs/src/release/release-0.7.4.rst
439
439
  - embulk-docs/src/release/release-0.7.5.rst
440
440
  - embulk-docs/src/release/release-0.7.6.rst
441
+ - embulk-docs/src/release/release-0.7.7.rst
441
442
  - embulk-standards/build.gradle
442
443
  - embulk-standards/src/main/java/org/embulk/standards/CsvFormatterPlugin.java
443
444
  - embulk-standards/src/main/java/org/embulk/standards/CsvParserPlugin.java