Search in sources :

Example 11 with ETLPlugin

use of co.cask.cdap.etl.proto.v2.ETLPlugin in project cdap by caskdata.

the class PipelineSpecGenerator method configureStage.

/**
   * Configures a stage and returns the spec for it.
   *
   * @param stageConnections the user provided configuration for the stage along with its connections
   * @param pluginConfigurer configurer used to configure the stage
   * @return the spec for the stage
   */
private ConfiguredStage configureStage(StageConnections stageConnections, DefaultPipelineConfigurer pluginConfigurer) {
    ETLStage stage = stageConnections.getStage();
    String stageName = stage.getName();
    ETLPlugin stagePlugin = stage.getPlugin();
    if (!Strings.isNullOrEmpty(stage.getErrorDatasetName())) {
        configurer.createDataset(stage.getErrorDatasetName(), errorDatasetClass, errorDatasetProperties);
    }
    PluginSpec pluginSpec = configurePlugin(stageName, stagePlugin, pluginConfigurer);
    Schema outputSchema = pluginConfigurer.getStageConfigurer().getOutputSchema();
    Map<String, Schema> inputSchemas = pluginConfigurer.getStageConfigurer().getInputSchemas();
    StageSpec stageSpec = StageSpec.builder(stageName, pluginSpec).setErrorDatasetName(stage.getErrorDatasetName()).addInputSchemas(inputSchemas).setOutputSchema(outputSchema).setErrorSchema(pluginConfigurer.getStageConfigurer().getErrorSchema()).addInputs(stageConnections.getInputs()).addOutputs(stageConnections.getOutputs()).build();
    return new ConfiguredStage(stageSpec, pluginConfigurer.getPipelineProperties());
}
Also used : ETLStage(co.cask.cdap.etl.proto.v2.ETLStage) Schema(co.cask.cdap.api.data.schema.Schema) ETLPlugin(co.cask.cdap.etl.proto.v2.ETLPlugin)

Aggregations

ETLPlugin (co.cask.cdap.etl.proto.v2.ETLPlugin)11 ETLStage (co.cask.cdap.etl.proto.v2.ETLStage)11 ETLBatchConfig (co.cask.cdap.etl.proto.v2.ETLBatchConfig)8 ApplicationId (co.cask.cdap.proto.id.ApplicationId)8 ApplicationManager (co.cask.cdap.test.ApplicationManager)8 WorkflowManager (co.cask.cdap.test.WorkflowManager)8 StructuredRecord (co.cask.cdap.api.data.format.StructuredRecord)7 KeyValueTable (co.cask.cdap.api.dataset.lib.KeyValueTable)7 Table (co.cask.cdap.api.dataset.table.Table)7 ArrayList (java.util.ArrayList)7 Test (org.junit.Test)7 HashMap (java.util.HashMap)6 Schema (co.cask.cdap.api.data.schema.Schema)5 AppRequest (co.cask.cdap.proto.artifact.AppRequest)3 HashSet (java.util.HashSet)3 ArtifactId (co.cask.cdap.api.artifact.ArtifactId)2 FileSet (co.cask.cdap.api.dataset.lib.FileSet)2 SpamMessage (co.cask.cdap.datapipeline.mock.SpamMessage)2 BatchPipelineSpecGenerator (co.cask.cdap.etl.batch.BatchPipelineSpecGenerator)2 MockPluginConfigurer (co.cask.cdap.etl.common.MockPluginConfigurer)2