use of org.locationtech.geowave.analytic.mapreduce.nn.GeoWaveExtractNNJobRunner in project geowave by locationtech.
the class NearestNeighborCommand method computeResults.
@Override
public Void computeResults(final OperationParams params) throws Exception {
// Ensure we have all the required arguments
if ((parameters.size() != 1) && (inputStoreOptions == null)) {
throw new ParameterException("Requires arguments: <storename>");
}
final String inputStoreName = parameters.get(0);
// Config file
final File configFile = getGeoWaveConfigFile(params);
if (commonOptions.getMapReduceHdfsHostPort() == null) {
final Properties configProperties = ConfigOptions.loadProperties(configFile);
final String hdfsFSUrl = ConfigHDFSCommand.getHdfsUrl(configProperties);
commonOptions.setMapReduceHdfsHostPort(hdfsFSUrl);
}
// Attempt to load store.
inputStoreOptions = CLIUtils.loadStore(inputStoreName, getGeoWaveConfigFile(params), params.getConsole());
// Save a reference to the store in the property management.
final PersistableStore persistedStore = new PersistableStore(inputStoreOptions);
final PropertyManagement properties = new PropertyManagement();
properties.store(StoreParameters.StoreParam.INPUT_STORE, persistedStore);
// Convert properties from DBScanOptions and CommonOptions
final PropertyManagementConverter converter = new PropertyManagementConverter(properties);
converter.readProperties(commonOptions);
converter.readProperties(nnOptions);
properties.store(Extract.QUERY, commonOptions.buildQuery());
final GeoWaveExtractNNJobRunner runner = new GeoWaveExtractNNJobRunner();
final int status = runner.run(properties);
if (status != 0) {
throw new RuntimeException("Failed to execute: " + status);
}
return null;
}
Aggregations