| @@ -23,8 +23,11 @@ public class ActiveLearn { | |||||
| @ApiModelProperty(value = "任务类型:classification, regression") | @ApiModelProperty(value = "任务类型:classification, regression") | ||||
| private String taskType; | private String taskType; | ||||
| @ApiModelProperty(value = "预训练模型") | |||||
| private String model; | |||||
| @ApiModelProperty(value = "模型文件路径") | @ApiModelProperty(value = "模型文件路径") | ||||
| private String modelPath; | |||||
| private String modelPy; | |||||
| @ApiModelProperty(value = "模型类名称") | @ApiModelProperty(value = "模型类名称") | ||||
| private String modelClassName; | private String modelClassName; | ||||
| @@ -36,17 +39,22 @@ public class ActiveLearn { | |||||
| private String regressorAlg; | private String regressorAlg; | ||||
| @ApiModelProperty(value = "dataset文件路径") | @ApiModelProperty(value = "dataset文件路径") | ||||
| private String dataset; | |||||
| private String datasetPy; | |||||
| @ApiModelProperty(value = "dataset类名") | @ApiModelProperty(value = "dataset类名") | ||||
| private String datasetClassName; | private String datasetClassName; | ||||
| @ApiModelProperty(value = "数据集文件路径") | @ApiModelProperty(value = "数据集文件路径") | ||||
| private String datasetPath; | |||||
| private String dataset; | |||||
| @ApiModelProperty(value = "数据量") | @ApiModelProperty(value = "数据量") | ||||
| private Integer dataSize; | private Integer dataSize; | ||||
| @ApiModelProperty(value = "镜像") | |||||
| private String image; | |||||
| private Integer computingResourceId; | |||||
| @ApiModelProperty(value = "是否随机打乱") | @ApiModelProperty(value = "是否随机打乱") | ||||
| private Boolean shuffle; | private Boolean shuffle; | ||||
| @@ -66,7 +74,7 @@ public class ActiveLearn { | |||||
| private String queryStrategy; | private String queryStrategy; | ||||
| @ApiModelProperty(value = "loss文件路径") | @ApiModelProperty(value = "loss文件路径") | ||||
| private String lossPath; | |||||
| private String lossPy; | |||||
| @ApiModelProperty(value = "loss类名") | @ApiModelProperty(value = "loss类名") | ||||
| private String lossClassName; | private String lossClassName; | ||||
| @@ -11,11 +11,19 @@ public interface ActiveLearnDao { | |||||
| List<ActiveLearn> queryByPage(@Param("name") String name, @Param("pageable") Pageable pageable); | List<ActiveLearn> queryByPage(@Param("name") String name, @Param("pageable") Pageable pageable); | ||||
| ActiveLearn getActiveLearnByName(@Param("name") String name); | |||||
| ActiveLearn getActiveLearnByName(@Param("name") String name); | |||||
| int save(@Param("activeLearn") ActiveLearn activeLearn); | int save(@Param("activeLearn") ActiveLearn activeLearn); | ||||
| int edit(@Param("activeLearn") ActiveLearn activeLearn); | int edit(@Param("activeLearn") ActiveLearn activeLearn); | ||||
| ActiveLearn getActiveLearnById(@Param("id") Long id); | ActiveLearn getActiveLearnById(@Param("id") Long id); | ||||
| List<ActiveLearn> queryByDatasetId(@Param("datasetId") String datasetId); | |||||
| List<ActiveLearn> queryByModelId(@Param("modelId") String modelId); | |||||
| List<ActiveLearn> queryByImageId(@Param("imageId") String imageId); | |||||
| List<ActiveLearn> queryByCodeConfigId(@Param("codeConfigId") String codeConfigId); | |||||
| } | } | ||||
| @@ -18,4 +18,12 @@ public interface RayDao { | |||||
| int save(@Param("ray") Ray ray); | int save(@Param("ray") Ray ray); | ||||
| int edit(@Param("ray") Ray ray); | int edit(@Param("ray") Ray ray); | ||||
| List<Ray> queryByDatasetId(@Param("datasetId") String datasetId); | |||||
| List<Ray> queryByModelId(@Param("modelId") String modelId); | |||||
| List<Ray> queryByImageId(@Param("imageId") String imageId); | |||||
| List<Ray> queryByCodeConfig(@Param("codeConfig") String codeConfig); | |||||
| } | } | ||||
| @@ -43,14 +43,9 @@ public class ActiveLearnServiceImpl implements ActiveLearnService { | |||||
| activeLearn.setCreateBy(username); | activeLearn.setCreateBy(username); | ||||
| activeLearn.setUpdateBy(username); | activeLearn.setUpdateBy(username); | ||||
| String datasetJson = JacksonUtil.toJSONString(activeLearnVo.getDataset()); | |||||
| activeLearn.setDataset(datasetJson); | |||||
| String modelJson = JacksonUtil.toJSONString(activeLearnVo.getModelPath()); | |||||
| activeLearn.setModelPath(modelJson); | |||||
| String datasetPathJson = JacksonUtil.toJSONString(activeLearnVo.getDatasetPath()); | |||||
| activeLearn.setDatasetPath(datasetPathJson); | |||||
| String lossPathJson = JacksonUtil.toJSONString(activeLearnVo.getLossPath()); | |||||
| activeLearn.setLossPath(lossPathJson); | |||||
| activeLearn.setImage(JacksonUtil.toJSONString(activeLearnVo.getImage())); | |||||
| activeLearn.setModel(JacksonUtil.toJSONString(activeLearnVo.getModel())); | |||||
| activeLearn.setDataset(JacksonUtil.toJSONString(activeLearnVo.getDataset())); | |||||
| activeLearnDao.save(activeLearn); | activeLearnDao.save(activeLearn); | ||||
| return activeLearn; | return activeLearn; | ||||
| @@ -68,14 +63,9 @@ public class ActiveLearnServiceImpl implements ActiveLearnService { | |||||
| String username = SecurityUtils.getLoginUser().getUsername(); | String username = SecurityUtils.getLoginUser().getUsername(); | ||||
| activeLearn.setUpdateBy(username); | activeLearn.setUpdateBy(username); | ||||
| String datasetJson = JacksonUtil.toJSONString(activeLearnVo.getDataset()); | |||||
| activeLearn.setDataset(datasetJson); | |||||
| String modelJson = JacksonUtil.toJSONString(activeLearnVo.getModelPath()); | |||||
| activeLearn.setModelPath(modelJson); | |||||
| String datasetPathJson = JacksonUtil.toJSONString(activeLearnVo.getDatasetPath()); | |||||
| activeLearn.setDatasetPath(datasetPathJson); | |||||
| String lossPathJson = JacksonUtil.toJSONString(activeLearnVo.getLossPath()); | |||||
| activeLearn.setLossPath(lossPathJson); | |||||
| activeLearn.setImage(JacksonUtil.toJSONString(activeLearnVo.getImage())); | |||||
| activeLearn.setModel(JacksonUtil.toJSONString(activeLearnVo.getModel())); | |||||
| activeLearn.setDataset(JacksonUtil.toJSONString(activeLearnVo.getDataset())); | |||||
| activeLearnDao.edit(activeLearn); | activeLearnDao.edit(activeLearn); | ||||
| @@ -87,17 +77,17 @@ public class ActiveLearnServiceImpl implements ActiveLearnService { | |||||
| ActiveLearn activeLearn = activeLearnDao.getActiveLearnById(id); | ActiveLearn activeLearn = activeLearnDao.getActiveLearnById(id); | ||||
| ActiveLearnVo activeLearnVo = new ActiveLearnVo(); | ActiveLearnVo activeLearnVo = new ActiveLearnVo(); | ||||
| BeanUtils.copyProperties(activeLearn, activeLearnVo); | BeanUtils.copyProperties(activeLearn, activeLearnVo); | ||||
| if (StringUtils.isNotEmpty(activeLearn.getDataset())) { | |||||
| activeLearnVo.setDatasetPath(JsonUtils.jsonToMap(activeLearn.getDatasetPath())); | |||||
| if (StringUtils.isNotEmpty(activeLearn.getDatasetPy())) { | |||||
| activeLearnVo.setDataset(JsonUtils.jsonToMap(activeLearn.getDataset())); | |||||
| } | } | ||||
| if (StringUtils.isNotEmpty(activeLearn.getModelPath())) { | |||||
| activeLearnVo.setModelPath(JsonUtils.jsonToMap(activeLearn.getModelPath())); | |||||
| if (StringUtils.isNotEmpty(activeLearn.getModel())) { | |||||
| activeLearnVo.setModel(JsonUtils.jsonToMap(activeLearn.getModel())); | |||||
| } | } | ||||
| if (StringUtils.isNotEmpty(activeLearn.getDataset())) { | if (StringUtils.isNotEmpty(activeLearn.getDataset())) { | ||||
| activeLearnVo.setDataset(JsonUtils.jsonToMap(activeLearn.getDataset())); | activeLearnVo.setDataset(JsonUtils.jsonToMap(activeLearn.getDataset())); | ||||
| } | } | ||||
| if (StringUtils.isNotEmpty(activeLearn.getLossPath())) { | |||||
| activeLearnVo.setLossPath(JsonUtils.jsonToMap(activeLearn.getLossPath())); | |||||
| if (StringUtils.isNotEmpty(activeLearn.getImage())) { | |||||
| activeLearnVo.setImage(JsonUtils.jsonToMap(activeLearn.getImage())); | |||||
| } | } | ||||
| return activeLearnVo; | return activeLearnVo; | ||||
| } | } | ||||
| @@ -126,10 +116,9 @@ public class ActiveLearnServiceImpl implements ActiveLearnService { | |||||
| ActiveLearnVo activeLearnParam = new ActiveLearnVo(); | ActiveLearnVo activeLearnParam = new ActiveLearnVo(); | ||||
| BeanUtils.copyProperties(activeLearn, activeLearnParam); | BeanUtils.copyProperties(activeLearn, activeLearnParam); | ||||
| activeLearnParam.setDatasetPath(JsonUtils.jsonToMap(activeLearn.getDatasetPath())); | |||||
| activeLearnParam.setDataset(JsonUtils.jsonToMap(activeLearn.getDataset())); | activeLearnParam.setDataset(JsonUtils.jsonToMap(activeLearn.getDataset())); | ||||
| activeLearnParam.setModelPath(JsonUtils.jsonToMap(activeLearn.getModelPath())); | |||||
| activeLearnParam.setLossPath(JsonUtils.jsonToMap(activeLearn.getLossPath())); | |||||
| activeLearnParam.setImage(JsonUtils.jsonToMap(activeLearn.getImage())); | |||||
| activeLearnParam.setModel(JsonUtils.jsonToMap(activeLearn.getModel())); | |||||
| String param = JsonUtils.objectToJson(activeLearnParam); | String param = JsonUtils.objectToJson(activeLearnParam); | ||||
| @@ -4,8 +4,10 @@ import com.ruoyi.common.security.utils.SecurityUtils; | |||||
| import com.ruoyi.platform.constant.Constant; | import com.ruoyi.platform.constant.Constant; | ||||
| import com.ruoyi.platform.domain.AssetWorkflow; | import com.ruoyi.platform.domain.AssetWorkflow; | ||||
| import com.ruoyi.platform.domain.CodeConfig; | import com.ruoyi.platform.domain.CodeConfig; | ||||
| import com.ruoyi.platform.mapper.ActiveLearnDao; | |||||
| import com.ruoyi.platform.mapper.AssetWorkflowDao; | import com.ruoyi.platform.mapper.AssetWorkflowDao; | ||||
| import com.ruoyi.platform.mapper.CodeConfigDao; | import com.ruoyi.platform.mapper.CodeConfigDao; | ||||
| import com.ruoyi.platform.mapper.RayDao; | |||||
| import com.ruoyi.platform.service.CodeConfigService; | import com.ruoyi.platform.service.CodeConfigService; | ||||
| import com.ruoyi.system.api.model.LoginUser; | import com.ruoyi.system.api.model.LoginUser; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| @@ -26,6 +28,10 @@ public class CodeConfigServiceImpl implements CodeConfigService { | |||||
| private CodeConfigDao codeConfigDao; | private CodeConfigDao codeConfigDao; | ||||
| @Resource | @Resource | ||||
| private AssetWorkflowDao assetWorkflowDao; | private AssetWorkflowDao assetWorkflowDao; | ||||
| @Resource | |||||
| private RayDao rayDao; | |||||
| @Resource | |||||
| private ActiveLearnDao activeLearnDao; | |||||
| @Override | @Override | ||||
| public Page<CodeConfig> queryByPage(CodeConfig codeConfig, PageRequest pageRequest) { | public Page<CodeConfig> queryByPage(CodeConfig codeConfig, PageRequest pageRequest) { | ||||
| @@ -88,6 +94,8 @@ public class CodeConfigServiceImpl implements CodeConfigService { | |||||
| throw new Exception("该代码配置被流水线:" + workflows + "使用,不能删除,请先删除流水线。"); | throw new Exception("该代码配置被流水线:" + workflows + "使用,不能删除,请先删除流水线。"); | ||||
| } | } | ||||
| // rayDao.queryByCodeConfig() | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String username = loginUser.getUsername(); | String username = loginUser.getUsername(); | ||||
| String createBy = codeConfig.getCreateBy(); | String createBy = codeConfig.getCreateBy(); | ||||
| @@ -1,16 +1,11 @@ | |||||
| package com.ruoyi.platform.service.impl; | package com.ruoyi.platform.service.impl; | ||||
| import com.alibaba.fastjson2.JSON; | |||||
| import com.alibaba.fastjson2.util.DateUtils; | import com.alibaba.fastjson2.util.DateUtils; | ||||
| import com.ruoyi.common.security.utils.SecurityUtils; | import com.ruoyi.common.security.utils.SecurityUtils; | ||||
| import com.ruoyi.platform.constant.Constant; | import com.ruoyi.platform.constant.Constant; | ||||
| import com.ruoyi.platform.domain.AssetWorkflow; | |||||
| import com.ruoyi.platform.domain.DevEnvironment; | |||||
| import com.ruoyi.platform.domain.Image; | |||||
| import com.ruoyi.platform.domain.ImageVersion; | |||||
| import com.ruoyi.platform.mapper.AssetWorkflowDao; | |||||
| import com.ruoyi.platform.mapper.DevEnvironmentDao; | |||||
| import com.ruoyi.platform.mapper.ImageDao; | |||||
| import com.ruoyi.platform.mapper.ImageVersionDao; | |||||
| import com.ruoyi.platform.domain.*; | |||||
| import com.ruoyi.platform.mapper.*; | |||||
| import com.ruoyi.platform.service.ImageService; | import com.ruoyi.platform.service.ImageService; | ||||
| import com.ruoyi.platform.service.ImageVersionService; | import com.ruoyi.platform.service.ImageVersionService; | ||||
| import com.ruoyi.platform.service.MinioService; | import com.ruoyi.platform.service.MinioService; | ||||
| @@ -53,10 +48,12 @@ public class ImageServiceImpl implements ImageService { | |||||
| private ImageVersionDao imageVersionDao; | private ImageVersionDao imageVersionDao; | ||||
| @Resource | @Resource | ||||
| private DevEnvironmentDao devEnvironmentDao; | private DevEnvironmentDao devEnvironmentDao; | ||||
| @Resource | @Resource | ||||
| private AssetWorkflowDao assetWorkflowDao; | private AssetWorkflowDao assetWorkflowDao; | ||||
| @Resource | |||||
| private RayDao rayDao; | |||||
| @Resource | |||||
| private ActiveLearnDao activeLearnDao; | |||||
| @Resource | @Resource | ||||
| private ImageVersionService imageVersionService; | private ImageVersionService imageVersionService; | ||||
| @@ -182,6 +179,20 @@ public class ImageServiceImpl implements ImageService { | |||||
| throw new Exception("该镜像被流水线:" + workflows + "使用,不能删除,请先删除流水线。"); | throw new Exception("该镜像被流水线:" + workflows + "使用,不能删除,请先删除流水线。"); | ||||
| } | } | ||||
| HashMap<String, String> map = new HashMap<>(); | |||||
| map.put("id", String.valueOf(id)); | |||||
| List<Ray> rayList = rayDao.queryByImageId(JSON.toJSONString(map)); | |||||
| if (rayList != null && !rayList.isEmpty()) { | |||||
| String rays = String.join(",", rayList.stream().map(Ray::getName).collect(Collectors.toSet())); | |||||
| throw new Exception("该镜像被超参数自动寻优:" + rays + "使用,不能删除,请先删除超参数自动寻优。"); | |||||
| } | |||||
| List<ActiveLearn> activeLearnList = activeLearnDao.queryByImageId(JSON.toJSONString(map)); | |||||
| if (activeLearnList != null && !activeLearnList.isEmpty()) { | |||||
| String activeLearns = String.join(",", activeLearnList.stream().map(ActiveLearn::getName).collect(Collectors.toSet())); | |||||
| throw new Exception("该镜像被主动学习:" + activeLearns + "使用,不能删除,请先删除主动学习。"); | |||||
| } | |||||
| //判断权限,只有admin和创建者本身可以删除该数据集 | //判断权限,只有admin和创建者本身可以删除该数据集 | ||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String username = loginUser.getUsername(); | String username = loginUser.getUsername(); | ||||
| @@ -1,13 +1,10 @@ | |||||
| package com.ruoyi.platform.service.impl; | package com.ruoyi.platform.service.impl; | ||||
| import com.alibaba.fastjson2.JSON; | |||||
| import com.ruoyi.common.security.utils.SecurityUtils; | import com.ruoyi.common.security.utils.SecurityUtils; | ||||
| import com.ruoyi.platform.constant.Constant; | import com.ruoyi.platform.constant.Constant; | ||||
| import com.ruoyi.platform.domain.AssetWorkflow; | |||||
| import com.ruoyi.platform.domain.ImageVersion; | |||||
| import com.ruoyi.platform.mapper.AssetWorkflowDao; | |||||
| import com.ruoyi.platform.mapper.ImageDao; | |||||
| import com.ruoyi.platform.mapper.ImageVersionDao; | |||||
| import com.ruoyi.platform.domain.ModelsVersion; | |||||
| import com.ruoyi.platform.domain.*; | |||||
| import com.ruoyi.platform.mapper.*; | |||||
| import com.ruoyi.platform.service.ImageVersionService; | import com.ruoyi.platform.service.ImageVersionService; | ||||
| import com.ruoyi.system.api.model.LoginUser; | import com.ruoyi.system.api.model.LoginUser; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| @@ -18,6 +15,7 @@ import org.springframework.data.domain.PageRequest; | |||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| @@ -31,10 +29,12 @@ import java.util.stream.Collectors; | |||||
| public class ImageVersionServiceImpl implements ImageVersionService { | public class ImageVersionServiceImpl implements ImageVersionService { | ||||
| @Resource | @Resource | ||||
| private ImageVersionDao imageVersionDao; | private ImageVersionDao imageVersionDao; | ||||
| @Resource | @Resource | ||||
| private AssetWorkflowDao assetWorkflowDao; | private AssetWorkflowDao assetWorkflowDao; | ||||
| @Resource | |||||
| private RayDao rayDao; | |||||
| @Resource | |||||
| private ActiveLearnDao activeLearnDao; | |||||
| /** | /** | ||||
| * 通过ID查询单条数据 | * 通过ID查询单条数据 | ||||
| * | * | ||||
| @@ -77,6 +77,20 @@ public class ImageVersionServiceImpl implements ImageVersionService { | |||||
| throw new Exception("该镜像版本被流水线:" + workflows + "使用,不能删除,请先删除流水线。"); | throw new Exception("该镜像版本被流水线:" + workflows + "使用,不能删除,请先删除流水线。"); | ||||
| } | } | ||||
| HashMap<String, String> map = new HashMap<>(); | |||||
| map.put("version", String.valueOf(id)); | |||||
| List<Ray> rayList = rayDao.queryByImageId(JSON.toJSONString(map)); | |||||
| if (rayList != null && !rayList.isEmpty()) { | |||||
| String rays = String.join(",", rayList.stream().map(Ray::getName).collect(Collectors.toSet())); | |||||
| throw new Exception("该镜像版本被超参数自动寻优:" + rays + "使用,不能删除,请先删除超参数自动寻优。"); | |||||
| } | |||||
| List<ActiveLearn> activeLearnList = activeLearnDao.queryByImageId(JSON.toJSONString(map)); | |||||
| if (activeLearnList != null && !activeLearnList.isEmpty()) { | |||||
| String activeLearns = String.join(",", activeLearnList.stream().map(ActiveLearn::getName).collect(Collectors.toSet())); | |||||
| throw new Exception("该镜像版本被主动学习:" + activeLearns + "使用,不能删除,请先删除主动学习。"); | |||||
| } | |||||
| //判断权限,只有admin和创建者本身可以删除该数据集 | //判断权限,只有admin和创建者本身可以删除该数据集 | ||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String username = loginUser.getUsername(); | String username = loginUser.getUsername(); | ||||
| @@ -9,10 +9,7 @@ import com.ruoyi.platform.annotations.CheckDuplicate; | |||||
| import com.ruoyi.platform.constant.Constant; | import com.ruoyi.platform.constant.Constant; | ||||
| import com.ruoyi.platform.domain.*; | import com.ruoyi.platform.domain.*; | ||||
| import com.ruoyi.platform.domain.dependencydomain.TrainTaskDepency; | import com.ruoyi.platform.domain.dependencydomain.TrainTaskDepency; | ||||
| import com.ruoyi.platform.mapper.AssetWorkflowDao; | |||||
| import com.ruoyi.platform.mapper.ModelDependency1Dao; | |||||
| import com.ruoyi.platform.mapper.ModelsDao; | |||||
| import com.ruoyi.platform.mapper.ModelsVersionDao; | |||||
| import com.ruoyi.platform.mapper.*; | |||||
| import com.ruoyi.platform.service.*; | import com.ruoyi.platform.service.*; | ||||
| import com.ruoyi.platform.utils.*; | import com.ruoyi.platform.utils.*; | ||||
| import com.ruoyi.platform.vo.*; | import com.ruoyi.platform.vo.*; | ||||
| @@ -67,7 +64,10 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| private ModelsDao modelsDao; | private ModelsDao modelsDao; | ||||
| @Resource | @Resource | ||||
| private ModelsVersionDao modelsVersionDao; | private ModelsVersionDao modelsVersionDao; | ||||
| @Resource | |||||
| private RayDao rayDao; | |||||
| @Resource | |||||
| private ActiveLearnDao activeLearnDao; | |||||
| @Resource | @Resource | ||||
| private ModelsVersionService modelsVersionService; | private ModelsVersionService modelsVersionService; | ||||
| @@ -1154,6 +1154,20 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| throw new Exception("该模型被流水线:" + workflows + "使用,不能删除,请先删除流水线。"); | throw new Exception("该模型被流水线:" + workflows + "使用,不能删除,请先删除流水线。"); | ||||
| } | } | ||||
| HashMap<String, String> queryMap = new HashMap<>(); | |||||
| queryMap.put("id", String.valueOf(repoId)); | |||||
| List<Ray> rayList = rayDao.queryByModelId(JSON.toJSONString(queryMap)); | |||||
| if (rayList != null && !rayList.isEmpty()) { | |||||
| String rays = String.join(",", rayList.stream().map(Ray::getName).collect(Collectors.toSet())); | |||||
| throw new Exception("该模型被超参数自动寻优:" + rays + "使用,不能删除,请先删除超参数自动寻优。"); | |||||
| } | |||||
| List<ActiveLearn> activeLearnList = activeLearnDao.queryByModelId(JSON.toJSONString(queryMap)); | |||||
| if (activeLearnList != null && !activeLearnList.isEmpty()) { | |||||
| String rays = String.join(",", activeLearnList.stream().map(ActiveLearn::getName).collect(Collectors.toSet())); | |||||
| throw new Exception("该模型被主动学习:" + rays + "使用,不能删除,请先删除主动学习。"); | |||||
| } | |||||
| String token = gitService.checkoutToken(); | String token = gitService.checkoutToken(); | ||||
| gitService.deleteProject(token, owner, identifier); | gitService.deleteProject(token, owner, identifier); | ||||
| //删除模型依赖 | //删除模型依赖 | ||||
| @@ -4,12 +4,11 @@ import com.alibaba.fastjson2.JSON; | |||||
| import com.ruoyi.common.core.utils.DateUtils; | import com.ruoyi.common.core.utils.DateUtils; | ||||
| import com.ruoyi.common.security.utils.SecurityUtils; | import com.ruoyi.common.security.utils.SecurityUtils; | ||||
| import com.ruoyi.platform.constant.Constant; | 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.*; | |||||
| import com.ruoyi.platform.mapper.ActiveLearnDao; | |||||
| import com.ruoyi.platform.mapper.AssetWorkflowDao; | import com.ruoyi.platform.mapper.AssetWorkflowDao; | ||||
| import com.ruoyi.platform.mapper.AutoMlDao; | import com.ruoyi.platform.mapper.AutoMlDao; | ||||
| import com.ruoyi.platform.mapper.RayDao; | |||||
| import com.ruoyi.platform.service.DatasetTempStorageService; | import com.ruoyi.platform.service.DatasetTempStorageService; | ||||
| import com.ruoyi.platform.service.GitService; | import com.ruoyi.platform.service.GitService; | ||||
| import com.ruoyi.platform.service.NewDatasetService; | import com.ruoyi.platform.service.NewDatasetService; | ||||
| @@ -56,6 +55,10 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||||
| private AssetWorkflowDao assetWorkflowDao; | private AssetWorkflowDao assetWorkflowDao; | ||||
| @Resource | @Resource | ||||
| private AutoMlDao autoMlDao; | private AutoMlDao autoMlDao; | ||||
| @Resource | |||||
| private RayDao rayDao; | |||||
| @Resource | |||||
| private ActiveLearnDao activeLearnDao; | |||||
| @Value("${spring.redis.host}") | @Value("${spring.redis.host}") | ||||
| private String redisHost; | private String redisHost; | ||||
| @@ -421,6 +424,18 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||||
| throw new Exception("该数据集被自动机器学习:" + autoMls + "使用,不能删除,请先删除自动机器学习。"); | throw new Exception("该数据集被自动机器学习:" + autoMls + "使用,不能删除,请先删除自动机器学习。"); | ||||
| } | } | ||||
| List<Ray> rayList = rayDao.queryByDatasetId(JSON.toJSONString(map)); | |||||
| if (rayList != null && !rayList.isEmpty()) { | |||||
| String rays = String.join(",", rayList.stream().map(Ray::getName).collect(Collectors.toSet())); | |||||
| throw new Exception("该数据集被超参数自动寻优:" + rays + "使用,不能删除,请先删除超参数自动寻优。"); | |||||
| } | |||||
| List<ActiveLearn> activeLearnList = activeLearnDao.queryByDatasetId(JSON.toJSONString(map)); | |||||
| if (activeLearnList != null && !activeLearnList.isEmpty()) { | |||||
| String activeLearns = String.join(",", activeLearnList.stream().map(ActiveLearn::getName).collect(Collectors.toSet())); | |||||
| throw new Exception("该数据集被主动学习:" + activeLearns + "使用,不能删除,请先删除主动学习。"); | |||||
| } | |||||
| String token = gitService.checkoutToken(); | String token = gitService.checkoutToken(); | ||||
| gitService.deleteProject(token, owner, repo); | gitService.deleteProject(token, owner, repo); | ||||
| @@ -446,6 +461,18 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||||
| throw new Exception("该数据集版本被自动机器学习:" + autoMls + "使用,不能删除,请先删除自动机器学习。"); | throw new Exception("该数据集版本被自动机器学习:" + autoMls + "使用,不能删除,请先删除自动机器学习。"); | ||||
| } | } | ||||
| List<Ray> rayList = rayDao.queryByDatasetId(JSON.toJSONString(map)); | |||||
| if (rayList != null && !rayList.isEmpty()) { | |||||
| String rays = String.join(",", rayList.stream().map(Ray::getName).collect(Collectors.toSet())); | |||||
| throw new Exception("该数据集版本被超参数自动寻优:" + rays + "使用,不能删除,请先删除超参数自动寻优。"); | |||||
| } | |||||
| List<ActiveLearn> activeLearnList = activeLearnDao.queryByDatasetId(JSON.toJSONString(map)); | |||||
| if (activeLearnList != null && !activeLearnList.isEmpty()) { | |||||
| String activeLearns = String.join(",", activeLearnList.stream().map(ActiveLearn::getName).collect(Collectors.toSet())); | |||||
| throw new Exception("该数据集版本被主动学习:" + activeLearns + "使用,不能删除,请先删除主动学习。"); | |||||
| } | |||||
| String token = gitService.checkoutToken(); | String token = gitService.checkoutToken(); | ||||
| String rootPath = Paths.get(localPathlocal + "/" + relativePath).getParent().toString(); | String rootPath = Paths.get(localPathlocal + "/" + relativePath).getParent().toString(); | ||||
| gitService.deleteBranch(token, owner, repo, version, rootPath); | gitService.deleteBranch(token, owner, repo, version, rootPath); | ||||
| @@ -24,8 +24,11 @@ public class ActiveLearnVo { | |||||
| @ApiModelProperty(value = "任务类型:classification, regression") | @ApiModelProperty(value = "任务类型:classification, regression") | ||||
| private String taskType; | private String taskType; | ||||
| @ApiModelProperty(value = "预训练模型") | |||||
| private Map<String,Object> model; | |||||
| @ApiModelProperty(value = "模型文件路径") | @ApiModelProperty(value = "模型文件路径") | ||||
| private Map<String,Object> modelPath; | |||||
| private String modelPy; | |||||
| @ApiModelProperty(value = "模型类名称") | @ApiModelProperty(value = "模型类名称") | ||||
| private String modelClassName; | private String modelClassName; | ||||
| @@ -37,17 +40,22 @@ public class ActiveLearnVo { | |||||
| private String regressorAlg; | private String regressorAlg; | ||||
| @ApiModelProperty(value = "dataset文件路径") | @ApiModelProperty(value = "dataset文件路径") | ||||
| private Map<String,Object> dataset; | |||||
| private String datasetPy; | |||||
| @ApiModelProperty(value = "dataset类名") | @ApiModelProperty(value = "dataset类名") | ||||
| private String datasetClassName; | private String datasetClassName; | ||||
| @ApiModelProperty(value = "数据集") | @ApiModelProperty(value = "数据集") | ||||
| private Map<String,Object> datasetPath; | |||||
| private Map<String,Object> dataset; | |||||
| @ApiModelProperty(value = "数据量") | @ApiModelProperty(value = "数据量") | ||||
| private Integer dataSize; | private Integer dataSize; | ||||
| @ApiModelProperty(value = "镜像") | |||||
| private Map<String,Object> image; | |||||
| private Integer computingResourceId; | |||||
| @ApiModelProperty(value = "是否随机打乱") | @ApiModelProperty(value = "是否随机打乱") | ||||
| private Boolean shuffle; | private Boolean shuffle; | ||||
| @@ -67,7 +75,7 @@ public class ActiveLearnVo { | |||||
| private String queryStrategy; | private String queryStrategy; | ||||
| @ApiModelProperty(value = "loss文件路径") | @ApiModelProperty(value = "loss文件路径") | ||||
| private Map<String,Object> lossPath; | |||||
| private String lossPy; | |||||
| @ApiModelProperty(value = "loss类名") | @ApiModelProperty(value = "loss类名") | ||||
| private String lossClassName; | private String lossClassName; | ||||
| @@ -2,14 +2,17 @@ | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.ruoyi.platform.mapper.ActiveLearnDao"> | <mapper namespace="com.ruoyi.platform.mapper.ActiveLearnDao"> | ||||
| <insert id="save"> | <insert id="save"> | ||||
| insert into active_learn(name, description, task_type, model_path, model_class_name, classifier_alg, | |||||
| regressor_alg, dataset, dataset_class_name, dataset_path, data_size, | |||||
| insert into active_learn(name, description, task_type, model, model_py, model_class_name, classifier_alg, | |||||
| regressor_alg, dataset_py, dataset_class_name, dataset, data_size, image, | |||||
| computing_resource_id, | |||||
| shuffle, train_size, n_initial, n_queries, n_instances, query_strategy, | shuffle, train_size, n_initial, n_queries, n_instances, query_strategy, | ||||
| loss_path, loss_class_name, n_checkpoint, batch_size, epochs, lr, create_by, update_by) | loss_path, loss_class_name, n_checkpoint, batch_size, epochs, lr, create_by, update_by) | ||||
| values (#{activeLearn.name}, #{activeLearn.description}, #{activeLearn.taskType}, #{activeLearn.modelPath}, | |||||
| values (#{activeLearn.name}, #{activeLearn.description}, #{activeLearn.taskType}, #{activeLearn.model}, | |||||
| #{activeLearn.modelPy}, | |||||
| #{activeLearn.modelClassName}, #{activeLearn.classifierAlg}, #{activeLearn.regressorAlg}, | #{activeLearn.modelClassName}, #{activeLearn.classifierAlg}, #{activeLearn.regressorAlg}, | ||||
| #{activeLearn.dataset}, #{activeLearn.datasetClassName}, #{activeLearn.datasetPath}, | |||||
| #{activeLearn.dataSize}, #{activeLearn.shuffle}, #{activeLearn.trainSize}, | |||||
| #{activeLearn.datasetPy}, #{activeLearn.datasetClassName}, #{activeLearn.dataset}, | |||||
| #{activeLearn.dataSize}, #{activeLearn.image}, #{activeLearn.computingResourceId}, | |||||
| #{activeLearn.shuffle}, #{activeLearn.trainSize}, | |||||
| #{activeLearn.nInitial}, #{activeLearn.nQueries}, #{activeLearn.nInstances}, | #{activeLearn.nInitial}, #{activeLearn.nQueries}, #{activeLearn.nInstances}, | ||||
| #{activeLearn.queryStrategy}, | #{activeLearn.queryStrategy}, | ||||
| #{activeLearn.lossPath}, #{activeLearn.lossClassName}, #{activeLearn.nCheckpoint}, | #{activeLearn.lossPath}, #{activeLearn.lossClassName}, #{activeLearn.nCheckpoint}, | ||||
| @@ -29,8 +32,11 @@ | |||||
| <if test="activeLearn.taskType != null and activeLearn.taskType !=''"> | <if test="activeLearn.taskType != null and activeLearn.taskType !=''"> | ||||
| task_type = #{activeLearn.taskType}, | task_type = #{activeLearn.taskType}, | ||||
| </if> | </if> | ||||
| <if test="activeLearn.modelPath != null and activeLearn.modelPath !=''"> | |||||
| model_path = #{activeLearn.modelPath}, | |||||
| <if test="activeLearn.model != null and activeLearn.model !=''"> | |||||
| model = #{activeLearn.model}, | |||||
| </if> | |||||
| <if test="activeLearn.modelPy != null and activeLearn.modelPy !=''"> | |||||
| model_py = #{activeLearn.modelPy}, | |||||
| </if> | </if> | ||||
| <if test="activeLearn.modelClassName != null and activeLearn.modelClassName !=''"> | <if test="activeLearn.modelClassName != null and activeLearn.modelClassName !=''"> | ||||
| model_class_name = #{activeLearn.modelClassName}, | model_class_name = #{activeLearn.modelClassName}, | ||||
| @@ -41,18 +47,24 @@ | |||||
| <if test="activeLearn.regressorAlg != null and activeLearn.regressorAlg !=''"> | <if test="activeLearn.regressorAlg != null and activeLearn.regressorAlg !=''"> | ||||
| regressor_alg = #{activeLearn.regressorAlg}, | regressor_alg = #{activeLearn.regressorAlg}, | ||||
| </if> | </if> | ||||
| <if test="activeLearn.dataset != null and activeLearn.dataset !=''"> | |||||
| dataset = #{activeLearn.dataset}, | |||||
| <if test="activeLearn.datasetPy != null and activeLearn.datasetPy !=''"> | |||||
| dataset_py = #{activeLearn.datasetPy}, | |||||
| </if> | </if> | ||||
| <if test="activeLearn.datasetClassName != null and activeLearn.datasetClassName !=''"> | <if test="activeLearn.datasetClassName != null and activeLearn.datasetClassName !=''"> | ||||
| dataset_class_name = #{activeLearn.datasetClassName}, | dataset_class_name = #{activeLearn.datasetClassName}, | ||||
| </if> | </if> | ||||
| <if test="activeLearn.datasetPath != null and activeLearn.datasetPath !=''"> | |||||
| dataset_path = #{activeLearn.datasetPath}, | |||||
| <if test="activeLearn.dataset != null and activeLearn.dataset !=''"> | |||||
| dataset = #{activeLearn.dataset}, | |||||
| </if> | </if> | ||||
| <if test="activeLearn.dataSize != null"> | <if test="activeLearn.dataSize != null"> | ||||
| data_size = #{activeLearn.dataSize}, | data_size = #{activeLearn.dataSize}, | ||||
| </if> | </if> | ||||
| <if test="activeLearn.image != null and activeLearn.image !=''"> | |||||
| image = #{activeLearn.image}, | |||||
| </if> | |||||
| <if test="activeLearn.computingResourceId != null"> | |||||
| computing_resource_id = #{activeLearn.computingResourceId}, | |||||
| </if> | |||||
| <if test="activeLearn.shuffle != null"> | <if test="activeLearn.shuffle != null"> | ||||
| shuffle = #{activeLearn.shuffle}, | shuffle = #{activeLearn.shuffle}, | ||||
| </if> | </if> | ||||
| @@ -125,6 +137,27 @@ | |||||
| where id = #{id} | where id = #{id} | ||||
| </select> | </select> | ||||
| <select id="queryByDatasetId" resultType="com.ruoyi.platform.domain.ActiveLearn"> | |||||
| select * | |||||
| from active_learn | |||||
| where JSON_CONTAINS(dataset, #{datasetId}) | |||||
| and state = 1 | |||||
| </select> | |||||
| <select id="queryByModelId" resultType="com.ruoyi.platform.domain.ActiveLearn"> | |||||
| select * | |||||
| from active_learn | |||||
| where JSON_CONTAINS(model, #{modelId}) | |||||
| and state = 1 | |||||
| </select> | |||||
| <select id="queryByImageId" resultType="com.ruoyi.platform.domain.ActiveLearn"> | |||||
| select * | |||||
| from active_learn | |||||
| where JSON_CONTAINS(image, #{imageId}) | |||||
| and state = 1 | |||||
| </select> | |||||
| <sql id="common_condition"> | <sql id="common_condition"> | ||||
| <where> | <where> | ||||
| state = 1 | state = 1 | ||||
| @@ -109,6 +109,33 @@ | |||||
| where id = #{id} | where id = #{id} | ||||
| </select> | </select> | ||||
| <select id="queryByDatasetId" resultType="com.ruoyi.platform.domain.Ray"> | |||||
| select * | |||||
| from ray | |||||
| where JSON_CONTAINS(dataset, #{datasetId}) | |||||
| and state = 1 | |||||
| </select> | |||||
| <select id="queryByModelId" resultType="com.ruoyi.platform.domain.Ray"> | |||||
| select * | |||||
| from ray | |||||
| where JSON_CONTAINS(model, #{modelId}) | |||||
| and state = 1 | |||||
| </select> | |||||
| <select id="queryByImageId" resultType="com.ruoyi.platform.domain.Ray"> | |||||
| select * | |||||
| from ray | |||||
| where JSON_CONTAINS(image, #{imageId}) | |||||
| and state = 1 | |||||
| </select> | |||||
| <select id="queryByCodeConfig" resultType="com.ruoyi.platform.domain.Ray"> | |||||
| select * | |||||
| from ray | |||||
| where JSON_CONTAINS( | |||||
| </select> | |||||
| <sql id="common_condition"> | <sql id="common_condition"> | ||||
| <where> | <where> | ||||
| state = 1 | state = 1 | ||||