Skip to content

Fix #5340: Allow restart of jobs with JobParameterIncrementer from command line#5353

Open
nikitanagar08 wants to merge 1 commit intospring-projects:mainfrom
nikitanagar08:fix-5340-parameter-incrementer-restart
Open

Fix #5340: Allow restart of jobs with JobParameterIncrementer from command line#5353
nikitanagar08 wants to merge 1 commit intospring-projects:mainfrom
nikitanagar08:fix-5340-parameter-incrementer-restart

Conversation

@nikitanagar08
Copy link
Copy Markdown

@nikitanagar08 nikitanagar08 commented Mar 20, 2026

This PR addresses #5340 by fixing the restart behavior for jobs using JobParameterIncrementer when launched from the command line.

Problem

Previously, when a job with a JobParameterIncrementer was launched from the command line, the start() method would always use the incrementer to create a new instance, even when there was a failed/stopped job instance that could be restarted.

Solution

Modified SimpleJobOperator.start() to:

  1. First try to run the job with the provided parameters (which restarts failed/stopped instances)
  2. Only use the incrementer when JobInstanceAlreadyCompleteException is thrown

Behavior Change

  • Before: Jobs with incrementers always created new instances from command line
  • After: Failed/stopped jobs are restarted; only completed jobs trigger the incrementer

This maintains backward compatibility while enabling the expected restart behavior.


@nikitanagar08 nikitanagar08 force-pushed the fix-5340-parameter-incrementer-restart branch from 9b9099d to c658476 Compare March 20, 2026 16:06
…ementer from command line

This commit addresses the issue where jobs using JobParameterIncrementer
could not be restarted from the command line. Previously, the start()
method would always use the incrementer to create a new instance, even
when there was a failed/stopped job instance that could be restarted.

Changes:
- Modified SimpleJobOperator.start() to first try running the job with
  provided parameters (which restarts failed/stopped instances)
- Only use the incrementer when JobInstanceAlreadyCompleteException
  is thrown (meaning the job instance is already complete)

This allows jobs with JobParameterIncrementer to be restarted from the
command line when they fail or stop, while still creating new instances
when the previous instance is complete.

Signed-off-by: Nikita Nagar <permanayan84@gmail.com>
@nikitanagar08 nikitanagar08 force-pushed the fix-5340-parameter-incrementer-restart branch from c658476 to 2d3d617 Compare March 20, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant