Search in sources :

Example 1 with ImportElementsToAccumuloTool

use of uk.gov.gchq.gaffer.accumulostore.operation.hdfs.handler.job.tool.ImportElementsToAccumuloTool in project Gaffer by gchq.

the class AddElementsFromHdfsHandler method importElements.

private void importElements(final AddElementsFromHdfs operation, final AccumuloStore store) throws OperationException {
    final ImportElementsToAccumuloTool importTool;
    final int response;
    importTool = new ImportElementsToAccumuloTool(operation.getOutputPath(), operation.getFailurePath(), store);
    try {
        LOGGER.info("Running import job");
        response = ToolRunner.run(importTool, new String[0]);
        LOGGER.info("Finished running import job");
    } catch (final Exception e) {
        LOGGER.error("Failed to import elements into Accumulo: {}", e.getMessage());
        throw new OperationException("Failed to import elements into Accumulo", e);
    }
    if (ImportElementsToAccumuloTool.SUCCESS_RESPONSE != response) {
        LOGGER.error("Failed to import elements into Accumulo. Response code was {}", response);
        throw new OperationException("Failed to import elements into Accumulo. Response code was: " + response);
    }
}
Also used : ImportElementsToAccumuloTool(uk.gov.gchq.gaffer.accumulostore.operation.hdfs.handler.job.tool.ImportElementsToAccumuloTool) OperationException(uk.gov.gchq.gaffer.operation.OperationException) OperationException(uk.gov.gchq.gaffer.operation.OperationException)

Aggregations

ImportElementsToAccumuloTool (uk.gov.gchq.gaffer.accumulostore.operation.hdfs.handler.job.tool.ImportElementsToAccumuloTool)1 OperationException (uk.gov.gchq.gaffer.operation.OperationException)1