Skip to content

Commit

Permalink
Fix jobhistory bug (DataLinkDC#805)
Browse files Browse the repository at this point in the history
* jobHistory bug modify

* jobHistory bug modify

* jobHistory bug modify
  • Loading branch information
mydq authored Aug 3, 2022
1 parent ed6e851 commit bd3fdd8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 3 additions & 0 deletions dlink-admin/src/main/java/com/dlink/model/JobHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@ public class JobHistory implements Serializable {

@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;

@TableField(exist = false)
private boolean error;
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ public JobHistory refreshJobHistory(Integer id, String jobManagerHost, String jo
JsonNode jobInfo = FlinkAPI.build(jobManagerHost).getJobInfo(jobId);
if(jobInfo.has(FlinkRestResultConstant.ERRORS)){
final JobHistory dbHistory = getById(id);
return Objects.isNull(dbHistory) ? jobHistory : dbHistory;
if (Objects.nonNull(dbHistory)) {
jobHistory = dbHistory;
}
jobHistory.setError(true);
return jobHistory;
}
JsonNode exception = FlinkAPI.build(jobManagerHost).getException(jobId);
JsonNode checkPoints = FlinkAPI.build(jobManagerHost).getCheckPoints(jobId);
Expand All @@ -115,8 +119,7 @@ public JobHistory refreshJobHistory(Integer id, String jobManagerHost, String jo
}
} catch (Exception e) {
e.printStackTrace();
} finally {
return jobHistory;
}
return jobHistory;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -785,13 +785,13 @@ public JobInstance refreshJobInstance(Integer id, boolean isCoercive) {
}
JobHistory jobHistoryJson = jobHistoryService.refreshJobHistory(id, jobInfoDetail.getCluster().getJobManagerHost(), jobInfoDetail.getInstance().getJid(), jobInfoDetail.isNeedSave());
JobHistory jobHistory = jobHistoryService.getJobHistoryInfo(jobHistoryJson);
if (JobStatus.isDone(jobInfoDetail.getInstance().getStatus()) && Asserts.isNull(jobHistory.getJob())) {
jobInfoDetail.setJobHistory(jobHistory);
if (JobStatus.isDone(jobInfoDetail.getInstance().getStatus()) && (Asserts.isNull(jobHistory.getJob()) || jobHistory.isError())) {
return jobInfoDetail.getInstance();
}
jobInfoDetail.setJobHistory(jobHistory);
String status = jobInfoDetail.getInstance().getStatus();
boolean jobStatusChanged = false;
if (Asserts.isNull(jobInfoDetail.getJobHistory().getJob())) {
if (Asserts.isNull(jobInfoDetail.getJobHistory().getJob()) || jobInfoDetail.getJobHistory().isError()) {
jobInfoDetail.getInstance().setStatus(JobStatus.UNKNOWN.getValue());
} else {
jobInfoDetail.getInstance().setDuration(jobInfoDetail.getJobHistory().getJob().get(FlinkRestResultConstant.JOB_DURATION).asLong() / 1000);
Expand Down

0 comments on commit bd3fdd8

Please sign in to comment.