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

Dataflow needs to be compilable using boot 3.x #5657

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
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<module>spring-cloud-starter-dataflow-server</module>
<module>spring-cloud-starter-dataflow-ui</module>
<module>spring-cloud-dataflow-server</module>
<!-- TODO: Boot3x followup -->
<!-- <module>spring-cloud-dataflow-tasklauncher</module>-->
onobc marked this conversation as resolved.
Show resolved Hide resolved
<!-- <module>spring-cloud-dataflow-single-step-batch-job</module>-->
<!-- <module>spring-cloud-dataflow-composed-task-runner</module>-->
Expand Down
9 changes: 5 additions & 4 deletions spring-cloud-dataflow-server-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-micrometer</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-ant</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dataflow-schema</artifactId>
Expand Down Expand Up @@ -257,6 +253,11 @@
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏻

<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-ant</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.springframework.cloud.dataflow.server.batch;

//TODO: Boot3x followup
public class JobRestartRuntimeException extends RuntimeException {
onobc marked this conversation as resolved.
Show resolved Hide resolved

public JobRestartRuntimeException(Long jobExecutionId, Exception cause) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.springframework.cloud.dataflow.server.batch;

//TODO: Boot3x followup
public class JobStartRuntimeException extends RuntimeException {

public JobStartRuntimeException(String jobName, Exception cause) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.springframework.cloud.dataflow.server.batch;

//TODO: Boot3x followup
public class JobStopException extends RuntimeException {

public JobStopException(Long jobExecutionId, Exception cause) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ public SimpleJobService(SearchableJobInstanceDao jobInstanceDao, SearchableJobEx
this.executionContextDao = executionContextDao;
this.aggregateJobQueryDao = aggregateJobQueryDao;
this.schemaVersionTarget = schemaVersionTarget;
Assert.notNull(this.jobOperator = jobOperator, "jobOperator must not be null");
Objects.requireNonNull(jobOperator, "jobOperator must not be null");
this.jobOperator = jobOperator;
Copy link
Contributor

Choose a reason for hiding this comment

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

Even 1 step further yields...

this.jobOperator = Objects.requireNonNull(jobOperator, "jobOperator must not be null");

}

/**
Expand Down Expand Up @@ -165,8 +166,7 @@ public JobExecution restart(Long jobExecutionId, JobParameters params) throws No
try {
jobExecution = new JobExecution(jobOperator.restart(jobExecutionId.longValue()));
}
catch (JobParametersInvalidException | JobRestartException | NoSuchJobExecutionException |
JobInstanceAlreadyCompleteException e) {
catch (Exception e) {
throw new JobRestartRuntimeException(jobExecutionId, e);
}

Expand All @@ -178,14 +178,14 @@ public JobExecution launch(String jobName, JobParameters jobParameters) throws N
JobExecution jobExecution;

if (jobOperator != null) {
onobc marked this conversation as resolved.
Show resolved Hide resolved
try {
jobExecution = new JobExecution(jobOperator.start(jobName, jobParameters.toProperties()));
} catch (JobInstanceAlreadyExistsException | JobParametersInvalidException e) {
throw new JobStartRuntimeException(jobName, e);
}
} else {
try {
jobExecution = new JobExecution(jobOperator.start(jobName, jobParameters.toProperties()));
} catch (JobInstanceAlreadyExistsException | JobParametersInvalidException e) {
throw new JobStartRuntimeException(jobName, e);
}
} else {
throw new NoSuchJobException(String.format("Unable to find job %s to launch",
String.valueOf(jobName)));
jobName));
}

return jobExecution;
Expand Down Expand Up @@ -257,19 +257,18 @@ public int countJobs() {
@Override
public int stopAll() {
Collection<JobExecution> result = jobExecutionDao.getRunningJobExecutions();
Collection<String> jsrJobNames = getJobNames();
Collection<String> jobNames = getJobNames();

for (JobExecution jobExecution : result) {
if (jsrJobNames.contains(jobExecution.getJobInstance().getJobName())) {
try {
jobOperator.stop(jobExecution.getId());
} catch (NoSuchJobExecutionException e) {
throw new JobStopException(jobExecution.getId(), e);
} catch (JobExecutionNotRunningException e) {
throw new JobStopException(jobExecution.getId(), e);
}
} else {
throw new JobStopException(jobExecution.getId());
try {
if (jobNames.contains(jobExecution.getJobInstance().getJobName())) {
jobOperator.stop(jobExecution.getId());

} else {
throw new JobStopException(jobExecution.getId());
}
} catch (Exception e) {
throw new IllegalArgumentException("The following JobExecutionId was not found: " + jobExecution.getId(), e);
}
}

Expand Down Expand Up @@ -309,10 +308,10 @@ public JobExecution abandon(Long jobExecutionId) throws NoSuchJobExecutionExcept

logger.info("Aborting job execution: " + jobExecution);

Collection<String> jsrJobNames = getJobNames();
Collection<String> jobNames = getJobNames();

JobInstance jobInstance = jobExecution.getJobInstance();
if (jobOperator != null && jsrJobNames.contains(jobInstance.getJobName())) {
if (jobOperator != null && jobNames.contains(jobInstance.getJobName())) {
jobOperator.abandon(jobExecutionId);
jobExecution = getJobExecution(jobExecutionId);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ public void restartJobExecution(long jobExecutionId, String schemaTarget) throws

}

//TODO: Boot3x followup Remove boot2 check in this method once boot2 suuport code has been removed.
/**
* Apply identifying job parameters to arguments. There are cases (incrementers)
* that add parameters to a job and thus must be added for each restart so that the
Expand Down
Loading