use of org.locationtech.geowave.analytic.mapreduce.operations.options.PropertyManagementConverter in project geowave by locationtech.
the class KmeansParallelCommand method execute.
@Override
public void execute(final OperationParams params) throws Exception {
// Ensure we have all the required arguments
if (parameters.size() != 1) {
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, configFile, 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(kmeansCommonOptions);
converter.readProperties(kmeansParallelOptions);
properties.store(Extract.QUERY, commonOptions.buildQuery());
final MultiLevelKMeansClusteringJobRunner runner = new MultiLevelKMeansClusteringJobRunner();
final int status = runner.run(properties);
if (status != 0) {
throw new RuntimeException("Failed to execute: " + status);
}
}
use of org.locationtech.geowave.analytic.mapreduce.operations.options.PropertyManagementConverter 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;
}
use of org.locationtech.geowave.analytic.mapreduce.operations.options.PropertyManagementConverter in project geowave by locationtech.
the class DBScanCommand method computeResults.
@Override
public Void computeResults(final OperationParams params) throws Exception {
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, configFile, 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(dbScanOptions);
properties.store(Extract.QUERY, commonOptions.buildQuery());
final DBScanIterationsJobRunner runner = new DBScanIterationsJobRunner();
final int status = runner.run(properties);
if (status != 0) {
throw new RuntimeException("Failed to execute: " + status);
}
return null;
}
use of org.locationtech.geowave.analytic.mapreduce.operations.options.PropertyManagementConverter in project geowave by locationtech.
the class KmeansSparkCommand method computeResults.
@Override
public Void computeResults(final OperationParams params) throws Exception {
final String inputStoreName = parameters.get(0);
final String outputStoreName = parameters.get(1);
// Config file
final File configFile = getGeoWaveConfigFile(params);
// Attempt to load input store.
inputDataStore = CLIUtils.loadStore(inputStoreName, configFile, params.getConsole());
// Attempt to load output store.
outputDataStore = CLIUtils.loadStore(outputStoreName, configFile, params.getConsole());
// Save a reference to the store in the property management.
final PersistableStore persistedStore = new PersistableStore(inputDataStore);
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(kMeansSparkOptions);
final KMeansRunner runner = new KMeansRunner();
runner.setAppName(kMeansSparkOptions.getAppName());
runner.setMaster(kMeansSparkOptions.getMaster());
runner.setHost(kMeansSparkOptions.getHost());
runner.setSplits(kMeansSparkOptions.getMinSplits(), kMeansSparkOptions.getMaxSplits());
runner.setInputDataStore(inputDataStore);
runner.setNumClusters(kMeansSparkOptions.getNumClusters());
runner.setNumIterations(kMeansSparkOptions.getNumIterations());
runner.setUseTime(kMeansSparkOptions.isUseTime());
runner.setTypeName(kMeansSparkOptions.getTypeName());
if (kMeansSparkOptions.getEpsilon() != null) {
runner.setEpsilon(kMeansSparkOptions.getEpsilon());
}
if (kMeansSparkOptions.getTypeName() != null) {
runner.setTypeName(kMeansSparkOptions.getTypeName());
}
if (kMeansSparkOptions.getCqlFilter() != null) {
runner.setCqlFilter(kMeansSparkOptions.getCqlFilter());
}
runner.setGenerateHulls(kMeansSparkOptions.isGenerateHulls());
runner.setComputeHullData(kMeansSparkOptions.isComputeHullData());
runner.setHullTypeName(kMeansSparkOptions.getHullTypeName());
runner.setCentroidTypeName(kMeansSparkOptions.getCentroidTypeName());
runner.setOutputDataStore(outputDataStore);
try {
runner.run();
} catch (final IOException e) {
throw new RuntimeException("Failed to execute: " + e.getMessage());
} finally {
runner.close();
}
return null;
}
use of org.locationtech.geowave.analytic.mapreduce.operations.options.PropertyManagementConverter in project geowave by locationtech.
the class KmeansJumpCommand method execute.
@Override
public void execute(final OperationParams params) throws Exception {
// Ensure we have all the required arguments
if (parameters.size() != 1) {
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, configFile, 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(kmeansCommonOptions);
converter.readProperties(kmeansJumpOptions);
properties.store(Extract.QUERY, commonOptions.buildQuery());
final MultiLevelJumpKMeansClusteringJobRunner runner = new MultiLevelJumpKMeansClusteringJobRunner();
final int status = runner.run(properties);
if (status != 0) {
throw new RuntimeException("Failed to execute: " + status);
}
}
Aggregations