how to reset the status of the job when the container get terminated? #4532
-
Our project encountered an issue, the context is as follows: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
same issue here any solution? |
Beta Was this translation helpful? Give feedback.
-
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 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. |
Beta Was this translation helpful? Give feedback.
-
I believe my last comment answers the question, so I am closing this discussion; But If you need more help on this, please add a comment. |
Beta Was this translation helpful? Give feedback.
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 isSTARTED
). You need to reset the status toFAILED
and theEND_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.