When a job is restarted, only the failed partitions are run again. How do i run a successfully completed job again?
Is there a difference between submitting a job again and restarting the job?
i am using IBM's implementation of JSR 352 on Websphere Liberty.
Java Batch is designed so that when you restart a job instance, execution continues where you left off (in the previous failed or stopped execution).
So typically this means two things:
- Within the job, you begin at the previously-failing step (or the step at which the job was stopped).
- Within the step, you begin by positioning the input cursor using the checkpoint values kept by the batch container.
So if on the initial execution you completed step1 then failed at step2 at record #4123, and are checkpointing every 100 records, then on a restart you'd typically begin executing at step2 at record #4100.
In some cases it's necessary to execute step1 on the restart as well, before executing step2 where the job had previously failed, and there is an option to get this behavior as well.
It is typical to submit/start a job repeatedly, often on a schedule.
In the terms of the batch specification, a new JobInstance is created each time a job is started. At this time the initial JobExecution for this JobInstance is created. If the execution does not run to completion, the instance may be restarted, at which time a second JobExecution is created for this JobInstance.
So a restart uses the checkpoints and execution history of the previous JobExecution while the start begins with a clean slate.
来源:https://stackoverflow.com/questions/36779383/jsr-352-restarting-a-job