embulk 0.8.1 → 0.8.2

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: a189a85d312e0621daf89d790baf4fa45d0e0125
4
- data.tar.gz: d7355b10940135fce461332f40d6f8180b3c41c2
3
+ metadata.gz: e49862e13c81831477cfed94aea2db310b8bc51c
4
+ data.tar.gz: 9b59130a3b0ceca8d4980a7c32e979d84f7b5ab1
5
5
  SHA512:
6
- metadata.gz: 09609e12b41ce696b190be750cee3687fcd0f9f04d24597345415080c8ffdd7319ed33129584f8c500a6893c2cdb4cba86d7ddeb34bab0cf4727c2beb3388336
7
- data.tar.gz: b46a461b1f845e7020d6ac5c3553ed4ca1a764ae0ae80fccc52d4bd9a35db11fe24ec6ab721fd3ae841f365d6d92fc0f40213d2053d5c9a1c9d74ae6bb8e62f6
6
+ metadata.gz: e8d58a7659d4445c83534859d5cf8043099877b03e1544be8f531b6a644ebfd116de970ac38d92558310ed19991aa476e1a4f96a829382a0692ac57b506b1fb1
7
+ data.tar.gz: 52e734f97666ea28f4a3f6564f7f74001d35f85e59a0b4cf3c6f9aa3c77902ac06438184b13ee44b906ecd5760b01361f799d967167617d2a7c19f1020ce7cb2
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
  ```
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.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 ""
data/lib/embulk/runner.rb CHANGED
@@ -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,14 +1,14 @@
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: ruby
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
14
  name: jruby-jars
@@ -107,8 +107,8 @@ files:
107
107
  - classpath/bval-jsr303-0.5.jar
108
108
  - classpath/commons-beanutils-core-1.8.3.jar
109
109
  - classpath/commons-lang3-3.1.jar
110
- - classpath/embulk-core-0.8.1.jar
111
- - classpath/embulk-standards-0.8.1.jar
110
+ - classpath/embulk-core-0.8.2.jar
111
+ - classpath/embulk-standards-0.8.2.jar
112
112
  - classpath/guava-18.0.jar
113
113
  - classpath/guice-4.0.jar
114
114
  - classpath/guice-bootstrap-0.1.1.jar
@@ -419,6 +419,7 @@ files:
419
419
  - embulk-docs/src/release/release-0.7.9.rst
420
420
  - embulk-docs/src/release/release-0.8.0.rst
421
421
  - embulk-docs/src/release/release-0.8.1.rst
422
+ - embulk-docs/src/release/release-0.8.2.rst
422
423
  - embulk-standards/build.gradle
423
424
  - embulk-standards/src/main/java/org/embulk/standards/CsvFormatterPlugin.java
424
425
  - embulk-standards/src/main/java/org/embulk/standards/CsvParserPlugin.java