|
|
|
@@ -1,12 +1,16 @@ |
|
|
|
package com.ruoyi.platform.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
import com.ruoyi.common.core.utils.DateUtils; |
|
|
|
import com.ruoyi.common.security.utils.SecurityUtils; |
|
|
|
import com.ruoyi.platform.constant.Constant; |
|
|
|
import com.ruoyi.platform.domain.AssetWorkflow; |
|
|
|
import com.ruoyi.platform.domain.AutoMl; |
|
|
|
import com.ruoyi.platform.domain.Dataset; |
|
|
|
import com.ruoyi.platform.domain.DatasetTempStorage; |
|
|
|
import com.ruoyi.platform.domain.dependencydomain.TrainTaskDepency; |
|
|
|
import com.ruoyi.platform.mapper.AssetWorkflowDao; |
|
|
|
import com.ruoyi.platform.mapper.AutoMlDao; |
|
|
|
import com.ruoyi.platform.service.DatasetTempStorageService; |
|
|
|
import com.ruoyi.platform.service.GitService; |
|
|
|
import com.ruoyi.platform.service.NewDatasetService; |
|
|
|
@@ -54,6 +58,8 @@ public class NewDatasetServiceImpl implements NewDatasetService { |
|
|
|
private GitService gitService; |
|
|
|
@Resource |
|
|
|
private AssetWorkflowDao assetWorkflowDao; |
|
|
|
@Resource |
|
|
|
private AutoMlDao autoMlDao; |
|
|
|
|
|
|
|
@Value("${spring.redis.host}") |
|
|
|
private String redisHost; |
|
|
|
@@ -408,6 +414,14 @@ public class NewDatasetServiceImpl implements NewDatasetService { |
|
|
|
throw new Exception("该数据集被流水线:" + workflows + "使用,不能删除,请先删除流水线。"); |
|
|
|
} |
|
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>(); |
|
|
|
map.put("id", String.valueOf(repoId)); |
|
|
|
List<AutoMl> autoMlList = autoMlDao.queryByDatasetId(JSON.toJSONString(map)); |
|
|
|
if(autoMlList !=null && !autoMlList.isEmpty()) { |
|
|
|
String autoMls = String.join(",", autoMlList.stream().map(AutoMl::getMlName).collect(Collectors.toSet())); |
|
|
|
throw new Exception("该数据集被自动机器学习:" + autoMls + "使用,不能删除,请先删除自动机器学习。"); |
|
|
|
} |
|
|
|
|
|
|
|
String token = gitService.checkoutToken(); |
|
|
|
gitService.deleteProject(token, owner, repo); |
|
|
|
|
|
|
|
@@ -424,6 +438,15 @@ public class NewDatasetServiceImpl implements NewDatasetService { |
|
|
|
throw new Exception("该数据集版本被流水线:" + workflows + "使用,不能删除,请先删除流水线。"); |
|
|
|
} |
|
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>(); |
|
|
|
map.put("id", String.valueOf(repoId)); |
|
|
|
map.put("version", version); |
|
|
|
List<AutoMl> autoMlList = autoMlDao.queryByDatasetId(JSON.toJSONString(map)); |
|
|
|
if(autoMlList !=null && !autoMlList.isEmpty()) { |
|
|
|
String autoMls = String.join(",", autoMlList.stream().map(AutoMl::getMlName).collect(Collectors.toSet())); |
|
|
|
throw new Exception("该数据集版本被自动机器学习:" + autoMls + "使用,不能删除,请先删除自动机器学习。"); |
|
|
|
} |
|
|
|
|
|
|
|
String token = gitService.checkoutToken(); |
|
|
|
String rootPath = Paths.get(localPathlocal + "/" + relativePath).getParent().toString(); |
|
|
|
gitService.deleteBranch(token, owner, repo, version, rootPath); |
|
|
|
|