use of com.baidu.hugegraph.entity.load.JobManagerReasonResult in project incubator-hugegraph-toolchain by apache.
the class JobManagerController method reason.
@GetMapping("{id}/reason")
public Response reason(@PathVariable("connId") int connId, @PathVariable("id") int id) {
JobManager job = this.service.get(id);
if (job == null) {
throw new ExternalException("job.manager.not-exist.id", id);
}
List<LoadTask> tasks = this.taskService.batchTasks(job.getId());
List<JobManagerReasonResult> reasonResults = new ArrayList<>();
tasks.forEach(task -> {
JobManagerReasonResult reasonResult = new JobManagerReasonResult();
int fileId = task.getFileId();
String reason = "";
if (task.getStatus() == LoadStatus.FAILED) {
FileMapping mapping = this.fmService.get(fileId);
reason = this.taskService.readLoadFailedReason(mapping);
}
reasonResult.setTaskId(task.getJobId());
reasonResult.setFileId(task.getFileId());
reasonResult.setFileName(task.getFileName());
reasonResult.setReason(reason);
reasonResults.add(reasonResult);
});
return Response.builder().status(Constant.STATUS_OK).data(reasonResults).build();
}
Aggregations