use of org.embulk.spi.ExecSession in project embulk by embulk.
the class EmbulkEmbed method preview.
public PreviewResult preview(ConfigSource config) {
this.logger.info("Started Embulk v" + EmbulkVersion.VERSION);
ExecSession exec = newExecSession(config);
try {
return previewExecutor.preview(exec, config);
} finally {
exec.cleanup();
}
}
use of org.embulk.spi.ExecSession in project embulk by embulk.
the class EmbulkEmbed method guess.
public ConfigDiff guess(ConfigSource config) {
this.logger.info("Started Embulk v" + EmbulkVersion.VERSION);
ExecSession exec = newExecSession(config);
try {
return guessExecutor.guess(exec, config);
} finally {
exec.cleanup();
}
}
use of org.embulk.spi.ExecSession in project embulk by embulk.
the class BulkLoader method resume.
public ExecutionResult resume(final ConfigSource config, final ResumeState resume) {
try {
ExecSession exec = ExecSession.builder(injector).fromExecConfig(resume.getExecSessionConfigSource()).build();
ExecutionResult result = Exec.doWith(exec, new ExecAction<ExecutionResult>() {
public ExecutionResult run() {
try (SetCurrentThreadName dontCare = new SetCurrentThreadName("resume")) {
return doResume(config, resume);
}
}
});
exec.cleanup();
return result;
} catch (ExecutionException ex) {
throw Throwables.propagate(ex.getCause());
}
}
use of org.embulk.spi.ExecSession in project embulk by embulk.
the class EmbulkEmbed method run.
public ExecutionResult run(ConfigSource config) {
this.logger.info("Started Embulk v" + EmbulkVersion.VERSION);
ExecSession exec = newExecSession(config);
try {
return bulkLoader.run(exec, config);
} catch (PartialExecutionException partial) {
try {
bulkLoader.cleanup(config, partial.getResumeState());
} catch (Throwable ex) {
partial.addSuppressed(ex);
}
throw partial;
} finally {
try {
exec.cleanup();
} catch (Exception ex) {
// TODO add this exception to ExecutionResult.getIgnoredExceptions
// or partial.addSuppressed
ex.printStackTrace(System.err);
}
}
}
use of org.embulk.spi.ExecSession in project embulk by embulk.
the class EmbulkEmbed method runResumable.
public ResumableResult runResumable(ConfigSource config) {
this.logger.info("Started Embulk v" + EmbulkVersion.VERSION);
ExecSession exec = newExecSession(config);
try {
ExecutionResult result;
try {
result = bulkLoader.run(exec, config);
} catch (PartialExecutionException partial) {
return new ResumableResult(partial);
}
return new ResumableResult(result);
} finally {
try {
exec.cleanup();
} catch (Exception ex) {
// TODO add this exception to ExecutionResult.getIgnoredExceptions
// or partial.addSuppressed
ex.printStackTrace(System.err);
}
}
}
Aggregations