-
Notifications
You must be signed in to change notification settings - Fork 2.5k
GH4876: Add recover method to JobOperator #4944
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
Signed-off-by: Yejeong, Ham <[email protected]>
Signed-off-by: Yejeong, Ham <[email protected]>
- Log warnings instead of throwing exceptions when recovering already recovered job executions - Update tests - Update Javadocs
...atch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJobOperator.java
Show resolved
Hide resolved
...rc/test/java/org/springframework/batch/core/launch/support/TaskExecutorJobOperatorTests.java
Show resolved
Hide resolved
...rc/test/java/org/springframework/batch/core/launch/support/TaskExecutorJobOperatorTests.java
Show resolved
Hide resolved
...atch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJobOperator.java
Show resolved
Hide resolved
|
This is awesome! Thank you for your contribution 🙏 I added a couple inline comments about some minor changes that I will take care of on merge.
Unlike attempting to abandon a running execution which is an error, attempting to recover an already recovered execution does not really require an exception, so logging a warning is enough. I will update the code and tests accordingly. |
|
Nice work @thelightway24 !! |
|
Thanks for the review and fix, really appreciate it. |
Description
This PR introduces a new
recovermethod to theJobOperatorinterface and its implementations.This method allows to recover a failed job execution based on its ID. This is useful for restarting a failed job from the point where it left off.
This PR also adds unit tests for the new
recovermethod inJobOperator.Changes
recovermethod toJobOperatorinterface.recovermethod inSimpleJobOperator.JobOperator.recoverinTaskExecutorJobOperatorTests.recovermethod toCommandLineJobOperatorCommandLineJobOperator.recoverinCommandLineJobOperatorTests.Additional Notes
At SimpleJobOperator.java line 403, when a job execution is already recovered,
I currently throw an existing exception class.
I’m considering whether it would be better to:
Define a new exception class (e.g., AlreadyRecoveredException) — similar to how abandon throws an exception, or
Skip throwing an exception and instead log the event while returning the JobExecution.
For now, I’ve chosen to throw an exception for consistency with abandon
Related Issue
Resolves #4876