Skip to content

Commit

Permalink
[CDAP-20815] Fix pipeline description on pipeline upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
vsethi09 committed Nov 20, 2023
1 parent 6bc4382 commit bef34b8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public final class DataStreamsConfig extends ETLConfig {
// See comments in DataStreamsSparkLauncher for explanation on why we need this.
private final boolean isUnitTest;

private DataStreamsConfig(Set<ETLStage> stages,
private DataStreamsConfig(String description,
Set<ETLStage> stages,
Set<Connection> connections,
Resources resources,
Resources driverResources,
Expand All @@ -52,9 +53,8 @@ private DataStreamsConfig(Set<ETLStage> stages,
@Nullable Integer numOfRecordsPreview,
@Nullable Boolean stopGracefully,
Map<String, String> properties) {
super(stages, connections, resources, driverResources, clientResources, stageLoggingEnabled,
processTimingEnabled,
numOfRecordsPreview, properties);
super(description, stages, connections, resources, driverResources, clientResources,
stageLoggingEnabled, processTimingEnabled, numOfRecordsPreview, properties);
this.batchInterval = batchInterval;
this.isUnitTest = isUnitTest;
this.extraJavaOpts = "";
Expand Down Expand Up @@ -144,10 +144,9 @@ public DataStreamsConfig updateConfig(ApplicationUpdateContext applicationUpdate
updatedStages.add(stage.updateStage(applicationUpdateContext));
}

return new DataStreamsConfig(updatedStages, connections, resources, driverResources,
clientResources,
stageLoggingEnabled, processTimingEnabled, batchInterval, isUnitTest,
disableCheckpoints, checkpointDir, numOfRecordsPreview, stopGracefully,
return new DataStreamsConfig(description, updatedStages, connections, resources,
driverResources, clientResources, stageLoggingEnabled, processTimingEnabled, batchInterval,
isUnitTest, disableCheckpoints, checkpointDir, numOfRecordsPreview, stopGracefully,
properties);
}

Expand Down Expand Up @@ -190,10 +189,9 @@ public Builder disableCheckpoints() {
}

public DataStreamsConfig build() {

Check warning on line 191 in cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/DataStreamsConfig.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck

Missing a Javadoc comment.
return new DataStreamsConfig(stages, connections, resources, driverResources, clientResources,
stageLoggingEnabled, processTimingEnabled, batchInterval, isUnitTest,
disableCheckpoints, checkpointDir, numOfRecordsPreview, stopGraceFully,
properties);
return new DataStreamsConfig(description, stages, connections, resources, driverResources,
clientResources, stageLoggingEnabled, processTimingEnabled, batchInterval, isUnitTest,
disableCheckpoints, checkpointDir, numOfRecordsPreview, stopGraceFully, properties);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public final class ETLBatchConfig extends ETLConfig {
private final Boolean pushdownEnabled;
private final ETLTransformationPushdown transformationPushdown;

private ETLBatchConfig(Set<ETLStage> stages,
private ETLBatchConfig(String description,
Set<ETLStage> stages,
Set<Connection> connections,
List<ETLStage> postActions,
Resources resources,
Expand All @@ -69,9 +70,8 @@ private ETLBatchConfig(Set<ETLStage> stages,
List<Object> comments,
@Nullable Boolean pushdownEnabled,
@Nullable ETLTransformationPushdown transformationPushdown) {
super(stages, connections, resources, driverResources, clientResources, stageLoggingEnabled,
processTimingEnabled,
numOfRecordsPreview, engineProperties, comments);
super(description,stages, connections, resources, driverResources, clientResources,

Check warning on line 73 in cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLBatchConfig.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck

',' is not followed by whitespace.
stageLoggingEnabled, processTimingEnabled, numOfRecordsPreview, engineProperties, comments);
this.postActions = ImmutableList.copyOf(postActions);
this.engine = engine;
this.schedule = schedule;
Expand Down Expand Up @@ -163,11 +163,10 @@ public ETLBatchConfig updateBatchConfig(ApplicationUpdateContext upgradeContext)
for (ETLStage postAction : getPostActions()) {
upgradedPostActions.add(postAction.updateStage(upgradeContext));
}
return new ETLBatchConfig(upgradedStages, connections, upgradedPostActions, resources,
stageLoggingEnabled,
processTimingEnabled, engine, schedule, driverResources, clientResources,
numOfRecordsPreview, maxConcurrentRuns, properties, service, connectionConfig, comments,
pushdownEnabled, transformationPushdown);
return new ETLBatchConfig(description, upgradedStages, connections, upgradedPostActions,
resources, stageLoggingEnabled, processTimingEnabled, engine, schedule, driverResources,
clientResources, numOfRecordsPreview, maxConcurrentRuns, properties, service,
connectionConfig, comments, pushdownEnabled, transformationPushdown);
}

@Override
Expand Down Expand Up @@ -259,6 +258,7 @@ public Builder(String schedule) {

public Builder(ETLBatchConfig config) {

Check warning on line 259 in cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLBatchConfig.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck

Missing a Javadoc comment.
super();
this.description = config.getDescription();
this.stages = config.getStages();
this.connections = config.getConnections();
this.endingActions = config.getPostActions();
Expand Down Expand Up @@ -318,10 +318,10 @@ public Builder setTransformationPushdown(ETLTransformationPushdown transformatio
}

public ETLBatchConfig build() {

Check warning on line 320 in cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLBatchConfig.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck

Missing a Javadoc comment.
return new ETLBatchConfig(stages, connections, endingActions, resources, stageLoggingEnabled,
processTimingEnabled, engine, schedule, driverResources, clientResources,
numOfRecordsPreview, maxConcurrentRuns, properties, false, null, comments,
pushdownEnabled, transformationPushdown);
return new ETLBatchConfig(description, stages, connections, endingActions, resources,
stageLoggingEnabled, processTimingEnabled, engine, schedule, driverResources,
clientResources, numOfRecordsPreview, maxConcurrentRuns, properties, false, null,
comments, pushdownEnabled, transformationPushdown);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public class ETLConfig extends Config implements UpgradeableConfig {
// For serialization purpose for upgrade compatibility.
protected List<Object> comments;

protected ETLConfig(Set<ETLStage> stages, Set<Connection> connections, Resources resources,
Resources driverResources, Resources clientResources,
protected ETLConfig(String description, Set<ETLStage> stages, Set<Connection> connections,
Resources resources, Resources driverResources, Resources clientResources,
@Nullable Boolean stageLoggingEnabled, @Nullable Boolean processTimingEnabled,
@Nullable Integer numOfRecordsPreview, Map<String, String> properties) {
this.description = null;
this.description = description;
this.stages = Collections.unmodifiableSet(stages);
this.connections = Collections.unmodifiableSet(connections);
this.resources = resources;
Expand All @@ -80,14 +80,13 @@ protected ETLConfig(Set<ETLStage> stages, Set<Connection> connections, Resources
this.comments = new ArrayList<>();
}

protected ETLConfig(Set<ETLStage> stages, Set<Connection> connections,
protected ETLConfig(String descrition, Set<ETLStage> stages, Set<Connection> connections,
Resources resources, Resources driverResources, Resources clientResources,
@Nullable Boolean stageLoggingEnabled, @Nullable Boolean processTimingEnabled,
@Nullable Integer numOfRecordsPreview, Map<String, String> properties,
List<Object> comments) {
this(stages, connections, resources, driverResources, clientResources, stageLoggingEnabled,
processTimingEnabled,
numOfRecordsPreview, properties);
this(descrition, stages, connections, resources, driverResources, clientResources,
stageLoggingEnabled, processTimingEnabled, numOfRecordsPreview, properties);
this.comments = comments;
this.sinks = null;
this.transforms = null;
Expand Down Expand Up @@ -257,6 +256,7 @@ public String toString() {
@SuppressWarnings("unchecked")
public abstract static class Builder<T extends Builder> {

protected String description;
protected List<Object> comments;
public static final Resources DEFAULT_TEST_RESOURCES = new Resources(2048, 1);
protected Set<ETLStage> stages;
Expand Down Expand Up @@ -350,5 +350,10 @@ public T setComments(List<Object> comments) {
this.comments = comments;
return (T) this;
}

public T setDescription(String description) {
this.description = description;
return (T) this;
}
}
}

0 comments on commit bef34b8

Please sign in to comment.