Compare commits

...

4 Commits

Author SHA1 Message Date
b953e85704 数据集新增及修改功能版本1.0 2025-05-13 21:40:14 +08:00
syc
23be873a7c 上传文件至 doc 2025-05-12 21:49:23 +08:00
dc
fa6858e2ab Add database documentation 2025-05-12 20:47:04 +08:00
80b70dfe7d [提交]:数据库设计文档 2025-05-12 19:38:53 +08:00
14 changed files with 380 additions and 0 deletions

View File

@ -0,0 +1,9 @@
&zwnj;**<span style="font-size:14pt">TableName: Gpu_Resource</span>**&zwnj;
| <20>ֶ<EFBFBD><D6B6><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | Լ<><D4BC> | <20>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD> |
|:-------------:|:-------------:|:-----------------:|:----------------------------------:|
| GPUId | BIGINT | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | GPU<50><55>ID<49><44>ȫ<EFBFBD><C8AB>Ψһ<CEA8><D2BB>ʶ |
| GPUModel | VARCHAR(64) | NOT NULL | GPU<50><55><EFBFBD>ͺ<EFBFBD> |
| GPUMemorySize | INT | NOT NULL | GPU<50>ڴ<EFBFBD><DAB4><EFBFBD>С |
| Ip | VARCHAR(15) | NOT NULL | GPU<50><55><EFBFBD><EFBFBD>ip |
| CreatedTime | DATETIME | NOT NULL | GPU<50><55><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> |

View File

@ -0,0 +1,45 @@
# 数据库设计文档
## 模型构建单元部件
### 模型评估单元
#### 1.model_info模型信息表
| 序号 | 数据表名 | 中文名称 |
| ---- | ---------- | ------------------ |
| 1 | id | 模型id唯一主键 |
| 2 | model_name | 模型名称 |
#### 2.model_log日志表
| 序号 | 数据表名 | 中文名称 |
| ---- | -------- | ------------------ |
| 1 | id | 日志id唯一主键 |
| 2 | model_id | 关联模型id |
| 3 | log_type | 日志类型 |
| 4 | log_path | 日志存储路径 |
| 5 | log_time | 日志生成时间 |
#### 3.model_evaluation模型评估记录表
| 序号 | 数据表名 | 中文名称 |
| ---- | ----------------- | ---------------------- |
| 1 | id | 评估记录id唯一主键 |
| 2 | model_id | 关联模型id |
| 3 | evaluation_time | 评估时间 |
| 4 | evaluation_result | 评估结果 |
| 5 | operator | 评估操作人员 |
#### 4.model_version(模型版本信息)
| 序号 | 数据表名 | 中文名称 |
| ---- | ------------ | ---------------------------------- |
| 1 | id | 版本信息表id唯一主键 |
| 2 | model_id | 关联模型id |
| 3 | version | 模型版本 |
| 4 | dataset_id | 数据集id |
| 5 | model_config | 模型配置信息 |
| 6 | model_path | 模型存储路径 |
| 7 | status | 模型状态1代表上线0代表不上线 |
| 8 | create_time | 创建时间 |

View File

