Skip to content

how to reset the status of the job when the container get terminated? #4532

Closed Answered by fmbenhassine
leonelea asked this question in Q&A
Discussion options

You must be logged in to vote

When a job is killed abruptly, Spring Batch won't have a chance to update its status in the Job repository, so the status is stuck at STARTED. On restart, it is impossible to distinguish between a job that is effectively running and a job that has been killed abruptly (in both cases, the status is STARTED). You need to reset the status to FAILED and the END_TIME to a non null value manually in the database. There is a note about this case in the docs here.

I also wrote about this case with an example in the blog post here: https://spring.io/blog/2021/01/27/spring-batch-on-kubernetes-efficient-batch-processing-at-scale#4-gracefulabrupt-shutdown-implication.

Let me know if this helps.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by fmbenhassine
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants