Skip to content

Add API to mark a job execution as failed for restart #4876

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

Open
fmbenhassine opened this issue Jun 10, 2025 · 0 comments
Open

Add API to mark a job execution as failed for restart #4876

fmbenhassine opened this issue Jun 10, 2025 · 0 comments

Comments

@fmbenhassine
Copy link
Contributor

This was initially discussed with @Nhoutain in #4831

Abrupt shutdowns of Spring Batch jobs leave the job execution in a running status at the job repository level as Spring Batch doesn't have a change to update the status correctly (see Aborting a Job). Restarting such failed jobs requires a manual database update as follows:

> update BATCH_JOB_EXECUTION set status = 'FAILED', END_TIME = 'non null value' where job_execution_id = X;
> update BATCH_STEP_EXECUTION set status = 'FAILED' where job_execution_id = X and step_name='failed step name';

There is already an API in the JobOperator to abandon a job execution, so it would be great to provide a new method to mark a job as failed to be able to restart it. The goal is to provide an API to mark a job as failed as opposed to asking users to manually execute SQL statements against the database. Providing an API is also necessary to support that feature consistently with other job repositories as well (thinking about No SQL stores for instances).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant