Search in sources :

Example 1 with ConfigAWSCommand

use of org.locationtech.geowave.core.ingest.operations.ConfigAWSCommand in project geowave by locationtech.

the class TestUtils method testS3LocalIngest.

public static void testS3LocalIngest(final DataStorePluginOptions dataStore, final DimensionalityType dimensionalityType, final String s3Url, final String ingestFilePath, final String format, final int nthreads) throws Exception {
    // ingest a shapefile (geotools type) directly into GeoWave using the
    // ingest framework's main method and pre-defined commandline arguments
    // Ingest Formats
    final IngestFormatPluginOptions ingestFormatOptions = new IngestFormatPluginOptions();
    ingestFormatOptions.selectPlugin(format);
    // Indexes
    final String[] indexTypes = dimensionalityType.getDimensionalityArg().split(",");
    final List<IndexPluginOptions> indexOptions = new ArrayList<>(indexTypes.length);
    for (final String indexType : indexTypes) {
        final IndexPluginOptions indexOption = new IndexPluginOptions();
        indexOption.selectPlugin(indexType);
        indexOptions.add(indexOption);
    }
    final File configFile = File.createTempFile("test_s3_local_ingest", null);
    final ManualOperationParams operationParams = new ManualOperationParams();
    operationParams.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile);
    final AddStoreCommand addStore = new AddStoreCommand();
    addStore.setParameters("test-store");
    addStore.setPluginOptions(dataStore);
    addStore.execute(operationParams);
    final IndexStore indexStore = dataStore.createIndexStore();
    final org.locationtech.geowave.core.store.api.DataStore geowaveDataStore = dataStore.createDataStore();
    final StringBuilder indexParam = new StringBuilder();
    for (int i = 0; i < indexOptions.size(); i++) {
        final String indexName = "test-index" + i;
        if (indexStore.getIndex(indexName) == null) {
            indexOptions.get(i).setName(indexName);
            geowaveDataStore.addIndex(indexOptions.get(i).createIndex(geowaveDataStore));
        }
        indexParam.append(indexName + ",");
    }
    final ConfigAWSCommand configS3 = new ConfigAWSCommand();
    configS3.setS3UrlParameter(s3Url);
    configS3.execute(operationParams);
    // Create the command and execute.
    final LocalToGeoWaveCommand localIngester = new LocalToGeoWaveCommand();
    localIngester.setPluginFormats(ingestFormatOptions);
    localIngester.setParameters(ingestFilePath, "test-store", indexParam.toString());
    localIngester.setThreads(nthreads);
    localIngester.execute(operationParams);
    verifyStats(dataStore);
}
Also used : IngestFormatPluginOptions(org.locationtech.geowave.core.ingest.operations.options.IngestFormatPluginOptions) ArrayList(java.util.ArrayList) ConfigAWSCommand(org.locationtech.geowave.core.ingest.operations.ConfigAWSCommand) AddStoreCommand(org.locationtech.geowave.core.store.cli.store.AddStoreCommand) Point(org.locationtech.jts.geom.Point) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams) LocalToGeoWaveCommand(org.locationtech.geowave.core.ingest.operations.LocalToGeoWaveCommand) IndexPluginOptions(org.locationtech.geowave.core.store.index.IndexPluginOptions) File(java.io.File) IndexStore(org.locationtech.geowave.core.store.index.IndexStore)

Example 2 with ConfigAWSCommand

use of org.locationtech.geowave.core.ingest.operations.ConfigAWSCommand in project geowave by locationtech.

the class TestUtils method testSparkIngest.

public static void testSparkIngest(final DataStorePluginOptions dataStore, final DimensionalityType dimensionalityType, final String s3Url, final String ingestFilePath, final String format) throws Exception {
    // ingest a shapefile (geotools type) directly into GeoWave using the
    // ingest framework's main method and pre-defined commandline arguments
    // Indexes
    final String indexes = dimensionalityType.getDimensionalityArg();
    final File configFile = File.createTempFile("test_spark_ingest", null);
    final ManualOperationParams operationParams = new ManualOperationParams();
    operationParams.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile);
    final ConfigAWSCommand configS3 = new ConfigAWSCommand();
    configS3.setS3UrlParameter(s3Url);
    configS3.execute(operationParams);
    final LocalInputCommandLineOptions localOptions = new LocalInputCommandLineOptions();
    localOptions.setFormats(format);
    final SparkCommandLineOptions sparkOptions = new SparkCommandLineOptions();
    sparkOptions.setAppName("SparkIngestTest");
    sparkOptions.setMaster("local");
    sparkOptions.setHost("localhost");
    // Create the command and execute.
    final SparkIngestDriver sparkIngester = new SparkIngestDriver();
    final Properties props = new Properties();
    dataStore.save(props, DataStorePluginOptions.getStoreNamespace("test"));
    final AddStoreCommand addStore = new AddStoreCommand();
    addStore.setParameters("test");
    addStore.setPluginOptions(dataStore);
    addStore.execute(operationParams);
    final IndexStore indexStore = dataStore.createIndexStore();
    final org.locationtech.geowave.core.store.api.DataStore geowaveDataStore = dataStore.createDataStore();
    final String[] indexTypes = dimensionalityType.getDimensionalityArg().split(",");
    for (final String indexType : indexTypes) {
        if (indexStore.getIndex(indexType) == null) {
            final IndexPluginOptions pluginOptions = new IndexPluginOptions();
            pluginOptions.selectPlugin(indexType);
            pluginOptions.setName(indexType);
            pluginOptions.save(props, IndexPluginOptions.getIndexNamespace(indexType));
            geowaveDataStore.addIndex(pluginOptions.createIndex(geowaveDataStore));
        }
    }
    props.setProperty(ConfigAWSCommand.AWS_S3_ENDPOINT_URL, s3Url);
    sparkIngester.runOperation(configFile, localOptions, "test", indexes, new VisibilityOptions(), sparkOptions, ingestFilePath, new JCommander().getConsole());
    verifyStats(dataStore);
}
Also used : ConfigAWSCommand(org.locationtech.geowave.core.ingest.operations.ConfigAWSCommand) SparkIngestDriver(org.locationtech.geowave.core.ingest.spark.SparkIngestDriver) Properties(java.util.Properties) AddStoreCommand(org.locationtech.geowave.core.store.cli.store.AddStoreCommand) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams) VisibilityOptions(org.locationtech.geowave.core.store.cli.VisibilityOptions) SparkCommandLineOptions(org.locationtech.geowave.core.ingest.spark.SparkCommandLineOptions) JCommander(com.beust.jcommander.JCommander) IndexPluginOptions(org.locationtech.geowave.core.store.index.IndexPluginOptions) File(java.io.File) LocalInputCommandLineOptions(org.locationtech.geowave.core.store.ingest.LocalInputCommandLineOptions) IndexStore(org.locationtech.geowave.core.store.index.IndexStore)

Example 3 with ConfigAWSCommand

use of org.locationtech.geowave.core.ingest.operations.ConfigAWSCommand in project geowave by locationtech.

the class GeoWaveGrpcIT method init.

protected void init() throws Exception {
    Configurator.setRootLevel(Level.WARN);
    ZipUtils.unZipFile(new File(BasicKafkaIT.class.getClassLoader().getResource(TEST_DATA_ZIP_RESOURCE_PATH).toURI()), TestUtils.TEST_CASE_BASE);
    // set up the config file for the services
    configFile = File.createTempFile("test_config", null);
    GeoWaveGrpcServiceOptions.geowaveConfigFile = configFile;
    operationParams = new ManualOperationParams();
    operationParams.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile);
    // add a store and index manually before we try to ingest
    // this accurately simulates how the services will perform the ingest
    // from config file parameters (as opposed to programatic
    // creation/loading)
    final AddStoreCommand command = new AddStoreCommand();
    command.setParameters(GeoWaveGrpcTestUtils.storeName);
    command.setPluginOptions(dataStore);
    command.execute(operationParams);
    // finally add an output store for things like KDE etc
    final AddStoreCommand commandOut = new AddStoreCommand();
    commandOut.setParameters(GeoWaveGrpcTestUtils.outputStoreName);
    commandOut.setPluginOptions(dataStore);
    commandOut.execute(operationParams);
    // set up s3
    final ConfigAWSCommand configS3 = new ConfigAWSCommand();
    configS3.setS3UrlParameter("s3.amazonaws.com");
    configS3.execute(operationParams);
    // mimic starting the server from command line
    final StartGrpcServerCommand startCmd = new StartGrpcServerCommand();
    final StartGrpcServerCommandOptions grpcCmdOpts = new StartGrpcServerCommandOptions();
    grpcCmdOpts.setPort(GeoWaveGrpcServiceOptions.port);
    grpcCmdOpts.setNonBlocking(true);
    startCmd.setCommandOptions(grpcCmdOpts);
    startCmd.execute(operationParams);
    // fire up the client
    client = new GeoWaveGrpcTestClient(GeoWaveGrpcServiceOptions.host, GeoWaveGrpcServiceOptions.port);
    LOGGER.warn("-----------------------------------------");
    LOGGER.warn("*                                       *");
    LOGGER.warn("* FINISHED Init  *");
    LOGGER.warn("*         " + ((System.currentTimeMillis() - startMillis) / 1000) + "s elapsed.                 *");
    LOGGER.warn("*                                       *");
    LOGGER.warn("-----------------------------------------");
}
Also used : StartGrpcServerCommandOptions(org.locationtech.geowave.service.grpc.cli.StartGrpcServerCommandOptions) ConfigAWSCommand(org.locationtech.geowave.core.ingest.operations.ConfigAWSCommand) StartGrpcServerCommand(org.locationtech.geowave.service.grpc.cli.StartGrpcServerCommand) AddStoreCommand(org.locationtech.geowave.core.store.cli.store.AddStoreCommand) File(java.io.File) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams)

Aggregations

File (java.io.File)3 ManualOperationParams (org.locationtech.geowave.core.cli.parser.ManualOperationParams)3 ConfigAWSCommand (org.locationtech.geowave.core.ingest.operations.ConfigAWSCommand)3 AddStoreCommand (org.locationtech.geowave.core.store.cli.store.AddStoreCommand)3 IndexPluginOptions (org.locationtech.geowave.core.store.index.IndexPluginOptions)2 IndexStore (org.locationtech.geowave.core.store.index.IndexStore)2 JCommander (com.beust.jcommander.JCommander)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 LocalToGeoWaveCommand (org.locationtech.geowave.core.ingest.operations.LocalToGeoWaveCommand)1 IngestFormatPluginOptions (org.locationtech.geowave.core.ingest.operations.options.IngestFormatPluginOptions)1 SparkCommandLineOptions (org.locationtech.geowave.core.ingest.spark.SparkCommandLineOptions)1 SparkIngestDriver (org.locationtech.geowave.core.ingest.spark.SparkIngestDriver)1 VisibilityOptions (org.locationtech.geowave.core.store.cli.VisibilityOptions)1 LocalInputCommandLineOptions (org.locationtech.geowave.core.store.ingest.LocalInputCommandLineOptions)1 StartGrpcServerCommand (org.locationtech.geowave.service.grpc.cli.StartGrpcServerCommand)1 StartGrpcServerCommandOptions (org.locationtech.geowave.service.grpc.cli.StartGrpcServerCommandOptions)1 Point (org.locationtech.jts.geom.Point)1