|
|
|
@@ -151,8 +151,9 @@ public class ExperimentServiceImpl implements ExperimentService { |
|
|
|
* @return 实例对象 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Experiment update(Experiment experiment) throws IOException { |
|
|
|
public Experiment update(Experiment experiment) throws Exception { |
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
|
checkDeclaredName(experiment); |
|
|
|
experiment.setUpdateBy(loginUser.getUsername()); |
|
|
|
experiment.setUpdateTime(new Date()); |
|
|
|
this.experimentDao.update(experiment); |
|
|
|
@@ -207,12 +208,9 @@ public class ExperimentServiceImpl implements ExperimentService { |
|
|
|
public Experiment runExperiment(Integer id) throws Exception { |
|
|
|
//先查出实验记录 |
|
|
|
Experiment experiment = this.queryById(id); |
|
|
|
|
|
|
|
if (experiment == null) { |
|
|
|
System.out.println("No experiment"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Workflow workflow = workflowService.queryById(experiment.getWorkflowId()); |
|
|
|
if(workflow == null) { |
|
|
|
throw new RuntimeException("流水线不存在,请先创建流水线"); |
|
|
|
@@ -232,7 +230,7 @@ public class ExperimentServiceImpl implements ExperimentService { |
|
|
|
//这里全局参数是一个json数组,需要转换成一个list<Map> |
|
|
|
List<Map<String, Object>> params = JacksonUtil.parseJSONStr2MapList(StringUtils.isEmpty(experiment.getGlobalParam()) ? "[]" : experiment.getGlobalParam()); |
|
|
|
runReqMap.put("params", params); |
|
|
|
//// 实验字段的Map,不要写成一行!否则会返回null |
|
|
|
// 实验字段的Map,不要写成一行!否则会返回null |
|
|
|
Map<String, Object> experimentMap = new HashMap<>(); |
|
|
|
experimentMap.put("name", "experiment-"+experiment.getId()); |
|
|
|
runReqMap.put("experiment", experimentMap); |
|
|
|
@@ -332,7 +330,7 @@ public class ExperimentServiceImpl implements ExperimentService { |
|
|
|
// 现在我们知道还有另一个具有相同名称的流水线 |
|
|
|
Field[] fields = Experiment.class.getDeclaredFields(); |
|
|
|
for (Field field : fields) { |
|
|
|
field.setAccessible(true); // 使私有字段可访问 |
|
|
|
field.setAccessible(true); |
|
|
|
if ("name".equals(field.getName()) && field.isAnnotationPresent(CheckDuplicate.class)) { |
|
|
|
// 如果字段是“name”并且标记了CheckDuplicate注解 |
|
|
|
CheckDuplicate annotation = field.getAnnotation(CheckDuplicate.class); |
|
|
|
|