Search in sources :

Example 1 with PropertyManagementConverter

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);
    }
}
Also used : MultiLevelKMeansClusteringJobRunner(org.locationtech.geowave.analytic.mapreduce.clustering.runner.MultiLevelKMeansClusteringJobRunner) PropertyManagementConverter(org.locationtech.geowave.analytic.mapreduce.operations.options.PropertyManagementConverter) PersistableStore(org.locationtech.geowave.analytic.store.PersistableStore) ParameterException(com.beust.jcommander.ParameterException) PropertyManagement(org.locationtech.geowave.analytic.PropertyManagement) Properties(java.util.Properties) File(java.io.File)

Example 2 with PropertyManagementConverter

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;
}
Also used : PropertyManagementConverter(org.locationtech.geowave.analytic.mapreduce.operations.options.PropertyManagementConverter) GeoWaveExtractNNJobRunner(org.locationtech.geowave.analytic.mapreduce.nn.GeoWaveExtractNNJobRunner) PersistableStore(org.locationtech.geowave.analytic.store.PersistableStore) ParameterException(com.beust.jcommander.ParameterException) PropertyManagement(org.locationtech.geowave.analytic.PropertyManagement) Properties(java.util.Properties) File(java.io.File)

Example 3 with PropertyManagementConverter

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;
}
Also used : DBScanIterationsJobRunner(org.locationtech.geowave.analytic.mapreduce.dbscan.DBScanIterationsJobRunner) PropertyManagementConverter(org.locationtech.geowave.analytic.mapreduce.operations.options.PropertyManagementConverter) PersistableStore(org.locationtech.geowave.analytic.store.PersistableStore) PropertyManagement(org.locationtech.geowave.analytic.PropertyManagement) Properties(java.util.Properties) File(java.io.File)

Example 4 with PropertyManagementConverter

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;
}
Also used : PropertyManagementConverter(org.locationtech.geowave.analytic.mapreduce.operations.options.PropertyManagementConverter) PersistableStore(org.locationtech.geowave.analytic.store.PersistableStore) PropertyManagement(org.locationtech.geowave.analytic.PropertyManagement) IOException(java.io.IOException) File(java.io.File) KMeansRunner(org.locationtech.geowave.analytic.spark.kmeans.KMeansRunner)

Example 5 with PropertyManagementConverter

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);
    }
}
Also used : MultiLevelJumpKMeansClusteringJobRunner(org.locationtech.geowave.analytic.mapreduce.clustering.runner.MultiLevelJumpKMeansClusteringJobRunner) PropertyManagementConverter(org.locationtech.geowave.analytic.mapreduce.operations.options.PropertyManagementConverter) PersistableStore(org.locationtech.geowave.analytic.store.PersistableStore) ParameterException(com.beust.jcommander.ParameterException) PropertyManagement(org.locationtech.geowave.analytic.PropertyManagement) Properties(java.util.Properties) File(java.io.File)

Aggregations

File (java.io.File)6 PropertyManagement (org.locationtech.geowave.analytic.PropertyManagement)6 PropertyManagementConverter (org.locationtech.geowave.analytic.mapreduce.operations.options.PropertyManagementConverter)6 PersistableStore (org.locationtech.geowave.analytic.store.PersistableStore)6 ParameterException (com.beust.jcommander.ParameterException)4 Properties (java.util.Properties)4 IOException (java.io.IOException)1 MultiLevelJumpKMeansClusteringJobRunner (org.locationtech.geowave.analytic.mapreduce.clustering.runner.MultiLevelJumpKMeansClusteringJobRunner)1 MultiLevelKMeansClusteringJobRunner (org.locationtech.geowave.analytic.mapreduce.clustering.runner.MultiLevelKMeansClusteringJobRunner)1 DBScanIterationsJobRunner (org.locationtech.geowave.analytic.mapreduce.dbscan.DBScanIterationsJobRunner)1 GeoWaveExtractNNJobRunner (org.locationtech.geowave.analytic.mapreduce.nn.GeoWaveExtractNNJobRunner)1 KMeansRunner (org.locationtech.geowave.analytic.spark.kmeans.KMeansRunner)1 GeomFunction (org.locationtech.geowave.analytic.spark.sparksql.udf.GeomFunction)1 GeomWithinDistance (org.locationtech.geowave.analytic.spark.sparksql.udf.GeomWithinDistance)1 UDFNameAndConstructor (org.locationtech.geowave.analytic.spark.sparksql.udf.UDFRegistrySPI.UDFNameAndConstructor)1 SpatialJoinRunner (org.locationtech.geowave.analytic.spark.spatial.SpatialJoinRunner)1