embulk 0.6.27 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/Gemfile.lock +6 -1
- data/README.md +4 -4
- data/bin/embulk +39 -17
- data/build.gradle +23 -8
- data/embulk-cli/src/main/java/org/embulk/cli/Main.java +11 -2
- data/embulk-core/build.gradle +9 -4
- data/embulk-core/src/main/java/org/embulk/EmbulkEmbed.java +160 -61
- data/embulk-core/src/main/java/org/embulk/EmbulkService.java +1 -0
- data/embulk-core/src/main/java/org/embulk/command/TablePreviewPrinter.java +0 -1
- data/embulk-core/src/main/java/org/embulk/config/CommitReport.java +5 -1
- data/embulk-core/src/main/java/org/embulk/config/ConfigLoader.java +28 -7
- data/embulk-core/src/main/java/org/embulk/config/DataSourceImpl.java +1 -4
- data/embulk-core/src/main/java/org/embulk/config/DataSourceSerDe.java +6 -3
- data/embulk-core/src/main/java/org/embulk/config/ModelManager.java +0 -2
- data/embulk-core/src/main/java/org/embulk/config/TaskReport.java +29 -0
- data/embulk-core/src/main/java/org/embulk/exec/BulkLoader.java +42 -45
- data/embulk-core/src/main/java/org/embulk/exec/ExecModule.java +0 -1
- data/embulk-core/src/main/java/org/embulk/exec/GuessExecutor.java +4 -7
- data/embulk-core/src/main/java/org/embulk/exec/LocalExecutorPlugin.java +5 -6
- data/embulk-core/src/main/java/org/embulk/exec/LoggerProvider.java +0 -1
- data/embulk-core/src/main/java/org/embulk/exec/PooledBufferAllocator.java +0 -3
- data/embulk-core/src/main/java/org/embulk/exec/PreviewExecutor.java +2 -2
- data/embulk-core/src/main/java/org/embulk/exec/ResumeState.java +26 -9
- data/embulk-core/src/main/java/org/embulk/exec/SamplingParserPlugin.java +2 -4
- data/embulk-core/src/main/java/org/embulk/guice/Bootstrap.java +12 -5
- data/embulk-core/src/main/java/org/embulk/guice/CloseableInjector.java +1 -1
- data/embulk-core/src/main/java/org/embulk/guice/LifeCycleInjector.java +26 -0
- data/embulk-core/src/main/java/org/embulk/guice/{CloseableInjectorProxy.java → LifeCycleInjectorProxy.java} +20 -6
- data/embulk-core/src/main/java/org/embulk/jruby/JRubyScriptingModule.java +10 -12
- data/embulk-core/src/main/java/org/embulk/plugin/PluginClassLoaderModule.java +0 -1
- data/embulk-core/src/main/java/org/embulk/plugin/PluginManager.java +14 -1
- data/embulk-core/src/main/java/org/embulk/plugin/compat/InputPluginWrapper.java +102 -0
- data/embulk-core/src/main/java/org/embulk/plugin/compat/PluginWrappers.java +30 -0
- data/embulk-core/src/main/java/org/embulk/plugin/compat/TransactionalFileInputWrapper.java +96 -0
- data/embulk-core/src/main/java/org/embulk/plugin/compat/TransactionalFileOutputWrapper.java +102 -0
- data/embulk-core/src/main/java/org/embulk/plugin/compat/TransactionalPageOutputWrapper.java +95 -0
- data/embulk-core/src/main/java/org/embulk/spi/ColumnConfig.java +0 -2
- data/embulk-core/src/main/java/org/embulk/spi/Exec.java +8 -2
- data/embulk-core/src/main/java/org/embulk/spi/ExecSession.java +7 -1
- data/embulk-core/src/main/java/org/embulk/spi/Extension.java +2 -2
- data/embulk-core/src/main/java/org/embulk/spi/FileInputPlugin.java +3 -3
- data/embulk-core/src/main/java/org/embulk/spi/FileInputRunner.java +12 -10
- data/embulk-core/src/main/java/org/embulk/spi/FileOutputPlugin.java +3 -3
- data/embulk-core/src/main/java/org/embulk/spi/FileOutputRunner.java +11 -9
- data/embulk-core/src/main/java/org/embulk/spi/FilterPlugin.java +0 -3
- data/embulk-core/src/main/java/org/embulk/spi/InputPlugin.java +4 -4
- data/embulk-core/src/main/java/org/embulk/spi/OutputPlugin.java +3 -3
- data/embulk-core/src/main/java/org/embulk/spi/PageReader.java +0 -1
- data/embulk-core/src/main/java/org/embulk/spi/ProcessTask.java +0 -5
- data/embulk-core/src/main/java/org/embulk/spi/SchemaConfig.java +0 -1
- data/embulk-core/src/main/java/org/embulk/spi/TaskState.java +19 -4
- data/embulk-core/src/main/java/org/embulk/spi/TempFileSpace.java +0 -3
- data/embulk-core/src/main/java/org/embulk/spi/Transactional.java +2 -2
- data/embulk-core/src/main/java/org/embulk/spi/TransactionalFileInput.java +2 -2
- data/embulk-core/src/main/java/org/embulk/spi/TransactionalFileOutput.java +2 -2
- data/embulk-core/src/main/java/org/embulk/spi/TransactionalPageOutput.java +2 -2
- data/embulk-core/src/main/java/org/embulk/spi/time/DateTimeZoneSerDe.java +0 -2
- data/embulk-core/src/main/java/org/embulk/spi/time/TimestampFormat.java +0 -3
- data/embulk-core/src/main/java/org/embulk/spi/time/TimestampFormatter.java +0 -1
- data/embulk-core/src/main/java/org/embulk/spi/time/TimestampParser.java +0 -1
- data/embulk-core/src/main/java/org/embulk/spi/time/TimestampSerDe.java +0 -1
- data/embulk-core/src/main/java/org/embulk/spi/type/TypeDeserializer.java +0 -3
- data/embulk-core/src/main/java/org/embulk/spi/unit/LocalFileSerDe.java +0 -3
- data/embulk-core/src/main/java/org/embulk/spi/unit/ToStringMap.java +0 -1
- data/embulk-core/src/main/java/org/embulk/spi/util/Executors.java +15 -12
- data/embulk-core/src/main/java/org/embulk/spi/util/Filters.java +0 -1
- data/embulk-core/src/test/java/org/embulk/spi/TestFileInputRunner.java +7 -7
- data/embulk-core/src/test/java/org/embulk/spi/TestFileOutputRunner.java +8 -8
- data/embulk-docs/src/built-in.rst +27 -30
- data/embulk-docs/src/conf.py +2 -2
- data/embulk-docs/src/release.rst +1 -2
- data/embulk-docs/src/release/release-0.7.0.rst +96 -0
- data/embulk-standards/src/main/java/org/embulk/standards/CsvFormatterPlugin.java +0 -4
- data/embulk-standards/src/main/java/org/embulk/standards/CsvParserPlugin.java +0 -10
- data/embulk-standards/src/main/java/org/embulk/standards/CsvTokenizer.java +1 -5
- data/embulk-standards/src/main/java/org/embulk/standards/LocalFileInputPlugin.java +4 -5
- data/embulk-standards/src/main/java/org/embulk/standards/LocalFileOutputPlugin.java +4 -5
- data/embulk-standards/src/main/java/org/embulk/standards/NullOutputPlugin.java +4 -4
- data/embulk-standards/src/main/java/org/embulk/standards/StandardPluginModule.java +0 -3
- data/embulk-standards/src/main/java/org/embulk/standards/StdoutOutputPlugin.java +4 -6
- data/embulk.gemspec +14 -1
- data/lib/embulk.rb +59 -4
- data/lib/embulk/command/embulk_bundle.rb +56 -0
- data/lib/embulk/command/embulk_main.rb +2 -0
- data/lib/embulk/command/embulk_migrate_plugin.rb +170 -0
- data/lib/embulk/command/embulk_new_plugin.rb +4 -1
- data/lib/embulk/command/embulk_run.rb +188 -227
- data/lib/embulk/data/bundle/.ruby-version +1 -0
- data/lib/embulk/data/bundle/Gemfile +4 -1
- data/lib/embulk/data/bundle/embulk/input/example.rb +4 -4
- data/lib/embulk/data/bundle/embulk/output/example.rb +4 -4
- data/lib/embulk/data/new/README.md.erb +1 -1
- data/lib/embulk/data/new/java/file_input.java.erb +4 -4
- data/lib/embulk/data/new/java/file_output.java.erb +2 -2
- data/lib/embulk/data/new/java/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/lib/embulk/data/new/java/gradle/wrapper/gradle-wrapper.properties +2 -2
- data/lib/embulk/data/new/java/input.java.erb +3 -3
- data/lib/embulk/data/new/java/output.java.erb +2 -2
- data/lib/embulk/data/new/ruby/.ruby-version +1 -0
- data/lib/embulk/data/new/ruby/gemspec.erb +1 -0
- data/lib/embulk/data/new/ruby/input.rb.erb +3 -3
- data/lib/embulk/data/new/ruby/output.rb.erb +4 -4
- data/lib/embulk/data/package_data.rb +1 -15
- data/lib/embulk/guess/charset.rb +10 -1
- data/lib/embulk/input_plugin.rb +12 -12
- data/lib/embulk/java/bootstrap.rb +7 -4
- data/lib/embulk/java/imports.rb +34 -2
- data/lib/embulk/logger.rb +2 -0
- data/lib/embulk/output_plugin.rb +12 -12
- data/lib/embulk/page_builder.rb +1 -1
- data/lib/embulk/plugin.rb +0 -1
- data/lib/embulk/runner.rb +184 -0
- data/lib/embulk/version.rb +1 -1
- metadata +76 -55
- data/embulk-core/src/main/java/org/embulk/command/LiquidTemplate.java +0 -8
- data/embulk-core/src/main/java/org/embulk/command/Runner.java +0 -369
- data/embulk-docs/src/release/release-0.6.26.rst +0 -17
- data/embulk-docs/src/release/release-0.6.27.rst +0 -11
- data/lib/embulk/command/embulk.rb +0 -47
- data/lib/embulk/data/bundle/Gemfile.lock +0 -8
- data/lib/embulk/exec.rb +0 -8
- data/lib/embulk/gems.rb +0 -29
- data/lib/embulk/java/liquid_helper.rb +0 -16
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
package org.embulk.plugin.compat;
|
|
2
|
+
|
|
3
|
+
import org.embulk.spi.InputPlugin;
|
|
4
|
+
import org.embulk.spi.TransactionalFileInput;
|
|
5
|
+
import org.embulk.spi.TransactionalFileOutput;
|
|
6
|
+
import org.embulk.spi.TransactionalPageOutput;
|
|
7
|
+
import org.embulk.plugin.compat.InputPluginWrapper;
|
|
8
|
+
|
|
9
|
+
public class PluginWrappers
|
|
10
|
+
{
|
|
11
|
+
public static InputPlugin inputPlugin(InputPlugin input)
|
|
12
|
+
{
|
|
13
|
+
return InputPluginWrapper.wrapIfNecessary(input);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public static TransactionalFileInput transactionalFileInput(TransactionalFileInput tran)
|
|
17
|
+
{
|
|
18
|
+
return TransactionalFileInputWrapper.wrapIfNecessary(tran);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public static TransactionalFileOutput transactionalFileOutput(TransactionalFileOutput tran)
|
|
22
|
+
{
|
|
23
|
+
return TransactionalFileOutputWrapper.wrapIfNecessary(tran);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public static TransactionalPageOutput transactionalPageOutput(TransactionalPageOutput tran)
|
|
27
|
+
{
|
|
28
|
+
return TransactionalPageOutputWrapper.wrapIfNecessary(tran);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
package org.embulk.plugin.compat;
|
|
2
|
+
|
|
3
|
+
import java.lang.reflect.Method;
|
|
4
|
+
import java.lang.reflect.InvocationTargetException;
|
|
5
|
+
import com.google.common.base.Throwables;
|
|
6
|
+
import org.embulk.config.TaskReport;
|
|
7
|
+
import org.embulk.config.CommitReport;
|
|
8
|
+
import org.embulk.spi.Buffer;
|
|
9
|
+
import org.embulk.spi.TransactionalFileInput;
|
|
10
|
+
import org.slf4j.Logger;
|
|
11
|
+
import org.slf4j.LoggerFactory;
|
|
12
|
+
|
|
13
|
+
public class TransactionalFileInputWrapper
|
|
14
|
+
implements TransactionalFileInput
|
|
15
|
+
{
|
|
16
|
+
private final Logger logger = LoggerFactory.getLogger(PluginWrappers.class);
|
|
17
|
+
|
|
18
|
+
public static TransactionalFileInput wrapIfNecessary(TransactionalFileInput object)
|
|
19
|
+
{
|
|
20
|
+
Method runMethod = wrapCommitMethod(object);
|
|
21
|
+
if (runMethod != null) {
|
|
22
|
+
return new TransactionalFileInputWrapper(object, runMethod);
|
|
23
|
+
}
|
|
24
|
+
return object;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private static Method wrapCommitMethod(TransactionalFileInput object)
|
|
28
|
+
{
|
|
29
|
+
try {
|
|
30
|
+
Method m = object.getClass().getMethod("commit");
|
|
31
|
+
if (m.getReturnType().equals(CommitReport.class)) {
|
|
32
|
+
return m;
|
|
33
|
+
} else {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (NoSuchMethodException ex) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private final TransactionalFileInput object;
|
|
43
|
+
private final Method commitMethod;
|
|
44
|
+
|
|
45
|
+
private TransactionalFileInputWrapper(TransactionalFileInput object,
|
|
46
|
+
Method commitMethod)
|
|
47
|
+
{
|
|
48
|
+
this.object = object;
|
|
49
|
+
this.commitMethod = commitMethod;
|
|
50
|
+
logger.warn("A file input plugin is compiled with old Embulk plugin API. Please update the plugin version using \"embulk gem install\" command, or contact a developer of the plugin to upgrade the plugin code using \"embulk migrate\" command: {}", object.getClass());
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@Override
|
|
54
|
+
public Buffer poll()
|
|
55
|
+
{
|
|
56
|
+
return object.poll();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Override
|
|
60
|
+
public boolean nextFile()
|
|
61
|
+
{
|
|
62
|
+
return object.nextFile();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@Override
|
|
66
|
+
public void close()
|
|
67
|
+
{
|
|
68
|
+
object.close();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Override
|
|
72
|
+
public void abort()
|
|
73
|
+
{
|
|
74
|
+
object.abort();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@Override
|
|
78
|
+
public TaskReport commit()
|
|
79
|
+
{
|
|
80
|
+
if (commitMethod != null) {
|
|
81
|
+
try {
|
|
82
|
+
return (TaskReport) commitMethod.invoke(object);
|
|
83
|
+
}
|
|
84
|
+
catch (IllegalAccessException | IllegalArgumentException ex) {
|
|
85
|
+
throw Throwables.propagate(ex);
|
|
86
|
+
}
|
|
87
|
+
catch (InvocationTargetException ex) {
|
|
88
|
+
throw Throwables.propagate(ex.getCause());
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
} else {
|
|
92
|
+
return object.commit();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
package org.embulk.plugin.compat;
|
|
2
|
+
|
|
3
|
+
import java.lang.reflect.Method;
|
|
4
|
+
import java.lang.reflect.InvocationTargetException;
|
|
5
|
+
import com.google.common.base.Throwables;
|
|
6
|
+
import org.embulk.config.TaskReport;
|
|
7
|
+
import org.embulk.config.CommitReport;
|
|
8
|
+
import org.embulk.spi.Buffer;
|
|
9
|
+
import org.embulk.spi.TransactionalFileOutput;
|
|
10
|
+
import org.slf4j.Logger;
|
|
11
|
+
import org.slf4j.LoggerFactory;
|
|
12
|
+
|
|
13
|
+
public class TransactionalFileOutputWrapper
|
|
14
|
+
implements TransactionalFileOutput
|
|
15
|
+
{
|
|
16
|
+
private final Logger logger = LoggerFactory.getLogger(PluginWrappers.class);
|
|
17
|
+
|
|
18
|
+
public static TransactionalFileOutput wrapIfNecessary(TransactionalFileOutput object)
|
|
19
|
+
{
|
|
20
|
+
Method runMethod = wrapCommitMethod(object);
|
|
21
|
+
if (runMethod != null) {
|
|
22
|
+
return new TransactionalFileOutputWrapper(object, runMethod);
|
|
23
|
+
}
|
|
24
|
+
return object;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private static Method wrapCommitMethod(TransactionalFileOutput object)
|
|
28
|
+
{
|
|
29
|
+
try {
|
|
30
|
+
Method m = object.getClass().getMethod("commit");
|
|
31
|
+
if (m.getReturnType().equals(CommitReport.class)) {
|
|
32
|
+
return m;
|
|
33
|
+
} else {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (NoSuchMethodException ex) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private final TransactionalFileOutput object;
|
|
43
|
+
private final Method commitMethod;
|
|
44
|
+
|
|
45
|
+
private TransactionalFileOutputWrapper(TransactionalFileOutput object,
|
|
46
|
+
Method commitMethod)
|
|
47
|
+
{
|
|
48
|
+
this.object = object;
|
|
49
|
+
this.commitMethod = commitMethod;
|
|
50
|
+
logger.warn("A file output plugin is compiled with old Embulk plugin API. Please update the plugin version using \"embulk gem install\" command, or contact a developer of the plugin to upgrade the plugin code using \"embulk migrate\" command: {}", object.getClass());
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@Override
|
|
54
|
+
public void nextFile()
|
|
55
|
+
{
|
|
56
|
+
object.nextFile();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Override
|
|
60
|
+
public void add(Buffer buffer)
|
|
61
|
+
{
|
|
62
|
+
object.add(buffer);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@Override
|
|
66
|
+
public void finish()
|
|
67
|
+
{
|
|
68
|
+
object.finish();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Override
|
|
72
|
+
public void close()
|
|
73
|
+
{
|
|
74
|
+
object.close();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@Override
|
|
78
|
+
public void abort()
|
|
79
|
+
{
|
|
80
|
+
object.abort();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@Override
|
|
84
|
+
public TaskReport commit()
|
|
85
|
+
{
|
|
86
|
+
if (commitMethod != null) {
|
|
87
|
+
try {
|
|
88
|
+
return (TaskReport) commitMethod.invoke(object);
|
|
89
|
+
}
|
|
90
|
+
catch (IllegalAccessException | IllegalArgumentException ex) {
|
|
91
|
+
throw Throwables.propagate(ex);
|
|
92
|
+
}
|
|
93
|
+
catch (InvocationTargetException ex) {
|
|
94
|
+
throw Throwables.propagate(ex.getCause());
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
} else {
|
|
98
|
+
return object.commit();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
package org.embulk.plugin.compat;
|
|
2
|
+
|
|
3
|
+
import java.lang.reflect.Method;
|
|
4
|
+
import java.lang.reflect.InvocationTargetException;
|
|
5
|
+
import com.google.common.base.Throwables;
|
|
6
|
+
import org.embulk.config.TaskReport;
|
|
7
|
+
import org.embulk.config.CommitReport;
|
|
8
|
+
import org.embulk.spi.Page;
|
|
9
|
+
import org.embulk.spi.TransactionalPageOutput;
|
|
10
|
+
import org.slf4j.Logger;
|
|
11
|
+
import org.slf4j.LoggerFactory;
|
|
12
|
+
|
|
13
|
+
public class TransactionalPageOutputWrapper
|
|
14
|
+
implements TransactionalPageOutput
|
|
15
|
+
{
|
|
16
|
+
private final Logger logger = LoggerFactory.getLogger(PluginWrappers.class);
|
|
17
|
+
|
|
18
|
+
public static TransactionalPageOutput wrapIfNecessary(TransactionalPageOutput object)
|
|
19
|
+
{
|
|
20
|
+
Method runMethod = wrapCommitMethod(object);
|
|
21
|
+
if (runMethod != null) {
|
|
22
|
+
return new TransactionalPageOutputWrapper(object, runMethod);
|
|
23
|
+
}
|
|
24
|
+
return object;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private static Method wrapCommitMethod(TransactionalPageOutput object)
|
|
28
|
+
{
|
|
29
|
+
try {
|
|
30
|
+
Method m = object.getClass().getMethod("commit");
|
|
31
|
+
if (m.getReturnType().equals(CommitReport.class)) {
|
|
32
|
+
return m;
|
|
33
|
+
} else {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (NoSuchMethodException ex) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private final TransactionalPageOutput object;
|
|
43
|
+
private final Method commitMethod;
|
|
44
|
+
|
|
45
|
+
private TransactionalPageOutputWrapper(TransactionalPageOutput object,
|
|
46
|
+
Method commitMethod)
|
|
47
|
+
{
|
|
48
|
+
this.object = object;
|
|
49
|
+
this.commitMethod = commitMethod;
|
|
50
|
+
logger.warn("An output plugin is compiled with old Embulk plugin API. Please update the plugin version using \"embulk gem install\" command, or contact a developer of the plugin to upgrade the plugin code using \"embulk migrate\" command: {}", object.getClass());
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@Override
|
|
54
|
+
public void add(Page page)
|
|
55
|
+
{
|
|
56
|
+
object.add(page);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Override
|
|
60
|
+
public void finish()
|
|
61
|
+
{
|
|
62
|
+
object.finish();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@Override
|
|
66
|
+
public void close()
|
|
67
|
+
{
|
|
68
|
+
object.close();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Override
|
|
72
|
+
public void abort()
|
|
73
|
+
{
|
|
74
|
+
object.abort();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@Override
|
|
78
|
+
public TaskReport commit()
|
|
79
|
+
{
|
|
80
|
+
if (commitMethod != null) {
|
|
81
|
+
try {
|
|
82
|
+
return (TaskReport) commitMethod.invoke(object);
|
|
83
|
+
}
|
|
84
|
+
catch (IllegalAccessException | IllegalArgumentException ex) {
|
|
85
|
+
throw Throwables.propagate(ex);
|
|
86
|
+
}
|
|
87
|
+
catch (InvocationTargetException ex) {
|
|
88
|
+
throw Throwables.propagate(ex.getCause());
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
} else {
|
|
92
|
+
return object.commit();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -2,12 +2,10 @@ package org.embulk.spi;
|
|
|
2
2
|
|
|
3
3
|
import java.util.Objects;
|
|
4
4
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
5
|
-
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
6
5
|
import com.fasterxml.jackson.annotation.JsonValue;
|
|
7
6
|
import org.embulk.config.ConfigSource;
|
|
8
7
|
import org.embulk.spi.type.Type;
|
|
9
8
|
import org.embulk.spi.type.TimestampType;
|
|
10
|
-
import org.embulk.spi.Exec;
|
|
11
9
|
|
|
12
10
|
public class ColumnConfig
|
|
13
11
|
{
|
|
@@ -3,9 +3,9 @@ package org.embulk.spi;
|
|
|
3
3
|
import java.util.concurrent.ExecutionException;
|
|
4
4
|
import org.slf4j.Logger;
|
|
5
5
|
import com.google.inject.Injector;
|
|
6
|
-
import org.embulk.config.Task;
|
|
7
6
|
import org.embulk.config.ModelManager;
|
|
8
|
-
import org.embulk.config.CommitReport;
|
|
7
|
+
import org.embulk.config.CommitReport; // Deprecated
|
|
8
|
+
import org.embulk.config.TaskReport;
|
|
9
9
|
import org.embulk.config.ConfigDiff;
|
|
10
10
|
import org.embulk.config.ConfigSource;
|
|
11
11
|
import org.embulk.config.TaskSource;
|
|
@@ -74,6 +74,12 @@ public class Exec
|
|
|
74
74
|
return session().newPlugin(iface, type);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
public static TaskReport newTaskReport()
|
|
78
|
+
{
|
|
79
|
+
return session().newTaskReport();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@Deprecated
|
|
77
83
|
public static CommitReport newCommitReport()
|
|
78
84
|
{
|
|
79
85
|
return session().newCommitReport();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
package org.embulk.spi;
|
|
2
2
|
|
|
3
|
-
import java.io.File;
|
|
4
3
|
import org.joda.time.DateTimeZone;
|
|
5
4
|
import org.slf4j.Logger;
|
|
6
5
|
import org.slf4j.ILoggerFactory;
|
|
@@ -11,6 +10,7 @@ import org.embulk.config.Config;
|
|
|
11
10
|
import org.embulk.config.ConfigDefault;
|
|
12
11
|
import org.embulk.config.ModelManager;
|
|
13
12
|
import org.embulk.config.CommitReport;
|
|
13
|
+
import org.embulk.config.TaskReport;
|
|
14
14
|
import org.embulk.config.ConfigDiff;
|
|
15
15
|
import org.embulk.config.ConfigSource;
|
|
16
16
|
import org.embulk.config.TaskSource;
|
|
@@ -166,6 +166,12 @@ public class ExecSession
|
|
|
166
166
|
return pluginManager.newPlugin(iface, type);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
public TaskReport newTaskReport()
|
|
170
|
+
{
|
|
171
|
+
return new DataSourceImpl(modelManager);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@Deprecated
|
|
169
175
|
public CommitReport newCommitReport()
|
|
170
176
|
{
|
|
171
177
|
return new DataSourceImpl(modelManager);
|
|
@@ -8,10 +8,10 @@ import org.embulk.config.ConfigSource;
|
|
|
8
8
|
* Extension is a module to extend the execution framework using Guice.
|
|
9
9
|
* Unlike plugins, extensions can overwrite or add core components such as
|
|
10
10
|
* BufferManager, PluginSource, etc.
|
|
11
|
-
* Extension is not designed for users but for framework
|
|
11
|
+
* Extension is not designed for users but for framework developers to make
|
|
12
12
|
* core components loosely coupled.
|
|
13
13
|
*
|
|
14
|
-
* An example
|
|
14
|
+
* An example extension to add a custom PluginSource will be as following:
|
|
15
15
|
*
|
|
16
16
|
* <code>
|
|
17
17
|
* class MyPluginSourceExtension
|
|
@@ -4,13 +4,13 @@ import java.util.List;
|
|
|
4
4
|
import org.embulk.config.TaskSource;
|
|
5
5
|
import org.embulk.config.ConfigSource;
|
|
6
6
|
import org.embulk.config.ConfigDiff;
|
|
7
|
-
import org.embulk.config.
|
|
7
|
+
import org.embulk.config.TaskReport;
|
|
8
8
|
|
|
9
9
|
public interface FileInputPlugin
|
|
10
10
|
{
|
|
11
11
|
interface Control
|
|
12
12
|
{
|
|
13
|
-
List<
|
|
13
|
+
List<TaskReport> run(TaskSource taskSource,
|
|
14
14
|
int taskCount);
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -23,7 +23,7 @@ public interface FileInputPlugin
|
|
|
23
23
|
|
|
24
24
|
void cleanup(TaskSource taskSource,
|
|
25
25
|
int taskCount,
|
|
26
|
-
List<
|
|
26
|
+
List<TaskReport> successTaskReports);
|
|
27
27
|
|
|
28
28
|
TransactionalFileInput open(TaskSource taskSource,
|
|
29
29
|
int taskIndex);
|
|
@@ -6,10 +6,11 @@ import org.embulk.config.Task;
|
|
|
6
6
|
import org.embulk.config.TaskSource;
|
|
7
7
|
import org.embulk.config.ConfigSource;
|
|
8
8
|
import org.embulk.config.ConfigDiff;
|
|
9
|
-
import org.embulk.config.
|
|
9
|
+
import org.embulk.config.TaskReport;
|
|
10
10
|
import org.embulk.config.Config;
|
|
11
11
|
import org.embulk.config.ConfigDefault;
|
|
12
12
|
import org.embulk.plugin.PluginType;
|
|
13
|
+
import org.embulk.plugin.compat.PluginWrappers;
|
|
13
14
|
import org.embulk.spi.util.Decoders;
|
|
14
15
|
import org.embulk.exec.GuessExecutor;
|
|
15
16
|
import org.embulk.exec.SamplingParserPlugin;
|
|
@@ -102,9 +103,9 @@ public class FileInputRunner
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
@Override
|
|
105
|
-
public List<
|
|
106
|
+
public List<TaskReport> run(final TaskSource fileInputTaskSource, final int taskCount)
|
|
106
107
|
{
|
|
107
|
-
final List<
|
|
108
|
+
final List<TaskReport> taskReports = new ArrayList<TaskReport>();
|
|
108
109
|
Decoders.transaction(decoderPlugins, task.getDecoderConfigs(), new Decoders.Control() {
|
|
109
110
|
public void run(final List<TaskSource> decoderTaskSources)
|
|
110
111
|
{
|
|
@@ -114,37 +115,38 @@ public class FileInputRunner
|
|
|
114
115
|
task.setFileInputTaskSource(fileInputTaskSource);
|
|
115
116
|
task.setDecoderTaskSources(decoderTaskSources);
|
|
116
117
|
task.setParserTaskSource(parserTaskSource);
|
|
117
|
-
|
|
118
|
+
taskReports.addAll(nextControl.run(task.dump(), schema, taskCount));
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
122
|
});
|
|
122
|
-
return
|
|
123
|
+
return taskReports;
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
public void cleanup(TaskSource taskSource,
|
|
127
128
|
Schema schema, int taskCount,
|
|
128
|
-
List<
|
|
129
|
+
List<TaskReport> successTaskReports)
|
|
129
130
|
{
|
|
130
|
-
fileInputPlugin.cleanup(taskSource, taskCount,
|
|
131
|
+
fileInputPlugin.cleanup(taskSource, taskCount, successTaskReports);
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
@Override
|
|
134
|
-
public
|
|
135
|
+
public TaskReport run(TaskSource taskSource, Schema schema, int taskIndex,
|
|
135
136
|
PageOutput output)
|
|
136
137
|
{
|
|
137
138
|
final RunnerTask task = taskSource.loadTask(RunnerTask.class);
|
|
138
139
|
List<DecoderPlugin> decoderPlugins = newDecoderPlugins(task);
|
|
139
140
|
ParserPlugin parserPlugin = newParserPlugin(task);
|
|
140
141
|
|
|
141
|
-
TransactionalFileInput tran =
|
|
142
|
+
TransactionalFileInput tran = PluginWrappers.transactionalFileInput(
|
|
143
|
+
fileInputPlugin.open(task.getFileInputTaskSource(), taskIndex));
|
|
142
144
|
FileInput fileInput = tran;
|
|
143
145
|
try {
|
|
144
146
|
fileInput = Decoders.open(decoderPlugins, task.getDecoderTaskSources(), fileInput);
|
|
145
147
|
parserPlugin.run(task.getParserTaskSource(), schema, fileInput, output);
|
|
146
148
|
|
|
147
|
-
|
|
149
|
+
TaskReport report = tran.commit(); // TODO check output.finish() is called. wrap
|
|
148
150
|
tran = null;
|
|
149
151
|
return report;
|
|
150
152
|
} finally {
|