embulk 0.7.6 → 0.7.7

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: 29b4fbf4ef36c7354cf89e39b25212d5dbf6a0fa
4
- data.tar.gz: 8e2387077d348272bf6e09736f51b48722b9287a
3
+ metadata.gz: 98c34f07d3e87eda540f68191fea784dd4e32aa9
4
+ data.tar.gz: 21df9853971aaa0a124021b7e2e6d0ad38961668
5
5
  SHA512:
6
- metadata.gz: c39a0c665331889057cd4c2c74cfb7610f56dc1665c3e8e4fae8513f8a37f7dab7f463d68d814794b4a2b5a8401ca6ddbb366ade4ab0d2ef85a82d6f895776d6
7
- data.tar.gz: 491c5c617a8868ac232fca6a7034263ef338e6213bca61806223acd10dd5a59a61e5fed8f09e86809bdc5c880906baf4122563d4c7187413a660a3d55eebf127
6
+ metadata.gz: 4f2f4c9c9e4dab482962d59f9bea20ca12300b7e6cfecc6af5f3e472ffe9cb0bf26276073ff0de62871281462616249b7858ac6f03149b036a6356d2b0054262
7
+ data.tar.gz: a8182664cd36f762b840de0777e084064bf930c0162d797600fc3efc8241195a3f7fb51dd2427ea0f9d9a79de1ef44e3913b02af480af96ad14c1cc6f08b3405
@@ -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
@@ -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: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -121,8 +121,8 @@ files:
121
121
  - classpath/bval-jsr303-0.5.jar
122
122
  - classpath/commons-beanutils-core-1.8.3.jar
123
123
  - classpath/commons-lang3-3.1.jar
124
- - classpath/embulk-core-0.7.6.jar
125
- - classpath/embulk-standards-0.7.6.jar
124
+ - classpath/embulk-core-0.7.7.jar
125
+ - classpath/embulk-standards-0.7.7.jar
126
126
  - classpath/guava-18.0.jar
127
127
  - classpath/guice-4.0.jar
128
128
  - classpath/guice-multibindings-4.0.jar
@@ -426,6 +426,7 @@ files:
426
426
  - embulk-docs/src/release/release-0.7.4.rst
427
427
  - embulk-docs/src/release/release-0.7.5.rst
428
428
  - embulk-docs/src/release/release-0.7.6.rst
429
+ - embulk-docs/src/release/release-0.7.7.rst
429
430
  - embulk-standards/build.gradle
430
431
  - embulk-standards/src/main/java/org/embulk/standards/CsvFormatterPlugin.java
431
432
  - embulk-standards/src/main/java/org/embulk/standards/CsvParserPlugin.java