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());
}
Aggregations