use of com.baidu.hugegraph.computer.core.output.hg.exceptions.WriteBackException in project hugegraph-computer by hugegraph.
the class TaskManager method submitInSingle.
private void submitInSingle(List<Vertex> batch) {
try {
this.singleSemaphore.acquire();
} catch (InterruptedException e) {
throw new WriteBackException("Interrupted while waiting to submit single", e);
}
InsertTask task = new SingleInsertTask(this.config, this.client, batch, this.loadSummary);
CompletableFuture.runAsync(task, this.singleService).whenComplete((r, e) -> {
this.singleSemaphore.release();
});
}
use of com.baidu.hugegraph.computer.core.output.hg.exceptions.WriteBackException in project hugegraph-computer by hugegraph.
the class TaskManager method submitBatch.
public void submitBatch(List<Vertex> batch) {
try {
this.batchSemaphore.acquire();
} catch (InterruptedException e) {
throw new WriteBackException("Interrupted while waiting to submit batch", e);
}
InsertTask task = new BatchInsertTask(this.config, this.client, batch, this.loadSummary);
CompletableFuture.runAsync(task, this.batchService).exceptionally(e -> {
LOG.warn("Batch insert error, try single insert", e);
this.submitInSingle(batch);
return null;
}).whenComplete((r, e) -> this.batchSemaphore.release());
}
Aggregations