Compare commits

..

13 Commits

Author SHA1 Message Date
9694fbc95c 服务发布(无redis版) 2025-05-20 16:36:54 +08:00
6c838fbff1 服务发布(无redis版) 2025-05-20 16:33:07 +08:00
a794b46f9b 日志提交 2025-05-20 12:07:53 +08:00
62cae458c8 数据集生命周期版本2.0 2025-05-20 12:05:58 +08:00
4f9aed8965 Merge remote-tracking branch 'origin/main' 2025-05-19 22:45:15 +08:00
syc
038a16b428 更新 doc/WorkReport/2025-05-孙一城.md 2025-05-19 22:35:24 +08:00
syc
f96e32816a 更新 doc/WorkReport/2025-05-孙一城.md 2025-05-19 22:35:08 +08:00
syc
9607f38965 更新 doc/WorkReport/2025-05-孙一城.md 2025-05-19 22:34:11 +08:00
35f12bc547 日报上传 2025-05-19 22:18:20 +08:00
e1a59b64f3 日报上传 2025-05-19 22:17:58 +08:00
b61f1bf151 日报上传 2025-05-19 22:10:43 +08:00
8603aad8c5 日报上传 2025-05-19 22:09:35 +08:00
33d96e0aec [提交]:提交工作日报 2025-05-19 21:46:34 +08:00
15 changed files with 343 additions and 4 deletions

View File

@ -0,0 +1,16 @@
# 数据库设计文档
## 服务发布
### 服务发布
#### 1.服务发布表service_publish
| 序号 | 数据表名 | 中文名称 |
| ---- | -------- | ------------------ |
| 1 | id | 发布表id(发布记录唯一标识) |
| 2 | model_id | 模型id |
| 3 | api_url | api路径 |
| 4 | create_time | 发布请求创建时间 |
####

View File

@ -36,4 +36,30 @@
暂无
### 📅 明日计划
完成模型服务的数据库表设计
完成模型服务的数据库表设计
## 2025年5月19日
### ✅ 今日完成
模型发布的数据库设计
### 🚧 进行中
模型发布的逻辑开发
### ⚠️ 问题/障碍
暂无
### 📅 明日计划
完成模型发布的逻辑开发
## 2025年5月20日
### ✅ 今日完成
服务发布逻辑开发无GPU版
### 🚧 进行中
redis设计
### ⚠️ 问题/障碍
暂无
### 📅 明日计划
完成redis设计做完服务发布的逻辑开发

View File

@ -15,6 +15,21 @@
- 继续开发模型评估部分
- 尽量解决lombok存在的问题
## 2025年5月14日
### ✅ 今日完成
* 基本完成模型评估部分开发
* 引入了SpringDoc OpenAPI相关依赖和配置
### 🚧 进行中
* 继续优化模型评估部分
### 📅 明日计划
* 继续优化模型评估部分
## 2025年5月15日
### ✅ 今日完成
@ -28,4 +43,19 @@
### 📅 明日计划
- 模型评估部分优化
- 模型评估部分优化
## 2025年5月19日
### ✅ 今日完成
- 项目设计文档分析
- 尝试项目前端页面开发(数据集管理页面)
### 🚧 进行中
- 项目设计文档分析
### 📅 明日计划
- 基本完成创建模型部分后端开发

View File

@ -5,4 +5,14 @@
### 📅 明日计划
- 实现需求文档功能
- 实现需求文档功能
## 2025年5月15日
### ✅ 今日完成
- 完成算法生命周期后端开发
## 2025年5月19日
### ✅ 今日完成
- 完成算法创建后端开发

View File

@ -39,6 +39,10 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>

View File

@ -0,0 +1,26 @@
package com.bipt.intelligentapplicationorchestrationservice.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
@Slf4j
public class RedisConfiguration {
@Bean
public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory){
log.info("开始创建redis模板对象...");
RedisTemplate redisTemplate = new RedisTemplate();
//设置redis的连接工厂对象
redisTemplate.setConnectionFactory(redisConnectionFactory);
//设置redis key的序列化器
redisTemplate.setKeySerializer(new StringRedisSerializer());
return redisTemplate;
}
}

View File

