-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[BATCH-2675] Explicitly considering Start Time not being null for running Job Executions #659
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
Conversation
…ning Job Executions. This is to exclude from capturing erroneous Job Executions. An example is whenever a TaskRejectedException is thrown after submitting to the taskExecutor in SimpleJobLauncher#run(), the JobExecution is left without a Start or End Time. Also related tests are fixed.
spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java
Outdated
Show resolved
Hide resolved
spring-batch-core/src/test/java/org/springframework/batch/core/JobExecutionTests.java
Outdated
Show resolved
Hide resolved
spring-batch-core/src/test/java/org/springframework/batch/core/JobExecutionTests.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java
Show resolved
Hide resolved
JobExecution exec = new JobExecution(jobInstance, jobParameters); | ||
exec.setCreateTime(new Date(0)); | ||
exec.setEndTime(new Date(1L)); | ||
exec.setLastUpdated(new Date(5L)); | ||
dao.saveJobExecution(exec); | ||
|
||
//BATCH-2675 | ||
//Abnormal JobExecution as both StartTime and EndTime are null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this! It illustrates the issue we are addressing 👍
...test/java/org/springframework/batch/core/explore/support/MapJobExplorerFactoryBeanTests.java
Outdated
Show resolved
Hide resolved
...-batch-core/src/test/java/org/springframework/batch/core/jsr/launch/JsrJobOperatorTests.java
Outdated
Show resolved
Hide resolved
Hi @dimitrisli, Thank you for opening this PR as discussed in JIRA! Kind regards, |
…ning Job Executions Addressing code review comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for the review comments. I think I've addressed them. Please take a look.
Awesome! Thank you for these updates. Rebased, squashed and merged as f8f8a02. Thank you @dimitrisli for your contribution 👍 |
@benas fantastic, many thanks! I notice now that after the merge to master there is a test failing triggered by the Bamboo Build: https://build.spring.io/browse/BATCH-GRAD-JOB1-459 I cannot reproduce locally (it always succeeds) so I'm a bit confused - let me know how can I help there. Also if we wanted to back-port this change in 3.0.x I'm guessing we need another PR to 3.0.x this time - shall I proceed towards that direction? |
The build failure was not related to your changes. The build on master is successful now. In regards to backports, I backported the fix in 4.0.x yesterday (build successful) and was about to do it for 3.0.x today. But if you want to help, you are welcome! So please go ahead and open a PR for 3.0.x, we will consider merging it when we release 3.0.10. Many thanks upfront! |
In an attempt to exclude erroneous Job Executions whenever considering Running Job Executions (i.e. via
JobExplorer#findRunningJobExecutions()
).An example is whenever a
TaskRejectedException
is thrown after submitting to thetaskExecutor
inSimpleJobLauncher#run()
, theJobExecution
is left without a Start or End Time and therefore being considered as a Running Job Execution while it's not.Also related tests are fixed.