|
|
|
@@ -57,17 +57,13 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { |
|
|
|
@Override |
|
|
|
public ExperimentIns queryById(Integer id) { |
|
|
|
ExperimentIns experimentIns = this.experimentInsDao.queryById(id); |
|
|
|
//获取实例当前状态 |
|
|
|
String currentStatus = experimentIns.getStatus(); |
|
|
|
|
|
|
|
// 检查是否需要调用接口查询状态:当原本状态为null或非终止态时调用argo接口 |
|
|
|
if (StringUtils.isEmpty(currentStatus) || !isTerminatedState(currentStatus)) { |
|
|
|
if (experimentIns != null && (StringUtils.isEmpty(experimentIns.getStatus())) || !isTerminatedState(experimentIns.getStatus())) { |
|
|
|
experimentIns = this.queryStatusFromArgo(experimentIns); |
|
|
|
// 如果新状态不是null,并且与旧状态不同,则更新状态 |
|
|
|
if(!StringUtils.isEmpty(experimentIns.getStatus()) && !StringUtils.equals(experimentIns.getStatus(), currentStatus)){ |
|
|
|
//只有当新状态是终止态时才更新数据库 |
|
|
|
if (isTerminatedState(experimentIns.getStatus())) { |
|
|
|
//同时更新各个节点 |
|
|
|
this.update(experimentIns); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return experimentIns; |
|
|
|
} |
|
|
|
|