Compare commits
4 Commits
5e683fe07f
...
b953e85704
Author | SHA1 | Date | |
---|---|---|---|
b953e85704 | |||
23be873a7c | |||
fa6858e2ab | |||
80b70dfe7d |
9
doc/数据库文档-杜冲.md
Normal file
9
doc/数据库文档-杜冲.md
Normal file
@ -0,0 +1,9 @@
|
||||
‌**<span style="font-size:14pt">TableName: Gpu_Resource</span>**‌
|
||||
|
||||
| <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> |
|
45
doc/智能应用服务管理模块数据库设计文档-宁欢.md
Normal file
45
doc/智能应用服务管理模块数据库设计文档-宁欢.md
Normal 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 | 创建时间 |
|
39
doc/算法生命周期设计文档_孙一城.md
Normal file
39
doc/算法生命周期设计文档_孙一城.md
Normal 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
11
pom.xml
@ -54,6 +54,17 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</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>
|
||||
|
||||
<build>
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.enumeration;
|
||||
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
|
||||
/**
|
||||
* 数据库操作类型
|
||||
*/
|
||||
public enum OperationType {
|
||||
/**
|
||||
* 更新操作
|
||||
*/
|
||||
UPDATE,
|
||||
|
||||
/**
|
||||
* 插入操作
|
||||
*/
|
||||
INSERT,
|
||||
|
||||
/**
|
||||
* 删除操作
|
||||
*/
|
||||
DELETE,
|
||||
/**
|
||||
* 查询操作
|
||||
*/
|
||||
SELECT
|
||||
}
|
@ -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);
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +1,5 @@
|
||||
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
|
32
src/main/resources/mapper/DatasetMapper.xml
Normal file
32
src/main/resources/mapper/DatasetMapper.xml
Normal 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>
|
Reference in New Issue
Block a user