Browse Source

优化自动机器学习

dev-ray
chenzhihang 1 year ago
parent
commit
42cdfe89ce
4 changed files with 7 additions and 7 deletions
  1. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/autoML/AutoMlInsController.java
  2. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AutoMlInsService.java
  3. +3
    -3
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMlInsServiceImpl.java
  4. +2
    -2
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMlServiceImpl.java

+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/autoML/AutoMlInsController.java View File

@@ -49,7 +49,7 @@ public class AutoMlInsController extends BaseController {

@PutMapping("{id}")
@ApiOperation("终止实验实例")
public GenericsAjaxResult<Boolean> terminateAutoMlIns(@PathVariable("id") Long id) {
public GenericsAjaxResult<Boolean> terminateAutoMlIns(@PathVariable("id") Long id) throws Exception {
return genericsSuccess(this.autoMLInsService.terminateAutoMlIns(id));
}



+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AutoMlInsService.java View File

@@ -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);



+ 3
- 3
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMlInsServiceImpl.java View File

@@ -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


+ 2
- 2
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMlServiceImpl.java View File

@@ -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);


Loading…
Cancel
Save