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 6cf44f19..5d7e0301 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 @@ -5,7 +5,6 @@ import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.platform.annotations.CheckDuplicate; -import com.ruoyi.system.api.constant.Constant; import com.ruoyi.platform.domain.*; import com.ruoyi.platform.domain.dependencydomain.ProjectDepency; import com.ruoyi.platform.domain.dependencydomain.TrainTaskDepency; @@ -18,6 +17,7 @@ import com.ruoyi.platform.utils.JsonUtils; import com.ruoyi.platform.utils.YamlUtils; import com.ruoyi.platform.vo.ModelsVo; import com.ruoyi.platform.vo.NewDatasetVo; +import com.ruoyi.system.api.constant.Constant; import com.ruoyi.system.api.model.LoginUser; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; @@ -231,12 +231,15 @@ public class ExperimentServiceImpl implements ExperimentService { try { String convertRes = HttpUtils.sendPost(argoUrl + argoConvert, dag); if (convertRes == null || StringUtils.isEmpty(convertRes)) { - throw new RuntimeException("转换流水线失败"); + throw new Exception("转换流水线失败"); } Map converMap = JsonUtils.jsonToMap(convertRes); // 判断积分和资源是否足够 Map> resourceInfo = (Map>) converMap.get("resource_info"); + if (resourceInfo == null) { + throw new Exception("未配置运行所需资源"); + } for (Map.Entry> entry : resourceInfo.entrySet()) { Map node = entry.getValue(); resourceOccupyService.haveResource((Integer) node.get("computing_resource_id"), 1); @@ -276,7 +279,7 @@ public class ExperimentServiceImpl implements ExperimentService { experimentIns.setExperimentId(experiment.getId()); experimentIns.setArgoInsNs((String) metadata.get("namespace")); experimentIns.setArgoInsName((String) metadata.get("name")); - experimentIns.setStatus("Pending"); + experimentIns.setStatus(Constant.Pending); //传入实验全局参数 experimentIns.setGlobalParam(experiment.getGlobalParam()); @@ -314,9 +317,8 @@ public class ExperimentServiceImpl implements ExperimentService { Map node = entry.getValue(); resourceOccupyService.startDeduce((Integer) node.get("computing_resource_id"), 1, Constant.TaskType_Workflow, Long.valueOf(id), Long.valueOf(insert.getId()), experiment.getWorkflowId(), experiment.getName(), entry.getKey(), Constant.State_building); } - } catch (Exception e) { - throw new RuntimeException(e); + throw new Exception(e); } List updatedExperimentInsList = experimentInsService.getByExperimentId(id); experiment.setExperimentInsList(updatedExperimentInsList); @@ -523,7 +525,6 @@ public class ExperimentServiceImpl implements ExperimentService { } } } - } private void insertModelDependencyNew(Map dependendcy, Map trainInfo, Map output, String metricRecord, Integer experimentInsId, Long workflowId, Integer experimentId, String experimentName, String globalParam) {