|
|
|
@@ -238,20 +238,16 @@ public class ExperimentServiceImpl implements ExperimentService { |
|
|
|
Map<String ,Object> output = (Map<String, Object>) converMap.get("output"); |
|
|
|
// 调argo运行接口 |
|
|
|
String runRes = HttpUtils.sendPost(argoUrl + argoWorkflowRun, JsonUtils.mapToJson(runReqMap)); |
|
|
|
|
|
|
|
if (runRes == null || StringUtils.isEmpty(runRes)) { |
|
|
|
throw new RuntimeException("Failed to run workflow."); |
|
|
|
} |
|
|
|
Map<String, Object> runResMap = JsonUtils.jsonToMap(runRes); |
|
|
|
Map<String, Object> data = (Map<String, Object>) runResMap.get("data"); |
|
|
|
|
|
|
|
//判断data为空 |
|
|
|
if (data == null || MapUtils.isEmpty(data)) { |
|
|
|
throw new RuntimeException("Failed to run workflow."); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, Object> metadata = (Map<String, Object>) data.get("metadata"); |
|
|
|
|
|
|
|
// 插入记录到实验实例表 |
|
|
|
ExperimentIns experimentIns = new ExperimentIns(); |
|
|
|
experimentIns.setExperimentId(experiment.getId()); |
|
|
|
@@ -260,22 +256,17 @@ public class ExperimentServiceImpl implements ExperimentService { |
|
|
|
experimentIns.setStatus("Pending"); |
|
|
|
|
|
|
|
//传入实验全局参数 |
|
|
|
|
|
|
|
experimentIns.setGlobalParam(experiment.getGlobalParam()); |
|
|
|
|
|
|
|
//替换argoInsName |
|
|
|
String outputString = JsonUtils.mapToJson(output); |
|
|
|
experimentIns.setNodesResult(outputString.replace("{{workflow.name}}", (String) metadata.get("name"))); |
|
|
|
//插入ExperimentIns表中 |
|
|
|
experimentInsService.insert(experimentIns); |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
List<ExperimentIns> updatedExperimentInsList = experimentInsService.getByExperimentId(id); |
|
|
|
|
|
|
|
experiment.setExperimentInsList(updatedExperimentInsList); |
|
|
|
|
|
|
|
return experiment; |
|
|
|
} |
|
|
|
|
|
|
|
|