@ -0,0 +1,39 @@
# 算法生命周期管理数据库设计文档
## 1. 数据表设计
### 1.1 algorithm_info算法基础信息表
| 字段名 | 类型 | 是否为空 | 默认值 | 说明 |
|--------|------|----------|--------|------|
| id | BIGINT | NOT NULL | AUTO_INCREMENT | 主键ID |
| algorithm_name | VARCHAR(100) | NOT NULL | | 算法名称(唯一) |
| algorithm_type | VARCHAR(50) | NOT NULL | | 算法分类 |
| description | TEXT | NULL | | 算法描述 |
| created_by | VARCHAR(50) | NOT NULL | | 创建人 |
| create_time | DATETIME | NOT NULL | CURRENT_TIMESTAMP | 创建时间 |
| update_time | DATETIME | NOT NULL | CURRENT_TIMESTAMP ON UPDATE | 更新时间 |
| status | TINYINT | NOT NULL | 1 | 状态(1启用 0禁用 -1删除) |
### 1.2 algorithm_version算法版本表
| 字段名 | 类型 | 是否为空 | 默认值 | 说明 |
|--------|------|----------|--------|------|
| id | BIGINT | NOT NULL | AUTO_INCREMENT | 版本ID |
| algorithm_id | BIGINT | NOT NULL | | 关联算法ID |
| version | VARCHAR(50) | NOT NULL | | 语义版本号 |
| version_desc | TEXT | NULL | | 版本说明 |
| storage_path | VARCHAR(255) | NOT NULL | | 存储路径 |
| config_params | JSON | NULL | | 配置参数 |
| creator | VARCHAR(50) | NOT NULL | | 创建人 |
| create_time | DATETIME | NOT NULL | CURRENT_TIMESTAMP | 创建时间 |
| status | TINYINT | NOT NULL | 0 | 状态(1发布 0开发 -1废弃) |
### 1.3 algorithm_dependency算法依赖表
| 字段名 | 类型 | 是否为空 | 默认值 | 说明 |
|--------|------|----------|--------|------|
| id | BIGINT | NOT NULL | AUTO_INCREMENT | 依赖ID |
| algorithm_id | BIGINT | NOT NULL | | 关联算法ID |
| version_id | BIGINT | NOT NULL | | 关联版本ID |
| dependency_type | VARCHAR(50) | NOT NULL | | 依赖类型 |
| dep_name | VARCHAR(100) | NOT NULL | | 依赖名称 |
| dep_version | VARCHAR(50) | NOT NULL | | 依赖版本 |
| create_time | DATETIME | NULL | CURRENT_TIMESTAMP | 创建时间 |

11
pom.xml
View File

@ -54,6 +54,17 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.4</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>3.0.4</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -0,0 +1,43 @@
package com.bipt.intelligentapplicationorchestrationservice.controller;
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetDTO;
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetEntity;
import com.bipt.intelligentapplicationorchestrationservice.pojo.OptResult;
import com.bipt.intelligentapplicationorchestrationservice.service.DatasetService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/dataset")
@Slf4j
public class DatasetController {
@Autowired
private DatasetService datasetService;
/**
* 新增数据集
* @param datasetDTO
* @return
*/
@PostMapping
public OptResult save(@RequestBody DatasetDTO datasetDTO) {
log.info("新增数据集:{}", datasetDTO);
datasetService.save(datasetDTO);
return OptResult.success();
}
/**
* 修改数据集
* @param datasetEntity
* @return
*/
@PutMapping
public OptResult update(@RequestBody DatasetEntity datasetEntity){
log.info("修改数据集",datasetEntity);
datasetService.update(datasetEntity);
return OptResult.success();
}
}

View File

@ -0,0 +1,27 @@
package com.bipt.intelligentapplicationorchestrationservice.enumeration;
import org.apache.ibatis.annotations.Delete;
/**
* 数据库操作类型
*/
public enum OperationType {
/**
* 更新操作
*/
UPDATE,
/**
* 插入操作
*/
INSERT,
/**
* 删除操作
*/
DELETE,
/**
* 查询操作
*/
SELECT
}

View File

@ -0,0 +1,13 @@
package com.bipt.intelligentapplicationorchestrationservice.mapper;
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import java.util.Map;
@Mapper
public interface DatasetMapper {
void updata(DatasetEntity datasetEntity);
}

View File

@ -0,0 +1,17 @@
package com.bipt.intelligentapplicationorchestrationservice.pojo;
import lombok.Data;
import java.io.Serializable;
import java.util.Map;
/**
* @author hky
*/
@Data
public class DatasetDTO implements Serializable {
private Integer datasetId;
private String datasetName;
private Integer datasetType;
private Map<String,String> args;
}

View File