@ -0,0 +1,41 @@
package com.bipt.intelligentapplicationorchestrationservice.controller;
import com.bipt.intelligentapplicationorchestrationservice.pojo.OptResult;
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishVO;
import com.bipt.intelligentapplicationorchestrationservice.service.PublishService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name ="服务发布相关接口")
@RestController
@RequestMapping("/publish")
@Slf4j
public class publishController {
@Autowired
private PublishService publishService;
/**
* 新增请求发布
* @param servicePublishDTO
* @return
*/
@PostMapping
@Operation(summary ="新增发布请求")
public OptResult<ServicePublishVO> save(@RequestBody ServicePublishDTO servicePublishDTO){
log.info("模型发布请求:{}", servicePublishDTO);
publishService.save(servicePublishDTO);
ServicePublishVO servicePublishVO = publishService.getByModelId(servicePublishDTO);
return OptResult.success(servicePublishVO);
}
}

View File

@ -0,0 +1,21 @@
package com.bipt.intelligentapplicationorchestrationservice.mapper;
import com.bipt.intelligentapplicationorchestrationservice.pojo.ModelVersion;
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface PublishMapper {
void insert(ServicePublishDTO servicePublishDTO);
Long getByApiUrl(String apiUrl);
@Select("select * from model_version where model_id=#{modelId} and status = 1")
ModelVersion getById(Long modelId);
ServicePublishVO getByModelId(Long modelId);
}

View File

@ -0,0 +1,23 @@
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;
/**
* @author hky
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ServicePublish implements Serializable {
private Long id;
private Long modelId;
private String apiUrl;
private LocalDateTime createTime;
}

View File

@ -0,0 +1,22 @@
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;
/**
* @author hky
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ServicePublishDTO implements Serializable {
private Long id;
private Long modelId;
private String apiUrl;
private LocalDateTime createTime;
}

View File

@ -0,0 +1,29 @@
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;
/**
* @author hky
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ServicePublishVO implements Serializable {
private Long modelId;
private String apiUrl;
private String version;
private Integer datasetId;
private String modelConfig;
private String modelPath;
private Integer status;
private LocalDateTime createTime;
}

View File

@ -0,0 +1,50 @@
package com.bipt.intelligentapplicationorchestrationservice.service.Impl;
import com.bipt.intelligentapplicationorchestrationservice.mapper.PublishMapper;
import com.bipt.intelligentapplicationorchestrationservice.pojo.ModelVersion;
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishVO;
import com.bipt.intelligentapplicationorchestrationservice.service.PublishService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author hky
*/
@Service
@Slf4j
public class PublishServiceImpl implements PublishService {
@Autowired
private PublishMapper publishMapper;
/**
* 新增服务请求
* @param servicePublishDTO
*/
@Override
@Transactional
public void save(ServicePublishDTO servicePublishDTO) {
String apiUrl = servicePublishDTO.getApiUrl();
Long id = publishMapper.getByApiUrl(apiUrl);
if (id != null){
throw new IllegalArgumentException("请求已存在: " + apiUrl);
}
Long modelId = servicePublishDTO.getModelId();
ModelVersion modelVersion = publishMapper.getById(modelId);
String modelConfig = modelVersion.getModelConfig();
//todo 调用GPU分配
publishMapper.insert(servicePublishDTO);
}
@Override
public ServicePublishVO getByModelId(ServicePublishDTO servicePublishDTO) {
Long modelId = servicePublishDTO.getModelId();
return publishMapper.getByModelId(modelId);
}
}

View File

@ -0,0 +1,10 @@
package com.bipt.intelligentapplicationorchestrationservice.service;
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishVO;
public interface PublishService {
void save(ServicePublishDTO servicePublishDTO);
ServicePublishVO getByModelId(ServicePublishDTO servicePublishDTO);
}

View File

@ -15,4 +15,15 @@ mybatis.mapper-locations=classpath:mapper/*.xml
# 配置实体类别名所在包
mybatis.type-aliases-package=com.bipt.intelligentapplicationorchestrationservice.pojo
# 开启驼峰命名转换
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.configuration.map-underscore-to-camel-case=true
# Redis服务器地址
spring.data.redis.host=localhost
# Redis服务器端口
spring.data.redis.port=6379
# Redis密码如果有
spring.data.redis.password=123456
# Redis数据库索引默认为0
spring.data.redis.database=2
# 连接超时时间(毫秒)
spring.data.redis.timeout=3000

View File

@ -0,0 +1,20 @@
<?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.PublishMapper">
<insert id="insert">
INSERT INTO service_publish
(id,model_id,api_url,create_time)
values (#{id}, #{modelId}, #{apiUrl}, #{createTime})
</insert>
<select id="getByApiUrl" resultType="java.lang.Long">
SELECT id FROM service_publish WHERE api_url = #{apiUrl};
</select>
<select id="getByModelId"
resultType="com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishVO">
select
sp.api_url,
mv.*
from model_version mv join service_publish sp on mv.model_id = sp.model_id
</select>
</mapper>