use of org.embulk.spi.TaskState in project embulk by embulk.
the class BulkLoader method restoreResumedTaskReports.
private static void restoreResumedTaskReports(ResumeState resume, LoaderState state) {
int inputTaskCount = resume.getInputTaskReports().size();
int outputTaskCount = resume.getOutputTaskReports().size();
state.initialize(inputTaskCount, outputTaskCount);
for (int i = 0; i < inputTaskCount; i++) {
Optional<TaskReport> report = resume.getInputTaskReports().get(i);
if (report.isPresent()) {
TaskState task = state.getInputTaskState(i);
task.start();
task.setTaskReport(report.get());
task.finish();
}
}
for (int i = 0; i < outputTaskCount; i++) {
Optional<TaskReport> report = resume.getOutputTaskReports().get(i);
if (report.isPresent()) {
TaskState task = state.getOutputTaskState(i);
task.start();
task.setTaskReport(report.get());
task.finish();
}
}
}
Aggregations