use of org.embulk.spi.TransactionalPageOutput in project embulk by embulk.
the class Executors method process.
public static void process(ExecSession exec, int taskIndex, InputPlugin inputPlugin, Schema inputSchema, TaskSource inputTaskSource, List<FilterPlugin> filterPlugins, List<Schema> filterSchemas, List<TaskSource> filterTaskSources, OutputPlugin outputPlugin, Schema outputSchema, TaskSource outputTaskSource, ProcessStateCallback callback) {
TransactionalPageOutput tran = PluginWrappers.transactionalPageOutput(outputPlugin.open(outputTaskSource, outputSchema, taskIndex));
callback.started();
// essential exception.
try (CloseResource closer = new CloseResource(tran)) {
try (AbortTransactionResource aborter = new AbortTransactionResource(tran)) {
PageOutput filtered = Filters.open(filterPlugins, filterTaskSources, filterSchemas, tran);
closer.closeThis(filtered);
TaskReport inputTaskReport = inputPlugin.run(inputTaskSource, inputSchema, taskIndex, filtered);
if (inputTaskReport == null) {
inputTaskReport = exec.newTaskReport();
}
callback.inputCommitted(inputTaskReport);
TaskReport outputTaskReport = tran.commit();
aborter.dontAbort();
if (outputTaskReport == null) {
outputTaskReport = exec.newTaskReport();
}
// TODO check output.finish() is called. wrap or abstract
callback.outputCommitted(outputTaskReport);
}
}
}
Aggregations