use of co.cask.cdap.etl.batch.connector.MultiConnectorSource in project cdap by caskdata.
the class SmartWorkflow method getPhaseSpec.
private BatchPhaseSpec getPhaseSpec(String programName, PipelinePhase phase) {
// if this phase uses connectors, add the local dataset for that connector if we haven't already
for (StageSpec connectorInfo : phase.getStagesOfType(Constants.Connector.PLUGIN_TYPE)) {
String connectorName = connectorInfo.getName();
String datasetName = connectorDatasets.get(connectorName);
if (datasetName == null) {
datasetName = "conn-" + connectorNum++;
connectorDatasets.put(connectorName, datasetName);
// add the local dataset
ConnectorSource connectorSource = new MultiConnectorSource(datasetName, null);
connectorSource.configure(getConfigurer());
}
}
// published.
for (StageSpec alertPublisherInfo : phase.getStagesOfType(AlertPublisher.PLUGIN_TYPE)) {
String stageName = alertPublisherInfo.getName();
AlertPublisherSink alertPublisherSink = new AlertPublisherSink(stageName, null);
alertPublisherSink.configure(getConfigurer());
}
Map<String, String> phaseConnectorDatasets = new HashMap<>();
for (StageSpec connectorStage : phase.getStagesOfType(Constants.Connector.PLUGIN_TYPE)) {
phaseConnectorDatasets.put(connectorStage.getName(), connectorDatasets.get(connectorStage.getName()));
}
return new BatchPhaseSpec(programName, phase, spec.getResources(), spec.getDriverResources(), spec.getClientResources(), spec.isStageLoggingEnabled(), spec.isProcessTimingEnabled(), phaseConnectorDatasets, spec.getNumOfRecordsPreview(), spec.getProperties(), !plan.getConditionPhaseBranches().isEmpty());
}
Aggregations