diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetServiceImpl.java index 3e4f277b..835eb58b 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetServiceImpl.java @@ -353,22 +353,15 @@ public class DatasetServiceImpl implements DatasetService { public void checkDeclaredName(Dataset insert) throws Exception { Dataset existingDataset = datasetDao.findByName(insert.getName()); if (existingDataset != null) { - // Check if the found dataset is not the same as the one being inserted - // This is important if you are using this method for both insert and update operations - // You may need an identifier check here, e.g., if 'insert' has an ID and it's the same as 'existingDataset' if (insert.getId() != null && insert.getId().equals(existingDataset.getId())) { - // This is the same dataset, no duplicate name issue for update operation + // 相同数据集,无需判断 return; } - // Now we know there's another dataset with the same name Field[] fields = Dataset.class.getDeclaredFields(); - for (Field field : fields) { - field.setAccessible(true); // Make private fields accessible - + field.setAccessible(true); if ("name".equals(field.getName()) && field.isAnnotationPresent(CheckDuplicate.class)) { - // If the field is 'name' and is marked with CheckDuplicate annotation CheckDuplicate annotation = field.getAnnotation(CheckDuplicate.class); throw new Exception("重复的数据集名称: " + insert.getName() + ". " + annotation.message()); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index a18bb1e9..5a71ac66 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -427,7 +427,6 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { throw new RuntimeException("日志为空。"); } //返回日志内容 - return experimentInsLog; } catch (Exception e) { throw new RuntimeException("查询实验日志失败: " + e.getMessage(), e); @@ -554,7 +553,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { // 查询具有相同状态的实例数量 Long count = experimentInsDao.count(experimentIns); - // 将状态及其对应的实例数量放入映射中 + // 将状态及其对应的实例数量放入map中 statusCountMap.put(status.toString(), count); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java index 7b08295d..65171638 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java @@ -238,20 +238,16 @@ public class ExperimentServiceImpl implements ExperimentService { Map output = (Map) 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 runResMap = JsonUtils.jsonToMap(runRes); Map data = (Map) runResMap.get("data"); - //判断data为空 if (data == null || MapUtils.isEmpty(data)) { throw new RuntimeException("Failed to run workflow."); } - Map metadata = (Map) 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 updatedExperimentInsList = experimentInsService.getByExperimentId(id); - experiment.setExperimentInsList(updatedExperimentInsList); - return experiment; }