@ -0,0 +1,28 @@
package com.bipt.intelligentapplicationorchestrationservice.pojo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Map;
/**
* @author hky
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DatasetEntity implements Serializable {
private Integer datasetId;
private String datasetName;
private Integer datasetType;
private Integer datasetStatus;
private String dsPath;
private Map<String,String> args;
private LocalDateTime createTime;
private LocalDateTime updateTime;
}

View File

@ -0,0 +1,40 @@
package com.bipt.intelligentapplicationorchestrationservice.pojo;
import lombok.Data;
import java.io.Serializable;
/**
* 后端统一返回结果
* @author hky
* @param <T>
*/
@Data
public class OptResult<T> implements Serializable {
private boolean isSuccess;
private String errorInfo;
private int statusCode;
private T data;
public static <T> OptResult<T> success() {
OptResult<T> result = new OptResult<>();
result.isSuccess = true;
return result;
}
public static <T> OptResult<T> success(T object) {
OptResult<T> result = new OptResult<>();
result.data = object;
result.isSuccess = true;
return result;
}
public static <T> OptResult<T> error(String errorInfo) {
OptResult result = new OptResult();
result.errorInfo = errorInfo;
result.isSuccess = false;
return result;
}
}

View File

@ -0,0 +1,11 @@
package com.bipt.intelligentapplicationorchestrationservice.service;
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetDTO;
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetEntity;
import org.springframework.stereotype.Service;
public interface DatasetService {
void save(DatasetDTO datasetDTO);
void update(DatasetEntity datasetEntity);
}

View File

@ -0,0 +1,61 @@
package com.bipt.intelligentapplicationorchestrationservice.service.Impl;
import com.bipt.intelligentapplicationorchestrationservice.mapper.DatasetMapper;
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetDTO;
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetEntity;
import com.bipt.intelligentapplicationorchestrationservice.service.DatasetService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.Map;
@Service
@Slf4j
public class DatasetServiceImpl implements DatasetService {
@Autowired
private DatasetMapper datasetMapper;
/**
* 新增数据集
* @param datasetDTO
*/
@Override
public void save(DatasetDTO datasetDTO) {
//判断数据集类型,如果是本地上传则保存,若用调用数据仓库进入下一步
if (datasetDTO.getDatasetType()==0){
//TODO 保存到分布式文件系统
}else {
Map<String,String> args = datasetDTO.getArgs();
Integer datasetType = datasetDTO.getDatasetType();
//TODO 根据筛选条件调用数据仓库中的数据
//TODO 调用数据仓库保存到分布式文件系统
}
}
/**
* 修改数据集
* @param datasetEntity
*/
@Override
@Transactional
public void update(DatasetEntity datasetEntity) {
if (datasetEntity.getDatasetType()==0){
//TODO 覆盖保存到分布式文件系统中
}else {
//TODO 覆盖数据文件
datasetEntity.setUpdateTime(LocalDateTime.now());
//maybe需要判断
datasetMapper.updata(datasetEntity);
}
}
}

View File

@ -1 +1,5 @@
spring.application.name=intelligent-application-orchestration-service spring.application.name=intelligent-application-orchestration-service
# ?????
spring.datasource.url=jdbc:kingbase8://116.205.121.200:54321/Ipz
spring.datasource.username=system
spring.datasource.password=root

View File

@ -0,0 +1,32 @@
<?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.bipt.intelligentapplicationorchestrationservice.mapper.DatasetMapper">
<update id="updata">
update dataset
<set>
<if test="datasetName != null">
dataset_name=#{datasetName},
</if>
<if test="datasetType != null">
dataset_type=#{datasetType},
</if>
<if test="datasetStatus != null">
dataset_status=#{datasetStatus},
</if>
<if test="dsPath != null">
ds_path=#{dsPath},
</if>
<if test="args != null">
args=#{args},
</if>
<if test="create_time != null">
create_time=#{createTime},
</if>
<if test="update_time != null">
update_time=#{updateTime}
</if>
</set>
where dataset_id = #{datasetId}
</update>
</mapper>