Browse Source

主动学习实验功能开发

dev-active_learn
chenzhihang 10 months ago
parent
commit
43a8d3daec
12 changed files with 227 additions and 72 deletions
  1. +12
    -4
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ActiveLearn.java
  2. +9
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ActiveLearnDao.java
  3. +8
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/RayDao.java
  4. +14
    -25
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ActiveLearnServiceImpl.java
  5. +8
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/CodeConfigServiceImpl.java
  6. +21
    -10
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ImageServiceImpl.java
  7. +22
    -8
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ImageVersionServiceImpl.java
  8. +19
    -5
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java
  9. +31
    -4
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java
  10. +12
    -4
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/ActiveLearnVo.java
  11. +44
    -11
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ActiveLearnDaoMapper.xml
  12. +27
    -0
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/RayDaoMapper.xml

+ 12
- 4
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ActiveLearn.java View File

@@ -23,8 +23,11 @@ public class ActiveLearn {
@ApiModelProperty(value = "任务类型:classification, regression")
private String taskType;

@ApiModelProperty(value = "预训练模型")
private String model;

@ApiModelProperty(value = "模型文件路径")
private String modelPath;
private String modelPy;

@ApiModelProperty(value = "模型类名称")
private String modelClassName;
@@ -36,17 +39,22 @@ public class ActiveLearn {
private String regressorAlg;

@ApiModelProperty(value = "dataset文件路径")
private String dataset;
private String datasetPy;

@ApiModelProperty(value = "dataset类名")
private String datasetClassName;

@ApiModelProperty(value = "数据集文件路径")
private String datasetPath;
private String dataset;

@ApiModelProperty(value = "数据量")
private Integer dataSize;

@ApiModelProperty(value = "镜像")
private String image;

private Integer computingResourceId;

@ApiModelProperty(value = "是否随机打乱")
private Boolean shuffle;

@@ -66,7 +74,7 @@ public class ActiveLearn {
private String queryStrategy;

@ApiModelProperty(value = "loss文件路径")
private String lossPath;
private String lossPy;

@ApiModelProperty(value = "loss类名")
private String lossClassName;


+ 9
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ActiveLearnDao.java View File

@@ -11,11 +11,19 @@ public interface ActiveLearnDao {

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 edit(@Param("activeLearn") ActiveLearn activeLearn);

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

+ 8
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/RayDao.java View File

@@ -18,4 +18,12 @@ public interface RayDao {
int save(@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);
}

+ 14
- 25
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ActiveLearnServiceImpl.java View File

@@ -43,14 +43,9 @@ public class ActiveLearnServiceImpl implements ActiveLearnService {
activeLearn.setCreateBy(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);
return activeLearn;
@@ -68,14 +63,9 @@ public class ActiveLearnServiceImpl implements ActiveLearnService {
String username = SecurityUtils.getLoginUser().getUsername();
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);

@@ -87,17 +77,17 @@ public class ActiveLearnServiceImpl implements ActiveLearnService {
ActiveLearn activeLearn = activeLearnDao.getActiveLearnById(id);
ActiveLearnVo activeLearnVo = new 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())) {
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;
}
@@ -126,10 +116,9 @@ public class ActiveLearnServiceImpl implements ActiveLearnService {

ActiveLearnVo activeLearnParam = new ActiveLearnVo();
BeanUtils.copyProperties(activeLearn, activeLearnParam);
activeLearnParam.setDatasetPath(JsonUtils.jsonToMap(activeLearn.getDatasetPath()));
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);



+ 8
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/CodeConfigServiceImpl.java View File

@@ -4,8 +4,10 @@ import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.platform.constant.Constant;
import com.ruoyi.platform.domain.AssetWorkflow;
import com.ruoyi.platform.domain.CodeConfig;
import com.ruoyi.platform.mapper.ActiveLearnDao;
import com.ruoyi.platform.mapper.AssetWorkflowDao;
import com.ruoyi.platform.mapper.CodeConfigDao;
import com.ruoyi.platform.mapper.RayDao;
import com.ruoyi.platform.service.CodeConfigService;
import com.ruoyi.system.api.model.LoginUser;
import org.apache.commons.lang3.StringUtils;
@@ -26,6 +28,10 @@ public class CodeConfigServiceImpl implements CodeConfigService {
private CodeConfigDao codeConfigDao;
@Resource
private AssetWorkflowDao assetWorkflowDao;
@Resource
private RayDao rayDao;
@Resource
private ActiveLearnDao activeLearnDao;

@Override
public Page<CodeConfig> queryByPage(CodeConfig codeConfig, PageRequest pageRequest) {
@@ -88,6 +94,8 @@ public class CodeConfigServiceImpl implements CodeConfigService {
throw new Exception("该代码配置被流水线:" + workflows + "使用,不能删除,请先删除流水线。");
}

// rayDao.queryByCodeConfig()

LoginUser loginUser = SecurityUtils.getLoginUser();
String username = loginUser.getUsername();
String createBy = codeConfig.getCreateBy();


+ 21
- 10
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ImageServiceImpl.java View File

@@ -1,16 +1,11 @@
package com.ruoyi.platform.service.impl;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.util.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.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.ImageVersionService;
import com.ruoyi.platform.service.MinioService;
@@ -53,10 +48,12 @@ public class ImageServiceImpl implements ImageService {
private ImageVersionDao imageVersionDao;
@Resource
private DevEnvironmentDao devEnvironmentDao;

@Resource
private AssetWorkflowDao assetWorkflowDao;

@Resource
private RayDao rayDao;
@Resource
private ActiveLearnDao activeLearnDao;
@Resource
private ImageVersionService imageVersionService;

@@ -182,6 +179,20 @@ public class ImageServiceImpl implements ImageService {
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和创建者本身可以删除该数据集
LoginUser loginUser = SecurityUtils.getLoginUser();
String username = loginUser.getUsername();


+ 22
- 8
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ImageVersionServiceImpl.java View File

@@ -1,13 +1,10 @@
package com.ruoyi.platform.service.impl;

import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.security.utils.SecurityUtils;
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.system.api.model.LoginUser;
import org.apache.commons.lang3.StringUtils;
@@ -18,6 +15,7 @@ import org.springframework.data.domain.PageRequest;

import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;

@@ -31,10 +29,12 @@ import java.util.stream.Collectors;
public class ImageVersionServiceImpl implements ImageVersionService {
@Resource
private ImageVersionDao imageVersionDao;

@Resource
private AssetWorkflowDao assetWorkflowDao;

@Resource
private RayDao rayDao;
@Resource
private ActiveLearnDao activeLearnDao;
/**
* 通过ID查询单条数据
*
@@ -77,6 +77,20 @@ public class ImageVersionServiceImpl implements ImageVersionService {
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和创建者本身可以删除该数据集
LoginUser loginUser = SecurityUtils.getLoginUser();
String username = loginUser.getUsername();


+ 19
- 5
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java View File

@@ -9,10 +9,7 @@ import com.ruoyi.platform.annotations.CheckDuplicate;
import com.ruoyi.platform.constant.Constant;
import com.ruoyi.platform.domain.*;
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.utils.*;
import com.ruoyi.platform.vo.*;
@@ -67,7 +64,10 @@ public class ModelsServiceImpl implements ModelsService {
private ModelsDao modelsDao;
@Resource
private ModelsVersionDao modelsVersionDao;

@Resource
private RayDao rayDao;
@Resource
private ActiveLearnDao activeLearnDao;
@Resource
private ModelsVersionService modelsVersionService;

@@ -1154,6 +1154,20 @@ public class ModelsServiceImpl implements ModelsService {
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();
gitService.deleteProject(token, owner, identifier);
//删除模型依赖


+ 31
- 4
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java View File

@@ -4,12 +4,11 @@ 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.*;
import com.ruoyi.platform.mapper.ActiveLearnDao;
import com.ruoyi.platform.mapper.AssetWorkflowDao;
import com.ruoyi.platform.mapper.AutoMlDao;
import com.ruoyi.platform.mapper.RayDao;
import com.ruoyi.platform.service.DatasetTempStorageService;
import com.ruoyi.platform.service.GitService;
import com.ruoyi.platform.service.NewDatasetService;
@@ -56,6 +55,10 @@ public class NewDatasetServiceImpl implements NewDatasetService {
private AssetWorkflowDao assetWorkflowDao;
@Resource
private AutoMlDao autoMlDao;
@Resource
private RayDao rayDao;
@Resource
private ActiveLearnDao activeLearnDao;

@Value("${spring.redis.host}")
private String redisHost;
@@ -421,6 +424,18 @@ public class NewDatasetServiceImpl implements NewDatasetService {
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();
gitService.deleteProject(token, owner, repo);

@@ -446,6 +461,18 @@ public class NewDatasetServiceImpl implements NewDatasetService {
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 rootPath = Paths.get(localPathlocal + "/" + relativePath).getParent().toString();
gitService.deleteBranch(token, owner, repo, version, rootPath);


+ 12
- 4
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/ActiveLearnVo.java View File

@@ -24,8 +24,11 @@ public class ActiveLearnVo {
@ApiModelProperty(value = "任务类型:classification, regression")
private String taskType;

@ApiModelProperty(value = "预训练模型")
private Map<String,Object> model;

@ApiModelProperty(value = "模型文件路径")
private Map<String,Object> modelPath;
private String modelPy;

@ApiModelProperty(value = "模型类名称")
private String modelClassName;
@@ -37,17 +40,22 @@ public class ActiveLearnVo {
private String regressorAlg;

@ApiModelProperty(value = "dataset文件路径")
private Map<String,Object> dataset;
private String datasetPy;

@ApiModelProperty(value = "dataset类名")
private String datasetClassName;

@ApiModelProperty(value = "数据集")
private Map<String,Object> datasetPath;
private Map<String,Object> dataset;

@ApiModelProperty(value = "数据量")
private Integer dataSize;

@ApiModelProperty(value = "镜像")
private Map<String,Object> image;

private Integer computingResourceId;

@ApiModelProperty(value = "是否随机打乱")
private Boolean shuffle;

@@ -67,7 +75,7 @@ public class ActiveLearnVo {
private String queryStrategy;

@ApiModelProperty(value = "loss文件路径")
private Map<String,Object> lossPath;
private String lossPy;

@ApiModelProperty(value = "loss类名")
private String lossClassName;


+ 44
- 11
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ActiveLearnDaoMapper.xml View File

@@ -2,14 +2,17 @@
<!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">
<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,
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.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.queryStrategy},
#{activeLearn.lossPath}, #{activeLearn.lossClassName}, #{activeLearn.nCheckpoint},
@@ -29,8 +32,11 @@
<if test="activeLearn.taskType != null and activeLearn.taskType !=''">
task_type = #{activeLearn.taskType},
</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 test="activeLearn.modelClassName != null and activeLearn.modelClassName !=''">
model_class_name = #{activeLearn.modelClassName},
@@ -41,18 +47,24 @@
<if test="activeLearn.regressorAlg != null and activeLearn.regressorAlg !=''">
regressor_alg = #{activeLearn.regressorAlg},
</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 test="activeLearn.datasetClassName != null and activeLearn.datasetClassName !=''">
dataset_class_name = #{activeLearn.datasetClassName},
</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 test="activeLearn.dataSize != null">
data_size = #{activeLearn.dataSize},
</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">
shuffle = #{activeLearn.shuffle},
</if>
@@ -125,6 +137,27 @@
where id = #{id}
</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">
<where>
state = 1


+ 27
- 0
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/RayDaoMapper.xml View File

@@ -109,6 +109,33 @@
where id = #{id}
</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">
<where>
state = 1


Loading…
Cancel
Save