embulk 0.8.1-java → 0.8.2-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: 811d87a7f7729cc533a84da4300355918eeaa251
4
- data.tar.gz: 980c4dbe0eb15a13ca1fec8490fd22d8ee669694
3
+ metadata.gz: 0113e43ba8d288ec790e7db757ec377021489c5a
4
+ data.tar.gz: 6909f583104d6fa7e86bc9013f623e000baa9398
5
5
  SHA512:
6
- metadata.gz: ce0ad08275891531774570de157084c0c4027e6bb1c37be9761d1bc72ed4846334fc692be83ac14f47f4e79d73559d65130e585af0094729b23f5fd5ee8c6ed5
7
- data.tar.gz: 3efa329206f77fc0b42e414d4c9cbe1bd5b486f6554f03c94e29691b0625dc8ad71b8b08625cd57043f4bee5e61972dd3ba09e4fcf47f460a792cd8ddcf8b6b6
6
+ metadata.gz: c4bc64b81ba8ecdc2087ce6e07ca6417ddb09ba780d2a3f72b37e059c739a22931321fa0c795feedf134cd6786c186e6d11f471750c2ab5754fffa8d6952c06c
7
+ data.tar.gz: 79e4155fae88bdf830a47b20bb90a11c59f092bb65fe55d0b2d2aa2c469aebc9266718b1ecefdc5aeda882f4ff5f5a567e2826fe878ac550a622699495999e5a
data/README.md CHANGED
@@ -46,7 +46,7 @@ Next step: [Running example in 4 commands](#running-example)
46
46
 
47
47
  ```
48
48
  embulk example ./try1
49
- embulk guess ./try1/example.yml -o config.yml
49
+ embulk guess ./try1/seed.yml -o config.yml
50
50
  embulk preview config.yml
51
51
  embulk run config.yml
52
52
  ```
@@ -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.8.1'
19
+ version = '0.8.2'
20
20
 
21
21
  ext {
22
22
  jrubyVersion = '9.0.4.0'
@@ -60,7 +60,7 @@ public class LocalExecutorPlugin
60
60
  Logger log = Exec.getLogger(LocalExecutorPlugin.class);
61
61
  int maxThreads = config.get(Integer.class, "max_threads", defaultMaxThreads);
62
62
  int minThreads = config.get(Integer.class, "min_output_tasks", defaultMinThreads);
63
- if (inputTaskCount < minThreads) {
63
+ if (inputTaskCount > 0 && inputTaskCount < minThreads) {
64
64
  int scatterCount = (minThreads + inputTaskCount - 1) / inputTaskCount;
65
65
  log.info("Using local thread executor with max_threads={} / output tasks {} = input tasks {} * {}",
66
66
  maxThreads, inputTaskCount * scatterCount, inputTaskCount, scatterCount);
@@ -320,33 +320,55 @@ public class LocalExecutorPlugin
320
320
  {
321
321
  private final PageOutput output;
322
322
  private final Future<Throwable> future;
323
- private boolean done;
324
- private Page queued;
323
+ private volatile int addWaiting;
324
+ private volatile Page queued;
325
325
 
326
326
  public OutputWorker(PageOutput output, ExecutorService executor)
327
327
  {
328
328
  this.output = output;
329
- this.done = done;
329
+ this.addWaiting = 0;
330
330
  this.future = executor.submit(this);
331
331
  }
332
332
 
333
- public synchronized void add(Page page)
333
+ public synchronized void done()
334
334
  throws InterruptedException
335
335
  {
336
336
  while (true) {
337
- if (queued == null) {
338
- queued = page;
337
+ if (queued == null && addWaiting == 0) {
338
+ queued = DONE_PAGE;
339
339
  notifyAll();
340
340
  return;
341
341
  }
342
342
  else if (queued == DONE_PAGE) {
343
- page.release();
344
343
  return;
345
344
  }
346
345
  wait();
347
346
  }
348
347
  }
349
348
 
349
+ public synchronized void add(Page page)
350
+ throws InterruptedException
351
+ {
352
+ addWaiting++;
353
+ try {
354
+ while (true) {
355
+ if (queued == null) {
356
+ queued = page;
357
+ notifyAll();
358
+ return;
359
+ }
360
+ else if (queued == DONE_PAGE) {
361
+ page.release();
362
+ return;
363
+ }
364
+ wait();
365
+ }
366
+ }
367
+ finally {
368
+ addWaiting--;
369
+ }
370
+ }
371
+
350
372
  public Throwable join()
351
373
  throws InterruptedException
352
374
  {
@@ -470,8 +492,8 @@ public class LocalExecutorPlugin
470
492
  {
471
493
  completeWorkers();
472
494
  for (int i = 0; i < scatterCount; i++) {
473
- if (trans[i] != null) {
474
- trans[i].finish();
495
+ if (filtereds[i] != null) {
496
+ filtereds[i].finish();
475
497
  }
476
498
  }
477
499
  }
@@ -517,7 +539,7 @@ public class LocalExecutorPlugin
517
539
  OutputWorker worker = outputWorkers[i];
518
540
  if (worker != null) {
519
541
  try {
520
- worker.add(DONE_PAGE);
542
+ worker.done();
521
543
  }
522
544
  catch (InterruptedException ex) {
523
545
  throw Throwables.propagate(ex);
@@ -14,7 +14,6 @@ import com.google.inject.Injector;
14
14
  import com.google.inject.Key;
15
15
  import com.google.inject.spi.Dependency;
16
16
  import com.google.inject.spi.ProviderWithDependencies;
17
- import org.jruby.CompatVersion;
18
17
  import org.jruby.embed.LocalContextScope;
19
18
  import org.jruby.embed.ScriptingContainer;
20
19
  import org.embulk.plugin.PluginSource;
@@ -44,6 +43,7 @@ public class JRubyScriptingModule
44
43
  {
45
44
  private final Injector injector;
46
45
  private final boolean useGlobalRubyRuntime;
46
+ private final String gemHome;
47
47
 
48
48
  @Inject
49
49
  public ScriptingContainerProvider(Injector injector, @ForSystemConfig ConfigSource systemConfig)
@@ -54,6 +54,8 @@ public class JRubyScriptingModule
54
54
  // instantiated in this JVM.
55
55
  this.useGlobalRubyRuntime = systemConfig.get(boolean.class, "use_global_ruby_runtime", false);
56
56
 
57
+ this.gemHome = systemConfig.get(String.class, "gem_home", null);
58
+
57
59
  // TODO get jruby-home from systemConfig to call jruby.container.setHomeDirectory
58
60
  // TODO get jruby-load-paths from systemConfig to call jruby.container.setLoadPaths
59
61
  }
@@ -75,6 +77,18 @@ public class JRubyScriptingModule
75
77
  // }
76
78
  // jruby.setLoadPaths(loadPaths);
77
79
 
80
+ if (gemHome != null) {
81
+ // Overwrites GEM_HOME and GEM_PATH. GEM_PATH becomes same with GEM_HOME. Therefore
82
+ // with this code, there're no ways to set extra GEM_PATHs in addition to GEM_HOME.
83
+ // Here doesn't modify ENV['GEM_HOME'] so that a JVM process can create multiple
84
+ // JRubyScriptingModule instances. However, because Gem loads ENV['GEM_HOME'] when
85
+ // Gem.clear_paths is called, applications may use unexpected GEM_HOME if clear_path
86
+ // is used.
87
+ jruby.callMethod(
88
+ jruby.runScriptlet("Gem"),
89
+ "use_paths", gemHome, gemHome);
90
+ }
91
+
78
92
  // load embulk.rb
79
93
  jruby.runScriptlet("require 'embulk'");
80
94
 
@@ -4,8 +4,6 @@ import org.embulk.spi.Column;
4
4
  import org.embulk.spi.PageBuilder;
5
5
  import org.embulk.spi.time.Timestamp;
6
6
  import org.embulk.spi.time.TimestampFormatter;
7
- import org.embulk.spi.json.JsonParser;
8
- import org.embulk.spi.json.JsonParseException;
9
7
  import org.msgpack.value.Value;
10
8
  import org.msgpack.value.ValueFactory;
11
9
 
@@ -13,7 +11,6 @@ public class JsonColumnSetter
13
11
  extends AbstractDynamicColumnSetter
14
12
  {
15
13
  private final TimestampFormatter timestampFormatter;
16
- private final JsonParser jsonParser;
17
14
 
18
15
  public JsonColumnSetter(PageBuilder pageBuilder, Column column,
19
16
  DefaultValueSetter defaultValue,
@@ -21,7 +18,6 @@ public class JsonColumnSetter
21
18
  {
22
19
  super(pageBuilder, column, defaultValue);
23
20
  this.timestampFormatter = timestampFormatter;
24
- this.jsonParser = new JsonParser();
25
21
  }
26
22
 
27
23
  @Override
@@ -51,12 +47,7 @@ public class JsonColumnSetter
51
47
  @Override
52
48
  public void set(String v)
53
49
  {
54
- try {
55
- pageBuilder.setJson(column, jsonParser.parse(v));
56
- }
57
- catch (JsonParseException ex) {
58
- defaultValue.setTimestamp(pageBuilder, column);
59
- }
50
+ pageBuilder.setJson(column, ValueFactory.newString(v));
60
51
  }
61
52
 
62
53
  @Override
@@ -11,7 +11,7 @@ import org.embulk.spi.Schema;
11
11
  import org.embulk.spi.SchemaConfig;
12
12
  import org.embulk.spi.ColumnVisitor;
13
13
  import org.embulk.spi.type.Type;
14
-
14
+ import org.msgpack.value.Value;
15
15
  import com.google.common.collect.ImmutableList;
16
16
 
17
17
  public class PageTestUtils
@@ -42,6 +42,8 @@ public class PageTestUtils
42
42
  builder.setString(column, (String) value);
43
43
  } else if (value instanceof Timestamp) {
44
44
  builder.setTimestamp(column, (Timestamp) value);
45
+ } else if (value instanceof Value) {
46
+ builder.setJson(column, (Value) value);
45
47
  } else {
46
48
  throw new IllegalStateException(
47
49
  "Unsupported type in test utils: "
@@ -4,6 +4,7 @@ Release Notes
4
4
  .. toctree::
5
5
  :maxdepth: 1
6
6
 
7
+ release/release-0.8.2
7
8
  release/release-0.8.1
8
9
  release/release-0.8.0
9
10
  release/release-0.7.10
@@ -0,0 +1,19 @@
1
+ Release 0.8.2
2
+ ==================================
3
+
4
+ General Changes
5
+ ------------------
6
+
7
+ * Fixed race condition around transaction completion when page scattering is enabled.
8
+ * Fixed unexpected error that happens when number of input tasks is 0 and page scattering is enabled.
9
+ * Fixed preview output when a json column is included.
10
+
11
+ CLI
12
+ ------------------
13
+
14
+ * ``-c, --config-diff`` option replaces ``-o, --output`` option.
15
+
16
+
17
+ Release Date
18
+ ------------------
19
+ 2016-01-31
@@ -18,8 +18,8 @@ id,account,time,purchase,comment
18
18
  EOF
19
19
  end
20
20
 
21
- puts " Creating #{path}/example.yml"
22
- File.open(File.join(path, 'example.yml'), 'w') do |f|
21
+ puts " Creating #{path}/seed.yml"
22
+ File.open(File.join(path, 'seed.yml'), 'w') do |f|
23
23
  f.write <<EOF
24
24
  in:
25
25
  type: file
@@ -78,9 +78,19 @@ module Embulk
78
78
  op.on('-r', '--resume-state PATH', 'Path to a file to write or read resume state') do |path|
79
79
  options[:resume_state_path] = path
80
80
  end
81
- op.on('-o', '--output PATH', 'Path to a file to write the next configuration') do |path|
81
+ op.on('-o', '--output PATH', '(deprecated)') do |path|
82
+ STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: Run with -o option is deprecated. Please use -c option instead. For example,"
83
+ STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: "
84
+ STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: $ embulk run config.yml -c diff.yml"
85
+ STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: "
86
+ STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: This -c option stores only diff of the next configuration."
87
+ STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: The diff will be merged to the original config.yml file."
88
+ STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: "
82
89
  options[:next_config_output_path] = path
83
90
  end
91
+ op.on('-c', '--config-diff PATH', 'Path to a file to read & write the next configuration diff') do |path|
92
+ options[:next_config_diff_path] = path
93
+ end
84
94
  plugin_load_ops.call
85
95
  java_embed_ops.call
86
96
  args = 1..1
@@ -227,7 +237,7 @@ examples:
227
237
  puts ""
228
238
  puts "Run following subcommands to try embulk:"
229
239
  puts ""
230
- puts " 1. embulk guess #{File.join(path, 'example.yml')} -o config.yml"
240
+ puts " 1. embulk guess #{File.join(path, 'seed.yml')} -o config.yml"
231
241
  puts " 2. embulk preview config.yml"
232
242
  puts " 3. embulk run config.yml"
233
243
  puts ""
@@ -53,12 +53,19 @@ module Embulk
53
53
 
54
54
  def run(config, options={})
55
55
  configSource = read_config(config, options)
56
- output_path = options[:next_config_output_path]
56
+ config_diff_path = options[:next_config_diff_path]
57
+ output_path = options[:next_config_output_path] # deprecated
57
58
  resume_state_path = options[:resume_state_path]
58
59
 
59
- check_file_writable(output_path)
60
+ check_file_writable(output_path) # deprecated
61
+ check_file_writable(config_diff_path)
60
62
  check_file_writable(resume_state_path)
61
63
 
64
+ if config_diff_path
65
+ lastConfigDiff = read_config(config_diff_path, options)
66
+ configSource = configSource.merge(lastConfigDiff)
67
+ end
68
+
62
69
  if resume_state_path
63
70
  begin
64
71
  resumeConfig = read_yaml_config_file(resume_state_path)
@@ -100,7 +107,8 @@ module Embulk
100
107
  Embulk.logger.info("Committed.")
101
108
  Embulk.logger.info("Next config diff: #{configDiff.toString}")
102
109
 
103
- write_config(output_path, configSource.merge(configDiff))
110
+ write_config(config_diff_path, configDiff)
111
+ write_config(output_path, configSource.merge(configDiff)) # deprecated
104
112
  end
105
113
 
106
114
  #def resume_state(config, options={})
@@ -1,3 +1,3 @@
1
1
  module Embulk
2
- VERSION = '0.8.1'
2
+ VERSION = '0.8.2'
3
3
  end
metadata CHANGED
@@ -1,127 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: java
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-14 00:00:00.000000000 Z
11
+ date: 2016-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 1.10.6
20
14
  requirement: !ruby/object:Gem::Requirement
21
15
  requirements:
22
16
  - - ">="
23
17
  - !ruby/object:Gem::Version
24
18
  version: 1.10.6
19
+ name: bundler
25
20
  prerelease: false
26
21
  type: :runtime
27
- - !ruby/object:Gem::Dependency
28
- name: msgpack
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
- - - "~>"
24
+ - - ">="
32
25
  - !ruby/object:Gem::Version
33
- version: 0.7.3
26
+ version: 1.10.6
27
+ - !ruby/object:Gem::Dependency
34
28
  requirement: !ruby/object:Gem::Requirement
35
29
  requirements:
36
30
  - - "~>"
37
31
  - !ruby/object:Gem::Version
38
32
  version: 0.7.3
33
+ name: msgpack
39
34
  prerelease: false
40
35
  type: :runtime
41
- - !ruby/object:Gem::Dependency
42
- name: liquid
43
36
  version_requirements: !ruby/object:Gem::Requirement
44
37
  requirements:
45
38
  - - "~>"
46
39
  - !ruby/object:Gem::Version
47
- version: 3.0.6
40
+ version: 0.7.3
41
+ - !ruby/object:Gem::Dependency
48
42
  requirement: !ruby/object:Gem::Requirement
49
43
  requirements:
50
44
  - - "~>"
51
45
  - !ruby/object:Gem::Version
52
46
  version: 3.0.6
47
+ name: liquid
53
48
  prerelease: false
54
49
  type: :runtime
55
- - !ruby/object:Gem::Dependency
56
- name: rjack-icu
57
50
  version_requirements: !ruby/object:Gem::Requirement
58
51
  requirements:
59
52
  - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: 4.54.1.1
54
+ version: 3.0.6
55
+ - !ruby/object:Gem::Dependency
62
56
  requirement: !ruby/object:Gem::Requirement
63
57
  requirements:
64
58
  - - "~>"
65
59
  - !ruby/object:Gem::Version
66
60
  version: 4.54.1.1
61
+ name: rjack-icu
67
62
  prerelease: false
68
63
  type: :runtime
69
- - !ruby/object:Gem::Dependency
70
- name: rake
71
64
  version_requirements: !ruby/object:Gem::Requirement
72
65
  requirements:
73
- - - ">="
66
+ - - "~>"
74
67
  - !ruby/object:Gem::Version
75
- version: 0.10.0
68
+ version: 4.54.1.1
69
+ - !ruby/object:Gem::Dependency
76
70
  requirement: !ruby/object:Gem::Requirement
77
71
  requirements:
78
72
  - - ">="
79
73
  - !ruby/object:Gem::Version
80
74
  version: 0.10.0
75
+ name: rake
81
76
  prerelease: false
82
77
  type: :development
83
- - !ruby/object:Gem::Dependency
84
- name: test-unit
85
78
  version_requirements: !ruby/object:Gem::Requirement
86
79
  requirements:
87
- - - "~>"
80
+ - - ">="
88
81
  - !ruby/object:Gem::Version
89
- version: 3.0.9
82
+ version: 0.10.0
83
+ - !ruby/object:Gem::Dependency
90
84
  requirement: !ruby/object:Gem::Requirement
91
85
  requirements:
92
86
  - - "~>"
93
87
  - !ruby/object:Gem::Version
94
88
  version: 3.0.9
89
+ name: test-unit
95
90
  prerelease: false
96
91
  type: :development
97
- - !ruby/object:Gem::Dependency
98
- name: yard
99
92
  version_requirements: !ruby/object:Gem::Requirement
100
93
  requirements:
101
94
  - - "~>"
102
95
  - !ruby/object:Gem::Version
103
- version: 0.8.7
96
+ version: 3.0.9
97
+ - !ruby/object:Gem::Dependency
104
98
  requirement: !ruby/object:Gem::Requirement
105
99
  requirements:
106
100
  - - "~>"
107
101
  - !ruby/object:Gem::Version
108
102
  version: 0.8.7
103
+ name: yard
109
104
  prerelease: false
110
105
  type: :development
111
- - !ruby/object:Gem::Dependency
112
- name: kramdown
113
106
  version_requirements: !ruby/object:Gem::Requirement
114
107
  requirements:
115
108
  - - "~>"
116
109
  - !ruby/object:Gem::Version
117
- version: 1.5.0
110
+ version: 0.8.7
111
+ - !ruby/object:Gem::Dependency
118
112
  requirement: !ruby/object:Gem::Requirement
119
113
  requirements:
120
114
  - - "~>"
121
115
  - !ruby/object:Gem::Version
122
116
  version: 1.5.0
117
+ name: kramdown
123
118
  prerelease: false
124
119
  type: :development
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.5.0
125
125
  description: Embulk is an open-source, plugin-based bulk data loader to scale and simplify data management across heterogeneous data stores. It can collect and ship any kinds of data in high throughput with transaction control.
126
126
  email:
127
127
  - frsyuki@gmail.com
@@ -147,8 +147,8 @@ files:
147
147
  - classpath/bval-jsr303-0.5.jar
148
148
  - classpath/commons-beanutils-core-1.8.3.jar
149
149
  - classpath/commons-lang3-3.1.jar
150
- - classpath/embulk-core-0.8.1.jar
151
- - classpath/embulk-standards-0.8.1.jar
150
+ - classpath/embulk-core-0.8.2.jar
151
+ - classpath/embulk-standards-0.8.2.jar
152
152
  - classpath/guava-18.0.jar
153
153
  - classpath/guice-4.0.jar
154
154
  - classpath/guice-bootstrap-0.1.1.jar
@@ -459,6 +459,7 @@ files:
459
459
  - embulk-docs/src/release/release-0.7.9.rst
460
460
  - embulk-docs/src/release/release-0.8.0.rst
461
461
  - embulk-docs/src/release/release-0.8.1.rst
462
+ - embulk-docs/src/release/release-0.8.2.rst
462
463
  - embulk-standards/build.gradle
463
464
  - embulk-standards/src/main/java/org/embulk/standards/CsvFormatterPlugin.java
464
465
  - embulk-standards/src/main/java/org/embulk/standards/CsvParserPlugin.java