in bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/JobServiceImpl.java [200:234]
private Job recreateJob(JobPO jobPO) {
JobContext jobContext = JsonUtils.readFromString(jobPO.getContext(), JobContext.class);
jobContext.setRetryFlag(true);
CommandIdentifier commandIdentifier = new CommandIdentifier(
jobContext.getCommandDTO().getCommandLevel(),
jobContext.getCommandDTO().getCommand());
JobFactory jobFactory = JobFactories.getJobFactory(commandIdentifier);
Job job = jobFactory.createJob(jobContext);
job.loadJobPO(jobPO);
List<StagePO> stagePOList = stageDao.findByJobId(jobPO.getId());
for (int i = 0; i < job.getStages().size(); i++) {
Stage stage = job.getStages().get(i);
StagePO stagePO = findCorrectStagePO(stagePOList, i + 1);
if (stagePO == null) {
throw new ApiException(ApiExceptionEnum.JOB_NOT_RETRYABLE);
}
stage.loadStagePO(stagePO);
List<TaskPO> taskPOList = taskDao.findByStageId(stagePO.getId());
for (int j = 0; j < stage.getTasks().size(); j++) {
Task task = stage.getTasks().get(j);
TaskPO taskPO =
findCorrectTaskPO(taskPOList, task.getTaskContext().getHostname());
if (taskPO == null) {
throw new ApiException(ApiExceptionEnum.JOB_NOT_RETRYABLE);
}
task.loadTaskPO(taskPO);
}
}
return job;
}