use of org.locationtech.geowave.analytic.spark.kmeans.operations.KmeansSparkCommand in project geowave by locationtech.
the class GeoWaveGrpcAnalyticSparkService method kmeansSparkCommand.
@Override
public void kmeansSparkCommand(final KmeansSparkCommandParametersProtos request, final StreamObserver<VoidResponseProtos> responseObserver) {
final KmeansSparkCommand cmd = new KmeansSparkCommand();
final Map<FieldDescriptor, Object> m = request.getAllFields();
GeoWaveGrpcServiceCommandUtil.setGrpcToCommandFields(m, cmd);
final File configFile = GeoWaveGrpcServiceOptions.geowaveConfigFile;
final OperationParams params = new ManualOperationParams();
params.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile);
cmd.prepare(params);
LOGGER.info("Executing KmeansSparkCommand...");
try {
cmd.computeResults(params);
final VoidResponseProtos resp = VoidResponseProtos.newBuilder().build();
responseObserver.onNext(resp);
responseObserver.onCompleted();
} catch (final Exception e) {
LOGGER.error("Exception encountered executing command", e);
responseObserver.onError(e);
}
}
Aggregations