use of com.amazonaws.services.neptune.propertygraph.ExportStats in project amazon-neptune-tools by awslabs.
the class ExportToS3NeptuneExportEventHandler method onExportComplete.
@Override
public void onExportComplete(Directories directories, ExportStats stats, Cluster cluster, GraphSchema graphSchema) throws Exception {
try {
long size = Files.walk(directories.rootDirectory()).mapToLong(p -> p.toFile().length()).sum();
logger.info("Total size of exported files: {}", FileUtils.byteCountToDisplaySize(size));
} catch (Exception e) {
// Ignore
}
if (StringUtils.isEmpty(outputS3Path)) {
return;
}
logger.info("S3 upload params: {}", s3UploadParams);
try (TransferManagerWrapper transferManager = new TransferManagerWrapper(s3Region)) {
File outputDirectory = directories.rootDirectory().toFile();
S3ObjectInfo outputS3ObjectInfo = calculateOutputS3Path(outputDirectory);
Timer.timedActivity("uploading files to S3", (CheckedActivity.Runnable) () -> {
deleteS3Directories(directories, outputS3ObjectInfo);
uploadExportFilesToS3(transferManager.get(), outputDirectory, outputS3ObjectInfo);
uploadCompletionFileToS3(transferManager.get(), outputDirectory, outputS3ObjectInfo, stats, graphSchema);
});
result.set(outputS3ObjectInfo);
}
}
Aggregations