Skip to content

Commit

Permalink
Merge pull request #1149 from zhaoyun006/job-completed-no-progess-info
Browse files Browse the repository at this point in the history
fix: After the job task  completed , the front cannot obtain the prog…
  • Loading branch information
peacewong authored Dec 4, 2021
2 parents ff91661 + 8da0ada commit bf255ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,15 @@ public float getProgress() {
return progress;
}

/**
* // The front end needs to obtain data
* //if (EntranceJob.JOB_COMPLETED_PROGRESS() == getProgress()) {
* // return new JobProgressInfo[0];
* //}
* @return
*/
@Override
public JobProgressInfo[] getProgressInfo() {
if (EntranceJob.JOB_COMPLETED_PROGRESS() == getProgress()) {
return new JobProgressInfo[0];
}
SubJobInfo[] subJobInfoArray = getJobGroups();
if(subJobInfoArray.length > 0){
List<JobProgressInfo> progressInfoList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,8 @@ public Message progress(@PathVariable("id") String id) {
} else {
List<Map<String, Object>> list = new ArrayList<>();
for (JobProgressInfo jobProgressInfo : jobProgressInfos) {
if ("true".equals(EntranceConfiguration.PROGRESS_PUSH().getValue())) {
Map<String, Object> map = new HashMap<>();
map.put("id", jobProgressInfo.id());
map.put("succeedTasks", jobProgressInfo.succeedTasks());
map.put("failedTasks", jobProgressInfo.failedTasks());
map.put("runningTasks", jobProgressInfo.runningTasks());
map.put("totalTasks", jobProgressInfo.totalTasks());
list.add(map);
} else if (jobProgressInfo.failedTasks() > 0 || jobProgressInfo.runningTasks() > 0) {
Map<String, Object> map = new HashMap<>();
map.put("id", jobProgressInfo.id());
map.put("succeedTasks", jobProgressInfo.succeedTasks());
map.put("failedTasks", jobProgressInfo.failedTasks());
map.put("runningTasks", jobProgressInfo.runningTasks());
map.put("totalTasks", jobProgressInfo.totalTasks());
list.add(map);
if ("true".equals(EntranceConfiguration.PROGRESS_PUSH().getValue()) || jobProgressInfo.totalTasks() > 0) {
setJobProgressInfos(list, jobProgressInfo);
}
}
message = Message.ok();
Expand All @@ -213,6 +199,15 @@ public Message progress(@PathVariable("id") String id) {
return message;
}

private void setJobProgressInfos(List<Map<String, Object>> list, JobProgressInfo jobProgressInfo) {
Map<String, Object> map = new HashMap<>();
map.put("id", jobProgressInfo.id());
map.put("succeedTasks", jobProgressInfo.succeedTasks());
map.put("failedTasks", jobProgressInfo.failedTasks());
map.put("runningTasks", jobProgressInfo.runningTasks());
map.put("totalTasks", jobProgressInfo.totalTasks());
list.add(map);
}

@RequestMapping(path = "/{id}/log",method = RequestMethod.GET)
public Message log(HttpServletRequest req, @PathVariable("id") String id) {
Expand Down

0 comments on commit bf255ea

Please sign in to comment.