diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/autoML/AutoMlInsController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/autoML/AutoMlInsController.java index 874ec59c..d57e7dd8 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/autoML/AutoMlInsController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/autoML/AutoMlInsController.java @@ -49,7 +49,7 @@ public class AutoMlInsController extends BaseController { @PutMapping("{id}") @ApiOperation("终止实验实例") - public GenericsAjaxResult terminateAutoMlIns(@PathVariable("id") Long id) { + public GenericsAjaxResult terminateAutoMlIns(@PathVariable("id") Long id) throws Exception { return genericsSuccess(this.autoMLInsService.terminateAutoMlIns(id)); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AutoMlInsService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AutoMlInsService.java index 2131fc44..9776fa14 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AutoMlInsService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AutoMlInsService.java @@ -21,7 +21,7 @@ public interface AutoMlInsService { AutoMlIns queryStatusFromArgo(AutoMlIns autoMlIns); - boolean terminateAutoMlIns(Long id); + boolean terminateAutoMlIns(Long id) throws Exception; AutoMlIns getDetailById(Long id); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMlInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMlInsServiceImpl.java index dd4c2f07..89358f00 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMlInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMlInsServiceImpl.java @@ -57,7 +57,7 @@ public class AutoMlInsServiceImpl implements AutoMlInsService { if (StringUtils.isEmpty(autoMlIns.getStatus())) { autoMlIns = queryStatusFromArgo(autoMlIns); } - if (StringUtils.equals(autoMlIns.getStatus(), "Running")) { + if (StringUtils.equals(autoMlIns.getStatus(), Constant.Running)) { return "实验实例正在运行,不可删除"; } @@ -156,7 +156,7 @@ public class AutoMlInsServiceImpl implements AutoMlInsService { } @Override - public boolean terminateAutoMlIns(Long id) { + public boolean terminateAutoMlIns(Long id) throws Exception { AutoMlIns autoMlIns = autoMlInsDao.queryById(id); if (autoMlIns == null) { throw new IllegalStateException("实验实例未查询到,id: " + id); @@ -172,7 +172,7 @@ public class AutoMlInsServiceImpl implements AutoMlInsService { } // 只有状态是"Running"时才能终止实例 if (!currentStatus.equalsIgnoreCase(Constant.Running)) { - return false; // 如果不是"Running"状态,则不执行终止操作 + throw new Exception("终止错误,只有运行状态的实例才能终止"); // 如果不是"Running"状态,则不执行终止操作 } // 创建请求数据map diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMlServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMlServiceImpl.java index d5e436e8..dfddf71f 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMlServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMlServiceImpl.java @@ -102,13 +102,13 @@ public class AutoMlServiceImpl implements AutoMlService { public String delete(Long id) { AutoMl autoMl = autoMlDao.getAutoMlById(id); if (autoMl == null) { - throw new RuntimeException("服务不存在"); + throw new RuntimeException("实验不存在"); } String username = SecurityUtils.getLoginUser().getUsername(); String createBy = autoMl.getCreateBy(); if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createBy))) { - throw new RuntimeException("无权限删除该服务"); + throw new RuntimeException("无权限删除该实验"); } autoMl.setState(Constant.State_invalid);