|
|
|
@@ -211,8 +211,8 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { |
|
|
|
String namespace = ins.getArgoInsNs(); |
|
|
|
String name = ins.getArgoInsName(); |
|
|
|
Integer id = ins.getId(); |
|
|
|
ExperimentIns experimentIns = this.experimentInsDao.queryById(id); |
|
|
|
// 创建请求数据map |
|
|
|
ExperimentIns experimentIns = this.experimentInsDao.queryById(id); |
|
|
|
Map<String,Object> requestData = new HashMap<>(); |
|
|
|
requestData.put("namespace", namespace); |
|
|
|
requestData.put("name", name); |
|
|
|
@@ -240,11 +240,6 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { |
|
|
|
if (status == null || status.isEmpty()) { |
|
|
|
throw new RuntimeException("工作流状态为空。"); |
|
|
|
} |
|
|
|
//解析流水线开始时间,开始时间一定存在,所以不需要判断 |
|
|
|
Date startTime = DateUtils.convertUTCtoShanghaiDate((String) status.get("startedAt")); |
|
|
|
experimentIns.setStartTime(startTime); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//解析流水线结束时间 |
|
|
|
String finishedAtString = (String) status.get("finishedAt"); |
|
|
|
@@ -255,16 +250,13 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { |
|
|
|
|
|
|
|
// 解析nodes字段,提取节点状态并转换为JSON字符串 |
|
|
|
Map<String, Object> nodes = (Map<String, Object>) status.get("nodes"); |
|
|
|
if (nodes == null || nodes.isEmpty()) { |
|
|
|
throw new RuntimeException("工作流的节点数据为空。"); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, Object> modifiedNodes = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
for (Map.Entry<String, Object> nodeEntry : nodes.entrySet()) { |
|
|
|
Map<String,Object> nodeDetails = (Map<String, Object>) nodeEntry.getValue(); |
|
|
|
String templateName = (String) nodeDetails.get("displayName"); |
|
|
|
modifiedNodes.put(templateName, nodeDetails); |
|
|
|
if (nodes != null ) { |
|
|
|
for (Map.Entry<String, Object> nodeEntry : nodes.entrySet()) { |
|
|
|
Map<String,Object> nodeDetails = (Map<String, Object>) nodeEntry.getValue(); |
|
|
|
String templateName = (String) nodeDetails.get("displayName"); |
|
|
|
modifiedNodes.put(templateName, nodeDetails); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
String nodeStatusJson = JsonUtils.mapToJson(modifiedNodes); |
|
|
|
@@ -328,9 +320,10 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { |
|
|
|
// 从响应Map中直接获取"errCode"的值 |
|
|
|
Integer errCode = (Integer) runResMap.get("errCode"); |
|
|
|
if (errCode != null && errCode == 0) { |
|
|
|
experimentIns.setStatus("Terminated"); |
|
|
|
//更新experimentIns,确保状态更新被保存到数据库 |
|
|
|
this.experimentInsDao.update(experimentIns); |
|
|
|
ExperimentIns ins = queryStatusFromArgo(experimentIns); |
|
|
|
ins.setStatus("Terminated"); |
|
|
|
this.experimentInsDao.update(ins); |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
return false; |
|
|
|
|