重新启动作业时,仅再次运行失败的分区。我如何再次成功完成一项工作?
再次提交作业和重新开始工作之间有区别吗?
我在Websphere Liberty上使用IBM的JSR 352实现。
答案 0 :(得分:3)
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:
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.