| @@ -0,0 +1,29 @@ | |||||
| package com.ruoyi.platform.domain; | |||||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | |||||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||||
| @Data | |||||
| public class DatasetDependency implements Serializable { | |||||
| private Long id; | |||||
| private String parentDataset; | |||||
| private String datasetName; | |||||
| private String version; | |||||
| private Integer repoId; | |||||
| private String identifier; | |||||
| private String owner; | |||||
| private Integer state; | |||||
| private String meta; | |||||
| } | |||||
| @@ -0,0 +1,7 @@ | |||||
| package com.ruoyi.platform.mapper; | |||||
| import com.ruoyi.platform.domain.DatasetDependency; | |||||
| public interface DatasetDependencyDao { | |||||
| int insert(DatasetDependency datasetDependency); | |||||
| } | |||||
| @@ -80,5 +80,7 @@ public interface DatasetTempStorageDao { | |||||
| int deleteById(Integer id); | int deleteById(Integer id); | ||||
| DatasetTempStorage queryByDatasetTempStorage(DatasetTempStorage datasetTempStorage); | DatasetTempStorage queryByDatasetTempStorage(DatasetTempStorage datasetTempStorage); | ||||
| DatasetTempStorage queryByInsId(@Param("insId") String insId); | |||||
| } | } | ||||
| @@ -2,8 +2,10 @@ package com.ruoyi.platform.service.impl; | |||||
| import com.alibaba.fastjson2.JSON; | import com.alibaba.fastjson2.JSON; | ||||
| import com.ruoyi.common.security.utils.SecurityUtils; | import com.ruoyi.common.security.utils.SecurityUtils; | ||||
| import com.ruoyi.platform.domain.DatasetTempStorage; | |||||
| import com.ruoyi.platform.domain.ExperimentIns; | import com.ruoyi.platform.domain.ExperimentIns; | ||||
| import com.ruoyi.platform.domain.ModelDependency1; | import com.ruoyi.platform.domain.ModelDependency1; | ||||
| import com.ruoyi.platform.mapper.DatasetTempStorageDao; | |||||
| import com.ruoyi.platform.mapper.ExperimentDao; | import com.ruoyi.platform.mapper.ExperimentDao; | ||||
| import com.ruoyi.platform.mapper.ExperimentInsDao; | import com.ruoyi.platform.mapper.ExperimentInsDao; | ||||
| import com.ruoyi.platform.mapper.ModelDependency1Dao; | import com.ruoyi.platform.mapper.ModelDependency1Dao; | ||||
| @@ -70,6 +72,9 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| @Resource | @Resource | ||||
| private ModelDependency1Dao modelDependency1Dao; | private ModelDependency1Dao modelDependency1Dao; | ||||
| @Resource | |||||
| private DatasetTempStorageDao datasetTempStorageDao; | |||||
| private final MinioUtil minioUtil; | private final MinioUtil minioUtil; | ||||
| public ExperimentInsServiceImpl(MinioUtil minioUtil) { | public ExperimentInsServiceImpl(MinioUtil minioUtil) { | ||||
| @@ -447,8 +452,15 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| break; | break; | ||||
| } | } | ||||
| //删除导出数据集版本 todo | //删除导出数据集版本 todo | ||||
| // String relativePath = ci4sUsername + "/datasets/" + dataset.get("id") + "/" + dataset.get("identifier") + "/" + version + "/dataset"; | |||||
| // newDatasetService.deleteDatasetVersionNew((String) dataset.get("identifier"), (String) dataset.get("owner"), version, relativePath); | |||||
| if (key.contains("dataset-export")) { | |||||
| HashMap queryMap = new HashMap<String, Integer>(); | |||||
| queryMap.put("insId", experimentIns.getId()); | |||||
| DatasetTempStorage datasetTempStorage = datasetTempStorageDao.queryByInsId(JSON.toJSONString(queryMap)); | |||||
| Map<String, Object> source = JsonUtils.jsonToMap(datasetTempStorage.getSource()); | |||||
| String relativePath = ci4sUsername + "/datasets/" + source.get("repo_id") + "/" + source.get("identifier") + "/" + source.get("version") + "/dataset"; | |||||
| newDatasetService.deleteDatasetVersionNew((String) source.get("identifier"), (String) source.get("owner"), (String) source.get("version"), relativePath); | |||||
| break; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -482,6 +482,16 @@ public class ExperimentServiceImpl implements ExperimentService { | |||||
| sourceParams.put("train_name", sourceTaskId); | sourceParams.put("train_name", sourceTaskId); | ||||
| sourceParams.put("preprocess_code", projectMap); | sourceParams.put("preprocess_code", projectMap); | ||||
| sourceParams.put("workflow_id", workflowId); | sourceParams.put("workflow_id", workflowId); | ||||
| ArrayList<Map<String, Object>> sourceDatasets = (ArrayList<Map<String, Object>>) datasetPreprocessMap.get("datasets"); | |||||
| if (sourceDatasets != null && sourceDatasets.size() > 0) { | |||||
| Map<String, Object> dataset = sourceDatasets.get(0); | |||||
| sourceParams.put("repo_id", dataset.get("dataset_id")); | |||||
| sourceParams.put("identifier", dataset.get("dataset_identifier")); | |||||
| sourceParams.put("version", dataset.get("dataset_version")); | |||||
| sourceParams.put("owner", dataset.get("owner")); | |||||
| } | |||||
| if (target != null && target.size() > 0) { | if (target != null && target.size() > 0) { | ||||
| for (Map<String, Object> targetMap : target) { | for (Map<String, Object> targetMap : target) { | ||||
| String targetTaskId = (String) targetMap.get("task_id"); | String targetTaskId = (String) targetMap.get("task_id"); | ||||
| @@ -0,0 +1,10 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.ruoyi.platform.mapper.DatasetDependencyDao"> | |||||
| <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | |||||
| insert into dataset_dependcy(parent_dataset, dataset_name, version, repo_id, identifier, owner, meta, state) | |||||
| values (#{parentDataset}, #{datasetName}, #{version}, #{repoId}, #{identifier}, #{owner}, #{meta}, #{state}) | |||||
| </insert> | |||||
| </mapper> | |||||
| @@ -131,6 +131,13 @@ | |||||
| </where> | </where> | ||||
| </select> | </select> | ||||
| <select id="queryByInsId" resultType="com.ruoyi.platform.domain.DatasetTempStorage"> | |||||
| select * | |||||
| from dataset_temp_storage | |||||
| where JSON_CONTAINS(source, #{insId}) | |||||
| order by id desc limit 1 | |||||
| </select> | |||||
| <!--新增所有列--> | <!--新增所有列--> | ||||
| <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | ||||
| insert into dataset_temp_storage(name, version, source, state, create_by, create_time, update_by, update_time) | insert into dataset_temp_storage(name, version, source, state, create_by, create_time, update_by, update_time) | ||||