Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated IncrementInstanceEnabled property #6001

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,12 @@ public class ComposedRunnerJobFactory implements FactoryBean<Job> {

private String dsl;

private boolean incrementInstanceEnabled;

private int nestedSplits;

public ComposedRunnerJobFactory(ComposedTaskProperties properties) {
this.composedTaskProperties = properties;
Assert.notNull(properties.getGraph(), "The DSL must not be null");
this.dsl = properties.getGraph();
this.incrementInstanceEnabled = properties.isIncrementInstanceEnabled();
this.flowBuilder = new FlowBuilder<>(UUID.randomUUID().toString());
}

Expand All @@ -112,12 +109,7 @@ public Job getObject() throws Exception {
.start(createFlow())
.end())
.end();
if(this.incrementInstanceEnabled && !this.composedTaskProperties.isUuidInstanceEnabled()) {
builder.incrementer(new RunIdIncrementer());
}
else if(this.composedTaskProperties.isUuidInstanceEnabled()) {
builder.incrementer(new UuidIncrementer());
}
builder.incrementer(new UuidIncrementer());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be guarded by this.composedTaskProperties.isUuidInstanceEnabled() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely. And the default of the isUuidInstanceEnabled needs to be set to true.
GREAT CATCH!

return builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,10 @@ public class ComposedTaskProperties {
*/
private boolean splitThreadWaitForTasksToCompleteOnShutdown;

/**
* Allows a single ComposedTaskRunner instance to be re-executed without
* changing the parameters. It does this by applying a {@code run.id} with a sequential
* number based on the {@code run.id} from the previous execution. Default is true.
*/
@Deprecated
private boolean incrementInstanceEnabled = true;
onobc marked this conversation as resolved.
Show resolved Hide resolved

/**
* Allows a single ComposedTaskRunner instance to be re-executed without
* changing the parameters. It does this by applying a {@code run.id} with a UUid.
* Default is false. If set to true then this will override incrementInstanceEnabled.
* Default is false.
* Set this option to `true` when running multiple instances of the same composed task definition at the same time.
*/
private boolean uuidInstanceEnabled = false;
Expand Down Expand Up @@ -365,14 +357,6 @@ public void setSplitThreadWaitForTasksToCompleteOnShutdown(boolean splitThreadWa
this.splitThreadWaitForTasksToCompleteOnShutdown = splitThreadWaitForTasksToCompleteOnShutdown;
}

public boolean isIncrementInstanceEnabled() {
return incrementInstanceEnabled;
}

public void setIncrementInstanceEnabled(boolean incrementInstanceEnabled) {
this.incrementInstanceEnabled = incrementInstanceEnabled;
}

public String getDataflowServerAccessToken() {
return dataflowServerAccessToken;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void singleTest() {
@Test
void singleTestForuuIDIncrementer() {
setupContextForGraph("AAA", "--uuIdInstanceEnabled=true");
Collection<StepExecution> stepExecutions = getStepExecutions(true);
Collection<StepExecution> stepExecutions = getStepExecutions();
assertThat(stepExecutions).hasSize(1);
StepExecution stepExecution = stepExecutions.iterator().next();
assertThat(stepExecution.getStepName()).isEqualTo("AAA_0");
Expand Down Expand Up @@ -397,23 +397,16 @@ private void setupContextForGraph(String[] args) throws RuntimeException{
SimpleTaskAutoConfiguration.class}, args);
}

private Collection<StepExecution> getStepExecutions() {
return getStepExecutions(false);
}

private Collection<StepExecution> getStepExecutions(boolean isCTR) {
private Collection<StepExecution> getStepExecutions() {
JobExplorer jobExplorer = this.applicationContext.getBean(JobExplorer.class);
List<JobInstance> jobInstances = jobExplorer.findJobInstancesByJobName("job", 0, 1);
assertThat(jobInstances).hasSize(1);
JobInstance jobInstance = jobInstances.get(0);
List<JobExecution> jobExecutions = jobExplorer.getJobExecutions(jobInstance);
assertThat(jobExecutions).hasSize(1);
JobExecution jobExecution = jobExecutions.get(0);
if(isCTR) {
assertThat(jobExecution.getJobParameters().getParameters().get("ctr.id")).isNotNull();
} else {
assertThat(jobExecution.getJobParameters().getParameters()).containsEntry("run.id", new JobParameter(1L, Long.class));
onobc marked this conversation as resolved.
Show resolved Hide resolved
}
assertThat(jobExecution.getJobParameters().getParameters().get("ctr.id")).isNotNull();
return jobExecution.getStepExecutions();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,8 @@ void gettersAndSetters() throws URISyntaxException{
assertThat(properties.getDataflowServerPassword()).isEqualTo("bar");
assertThat(properties.getDataflowServerAccessToken()).isEqualTo("foobar");
assertThat(properties.isSkipTlsCertificateVerification()).isTrue();
assertThat(properties.isIncrementInstanceEnabled()).isTrue();
assertThat(properties.isUuidInstanceEnabled()).isFalse();
properties.setUuidInstanceEnabled(true);
properties.setIncrementInstanceEnabled(false);
assertThat(properties.isIncrementInstanceEnabled()).isFalse();
assertThat(properties.isUuidInstanceEnabled()).isTrue();
}

Expand Down
Loading