Merge remote-tracking branch 'origin/main' into dc-feature
# Conflicts: # doc/WorkReport/2025-05-杜冲.md # pom.xml # src/main/java/com/bipt/intelligentapplicationorchestrationservice/IntelligentApplicationOrchestrationServiceApplication.java # src/main/resources/application.properties
This commit is contained in:
16
doc/DesignDocument/模型服务表--hky.md
Normal file
16
doc/DesignDocument/模型服务表--hky.md
Normal file
@ -0,0 +1,16 @@
|
||||
# 数据库设计文档
|
||||
|
||||
## 服务发布
|
||||
|
||||
### 服务发布
|
||||
|
||||
#### 1.服务发布表(service_publish)
|
||||
|
||||
| 序号 | 数据表名 | 中文名称 |
|
||||
| ---- | -------- | ------------------ |
|
||||
| 1 | id | 发布表id(发布记录唯一标识) |
|
||||
| 2 | model_id | 模型id |
|
||||
| 3 | api_url | api路径 |
|
||||
| 4 | create_time | 发布请求创建时间 |
|
||||
|
||||
####
|
16
doc/DesignDocument/算法生命周期设计文档_孙一城.md
Normal file
16
doc/DesignDocument/算法生命周期设计文档_孙一城.md
Normal file
@ -0,0 +1,16 @@
|
||||
# 算法生命周期管理数据库设计文档
|
||||
|
||||
## 1. 数据表设计
|
||||
|
||||
### 1.1 algorithm_info(算法基础信息表)
|
||||
| 字段名 | 类型 | 是否为空 | 默认值 | 说明 |
|
||||
|--------|------|----------|--------|------|
|
||||
| id | BIGINT | NOT NULL | AUTO_INCREMENT | 算法ID |
|
||||
| algorithm_name | VARCHAR(100) | NOT NULL | | 算法名称(唯一) |
|
||||
| algorithm_file | VARCHAR(255) | 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 | 更新时间 |
|
||||
| file_size | BIGINT | NULL | | 文件大小(字节) |
|
106
doc/WorkReport/2025-05-hky.md
Normal file
106
doc/WorkReport/2025-05-hky.md
Normal file
@ -0,0 +1,106 @@
|
||||
# 工作日报 - 2025年5月
|
||||
## 2025年5月14日
|
||||
### ✅ 今日完成
|
||||
完成分页查询
|
||||
|
||||
### 🚧 进行中
|
||||
删除操作
|
||||
|
||||
### ⚠️ 问题/障碍
|
||||
测试方法不知道怎么写
|
||||
|
||||
### 📅 明日计划
|
||||
写完删除代码,进行测试
|
||||
|
||||
## 2025年5月15日
|
||||
### ✅ 今日完成
|
||||
完成删除数据集增加数据集,部分测试
|
||||
|
||||
### 🚧 进行中
|
||||
测试(或添加具体异常处理)
|
||||
|
||||
### ⚠️ 问题/障碍
|
||||
暂无
|
||||
|
||||
### 📅 明日计划
|
||||
测试完毕,开下一个模块
|
||||
|
||||
## 2025年5月18日
|
||||
### ✅ 今日完成
|
||||
格式修改,增加了枚举等方便后续维护和开发,修改了删除的逻辑
|
||||
|
||||
### 🚧 进行中
|
||||
模型服务的数据库表设计
|
||||
|
||||
### ⚠️ 问题/障碍
|
||||
暂无
|
||||
|
||||
### 📅 明日计划
|
||||
完成模型服务的数据库表设计
|
||||
|
||||
## 2025年5月19日
|
||||
### ✅ 今日完成
|
||||
模型发布的数据库设计
|
||||
|
||||
### 🚧 进行中
|
||||
模型发布的逻辑开发
|
||||
|
||||
### ⚠️ 问题/障碍
|
||||
暂无
|
||||
|
||||
### 📅 明日计划
|
||||
完成模型发布的逻辑开发
|
||||
|
||||
## 2025年5月20日
|
||||
### ✅ 今日完成
|
||||
服务发布逻辑开发(无GPU版)
|
||||
|
||||
### 🚧 进行中
|
||||
redis设计
|
||||
|
||||
### ⚠️ 问题/障碍
|
||||
暂无
|
||||
|
||||
### 📅 明日计划
|
||||
完成redis设计,做完服务发布的逻辑开发
|
||||
|
||||
## 2025年5月21日
|
||||
### ✅ 今日完成
|
||||
redis的服务器配置
|
||||
|
||||
### 🚧 进行中
|
||||
开发服务发布的redis内容
|
||||
|
||||
### ⚠️ 问题/障碍
|
||||
如何把model_version表中的配置中相关GPU资源的内容提取出来。
|
||||
|
||||
### 📅 明日计划
|
||||
完成服务发布的开发
|
||||
|
||||
## 2025年5月23日
|
||||
### ✅ 今日完成
|
||||
服务发布,拦截器部分功能
|
||||
|
||||
### 🚧 进行中
|
||||
拦截器等待队列算法
|
||||
|
||||
### ⚠️ 问题/障碍
|
||||
不知道怎么优先分配等待队列中任务
|
||||
|
||||
### 📅 明日计划
|
||||
完成拦截器功能
|
||||
|
||||
## 2025年5月25日
|
||||
### ✅ 今日完成
|
||||
服务发布可注册到nacos上
|
||||
|
||||
### 🚧 进行中
|
||||
拦截器开发
|
||||
|
||||
### ⚠️ 问题/障碍
|
||||
模型api请求不知道是什么
|
||||
|
||||
### 📅 明日计划
|
||||
开发拦截器功能
|
||||
|
||||
|
108
doc/WorkReport/2025-05-nh.md
Normal file
108
doc/WorkReport/2025-05-nh.md
Normal file
@ -0,0 +1,108 @@
|
||||
# 工作日报 - 2025年5月
|
||||
## 2025年5月14日
|
||||
### ✅ 今日完成
|
||||
- 完成相关数据库表的创建
|
||||
- 模型评估部分实体类的定义
|
||||
- 新增了SpringBoot配置文件中的一些配置
|
||||
|
||||
### 🚧 进行中
|
||||
- 模型评估部分显示日志后端部分开发
|
||||
|
||||
### ⚠️ 问题/障碍
|
||||
- lombok注解出现问题,没法正常使用
|
||||
|
||||
### 📅 明日计划
|
||||
- 继续开发模型评估部分
|
||||
- 尽量解决lombok存在的问题
|
||||
|
||||
## 2025年5月15日
|
||||
|
||||
### ✅ 今日完成
|
||||
|
||||
* 基本完成模型评估部分开发
|
||||
* 引入了SpringDoc OpenAPI相关依赖和配置
|
||||
|
||||
### 🚧 进行中
|
||||
|
||||
* 继续优化模型评估部分
|
||||
|
||||
### 📅 明日计划
|
||||
|
||||
* 继续优化模型评估部分
|
||||
|
||||
## 2025年5月19日
|
||||
|
||||
### ✅ 今日完成
|
||||
|
||||
- 项目设计文档分析
|
||||
- 尝试项目前端页面开发(数据集管理页面)
|
||||
|
||||
### 🚧 进行中
|
||||
|
||||
- 项目设计文档分析
|
||||
|
||||
### 📅 明日计划
|
||||
|
||||
- 基本完成创建模型部分后端开发
|
||||
|
||||
## 2025年5月20日
|
||||
|
||||
### ✅ 今日完成
|
||||
|
||||
- 数据库表字段新增
|
||||
- 实体类定义与修改
|
||||
- 基本完成创建模型部分后端开发
|
||||
|
||||
### 🚧 进行中
|
||||
|
||||
- 创建模型部分后端优化
|
||||
|
||||
### 📅 明日计划
|
||||
|
||||
- 模型信息管理部分后端开发
|
||||
|
||||
## 2025年5月23日
|
||||
|
||||
### ✅ 今日完成
|
||||
|
||||
- 模型信息管理前端页面基础搭建
|
||||
|
||||
### 🚧 进行中
|
||||
|
||||
- 模型信息管理前端页面搭建
|
||||
|
||||
### 📅 明日计划
|
||||
|
||||
- 模型信息管理前端页面搭建
|
||||
|
||||
## 2025年5月24日
|
||||
|
||||
### ✅ 今日完成
|
||||
|
||||
- 模型信息管理前端页面部分数据与后端联调
|
||||
- 模型信息管理后端开发20%
|
||||
|
||||
### 🚧 进行中
|
||||
|
||||
- 模型信息管理后端开发
|
||||
- 模型信息管理前端页面部分数据与后端联调
|
||||
|
||||
### 📅 明日计划
|
||||
|
||||
- 模型信息管理后端开发
|
||||
- 模型信息管理前端页面部分数据与后端联调
|
||||
|
||||
## 2025年5月25日
|
||||
|
||||
### ✅ 今日完成
|
||||
|
||||
- 模型信息管理前端页面开发
|
||||
- 模型信息管理后端开发90%(后续可能还需要根据需求优化)
|
||||
|
||||
### 🚧 进行中
|
||||
|
||||
- 模型信息管理前端页面开发
|
||||
|
||||
### 📅 明日计划
|
||||
|
||||
- 模型信息管理前端页面开发
|
8
doc/WorkReport/2025-05-孙一城.md
Normal file
8
doc/WorkReport/2025-05-孙一城.md
Normal file
@ -0,0 +1,8 @@
|
||||
# 工作日报 - 2025年5月
|
||||
## 2025年5月14日
|
||||
### ✅ 今日完成
|
||||
- 完成建表
|
||||
|
||||
|
||||
### 📅 明日计划
|
||||
- 实现需求文档功能
|
@ -47,8 +47,6 @@ _### 🚧 进行中
|
||||
- 设计模型部署类
|
||||
|
||||
### ⚠️ 问题/障碍
|
||||
|
||||
|
||||
- 暂无
|
||||
|
||||
### 📅 明日计划
|
||||
|
9
doc/WorkReport/数据库文档-杜冲.md
Normal file
9
doc/WorkReport/数据库文档-杜冲.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> |
|
@ -1,39 +0,0 @@
|
||||
# 算法生命周期管理数据库设计文档
|
||||
|
||||
## 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 | 创建时间 |
|
201
pom.xml
201
pom.xml
@ -1,148 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.4.5</version>
|
||||
<version>3.1.5</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<groupId>com.bipt</groupId>
|
||||
<artifactId>intelligent-application-orchestration-service</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>intelligent-application-orchestration-service</name>
|
||||
<description>intelligent-application-orchestration-service</description>
|
||||
<url/>
|
||||
<licenses>
|
||||
<license/>
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer/>
|
||||
</developers>
|
||||
<scm>
|
||||
<connection/>
|
||||
<developerConnection/>
|
||||
<tag/>
|
||||
<url/>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<java.version>21</java.version>
|
||||
<!-- 添加 Spring Cloud 版本控制 -->
|
||||
<spring-cloud.version>2022.0.4</spring-cloud.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖管理:统一控制 Spring Cloud 和 Alibaba 版本 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- Spring Cloud 依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring-cloud.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<!-- Spring Cloud Alibaba 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||
<version>2022.0.0.0</version> <!-- 适配 Spring Boot 3.1.x 的正确版本 -->
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring Boot 基础依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>6.4.5.Final</version> <!-- 推荐稳定版本:ml-citation{ref="5,8" data="citationList"} -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.jboss.logging</groupId> <!-- 常见冲突源:ml-citation{ref="7" data="citationList"} -->
|
||||
<artifactId>jboss-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 数据库驱动 -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.hibernate.javax.persistence</groupId>
|
||||
<artifactId>hibernate-jpa-2.1-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
<version>3.2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>3.0.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.17.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>1.5.5.Final</version> <!-- 确保版本 ≥1.2.0 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.kingbase8</groupId>
|
||||
<artifactId>kingbase8</artifactId>
|
||||
<version>9.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.38</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-redis</artifactId>
|
||||
<version>1.4.7.RELEASE</version>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Nacos 配置依赖(移除手动版本,由上方依赖管理控制) -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring Boot 3.x 必须的 Bootstrap 依赖(无需版本号) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 测试依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>3.0.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<version>3.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter-test</artifactId>
|
||||
<version>3.0.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@ -152,10 +130,14 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- 显式指定 Java 21 编译 -->
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.38</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
@ -172,29 +154,6 @@
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>1.5.5.Final</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
@ -1,15 +1,22 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@MapperScan("com.bipt.intelligentapplicationorchestrationservice.mapper")
|
||||
@MapperScan("com.bipt.intelligentapplicationorchestrationservice.mapper")//指定扫描Mapper接口的包
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@EnableDiscoveryClient
|
||||
@Slf4j
|
||||
public class IntelligentApplicationOrchestrationServiceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(IntelligentApplicationOrchestrationServiceApplication.class, args);
|
||||
log.info("server started");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.config;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class WebMvcConfiguration implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
* 配置OpenAPI信息
|
||||
*/
|
||||
@Bean
|
||||
public OpenAPI customOpenAPI() {
|
||||
// 设置服务器信息(可选)
|
||||
List<Server> servers = new ArrayList<>();
|
||||
servers.add(new Server().url("/").description("本地服务器"));
|
||||
|
||||
return new OpenAPI()
|
||||
.info(new Info()
|
||||
.title("智能应用服务管理")
|
||||
.version("2.0")
|
||||
.description("智能应用服务管理接口文档"))
|
||||
.servers(servers);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.constant;
|
||||
|
||||
public class MessageConstant {
|
||||
public static final String UNKNOWN_ERROR = "未知错误";
|
||||
public static final String ALREADY_EXISTS = "已存在";
|
||||
|
||||
//生命周期相关常量
|
||||
public static final String LifeCycle_No_Exist = "生命周期不存在";
|
||||
public static final String LifeCycle_Undefined = "生命周期未定义";
|
||||
public static final String ERROR_DEPLOYED_TO_DESIGNING = "已部署的模型不能直接调整成设计,需先下线再设计";
|
||||
public static final String ERROR_ABANDONED_CANNOT_UPDATE = "已废弃的模型只能查看信息,不能更新生命周期";
|
||||
public static final String ERROR_TRAINING_INVALID_TRANSITION = "训练中的模型只能调整成设计和评估";
|
||||
public static final String UPDATE_FAILURE = "更新模型生命周期失败";
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.constant;
|
||||
|
||||
/**
|
||||
* 状态常量,启用或者禁用
|
||||
* @author hky
|
||||
*/
|
||||
public class StatusConstant {
|
||||
//启用
|
||||
public static final Integer ENABLE = 1;
|
||||
|
||||
//禁用
|
||||
public static final Integer DISABLE = 0;
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.controller;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.AlgorithmInfo;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.service.AlgorithmInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/algorithm")
|
||||
public class AlgorithmInfoController {
|
||||
|
||||
@Autowired
|
||||
private AlgorithmInfoService algorithmInfoService;
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ResponseEntity<AlgorithmInfo> getById(@PathVariable Long id) {
|
||||
AlgorithmInfo algorithmInfo = algorithmInfoService.getById(id);
|
||||
return algorithmInfo != null ?
|
||||
ResponseEntity.ok(algorithmInfo) :
|
||||
ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@GetMapping("/name/{algorithmName}")
|
||||
public ResponseEntity<AlgorithmInfo> getByName(@PathVariable String algorithmName) {
|
||||
AlgorithmInfo algorithmInfo = algorithmInfoService.getByName(algorithmName);
|
||||
return algorithmInfo != null ?
|
||||
ResponseEntity.ok(algorithmInfo) :
|
||||
ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@GetMapping("/type/{algorithmType}")
|
||||
public ResponseEntity<List<AlgorithmInfo>> getByType(@PathVariable String algorithmType) {
|
||||
List<AlgorithmInfo> algorithmInfos = algorithmInfoService.getByType(algorithmType);
|
||||
return ResponseEntity.ok(algorithmInfos);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
public ResponseEntity<String> update(@PathVariable Long id, @RequestBody AlgorithmInfo algorithmInfo) {
|
||||
algorithmInfo.setId(id);
|
||||
if (!algorithmInfoService.validateAlgorithmInfo(algorithmInfo)) {
|
||||
return ResponseEntity.badRequest().body("Invalid algorithm information");
|
||||
}
|
||||
|
||||
boolean success = algorithmInfoService.update(algorithmInfo);
|
||||
return success ?
|
||||
ResponseEntity.ok("Update successful") :
|
||||
ResponseEntity.badRequest().body("Update failed");
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<String> delete(@PathVariable Long id) {
|
||||
boolean success = algorithmInfoService.delete(id);
|
||||
return success ?
|
||||
ResponseEntity.ok("Delete successful") :
|
||||
ResponseEntity.badRequest().body("Delete failed");
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.controller;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.*;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.service.DatasetService;
|
||||
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.*;
|
||||
|
||||
import java.util.List;
|
||||
@Tag(name ="数据集相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/dataset")
|
||||
@Slf4j
|
||||
public class DatasetController {
|
||||
@Autowired
|
||||
private DatasetService datasetService;
|
||||
|
||||
/**
|
||||
* 新增数据集
|
||||
* @param datasetDTO
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary ="新增数据集")
|
||||
@PostMapping
|
||||
public OptResult save(@RequestBody DatasetDTO datasetDTO) {
|
||||
log.info("新增数据集:{}", datasetDTO);
|
||||
datasetService.save(datasetDTO);
|
||||
return OptResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param dataSetPageQueryDTO
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary ="分页查询")
|
||||
@GetMapping("/page")
|
||||
public OptResult<PageResult> page(DatasetPageQueryDTO dataSetPageQueryDTO) {
|
||||
log.info("数据集分页查询:{}", dataSetPageQueryDTO);
|
||||
PageResult pageResult = datasetService.pageQuery(dataSetPageQueryDTO);
|
||||
return OptResult.success(pageResult);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改数据集
|
||||
* @param datasetDTO
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary ="修改数据集")
|
||||
@PutMapping
|
||||
public OptResult update(@RequestBody DatasetDTO datasetDTO){
|
||||
log.info("修改数据集",datasetDTO);
|
||||
datasetService.update(datasetDTO);
|
||||
return OptResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除数据集
|
||||
* @param datasetIds 数据集ID列表
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Operation(summary ="删除数据集")
|
||||
@DeleteMapping
|
||||
public OptResult<String> deleteBatch(@RequestBody List<Long> datasetIds) {
|
||||
log.info("批量删除数据集,ID列表:{}", datasetIds);
|
||||
datasetService.deleteBatch(datasetIds);
|
||||
return OptResult.success("批量删除成功");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.controller;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ModelLogVO;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.OptResult;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.service.EvaluationService;
|
||||
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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "模型评估相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/evaluation")
|
||||
@Slf4j
|
||||
public class EvaluationController {
|
||||
@Autowired
|
||||
private EvaluationService evaluationService;
|
||||
|
||||
/**
|
||||
* 获取日志详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "模型日志信息显示")
|
||||
@GetMapping("/detail")
|
||||
public OptResult detail(Long id){
|
||||
log.info("模型日志信息显示id:{}", id);
|
||||
ModelLogVO modelLogVO = evaluationService.detail(id);
|
||||
return OptResult.success(modelLogVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型评估状态,评估通过则上线(1.上线,0.下线)
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "模型评估接口")
|
||||
@PutMapping("/evaluate")
|
||||
public OptResult evaluate(Long id, Integer status){
|
||||
log.info("模型上线状态修改:id:{}, status:{}", id, status);
|
||||
evaluationService.startOrStop(id, status);
|
||||
return OptResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.controller;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.*;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.service.ModelService;
|
||||
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.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/model")
|
||||
@Tag(name = "模型部分相关接口")
|
||||
@CrossOrigin(origins = "http://localhost:3000") // 生产环境指定具体域名
|
||||
public class ModelController {
|
||||
@Autowired
|
||||
private ModelService modelService;
|
||||
@Operation(summary = "创建模型")
|
||||
@PostMapping("/createModel")
|
||||
public OptResult creatModel(@RequestBody ModelDTO dto){
|
||||
log.info("创建模型");
|
||||
modelService.createModel(dto);
|
||||
return OptResult.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "新增模型版本")
|
||||
@PostMapping("/createModelVersion")
|
||||
public OptResult createModelVersion(@RequestBody ModelDTO dto){
|
||||
log.info("新增模型版本");
|
||||
modelService.createModelVersion(dto);
|
||||
return OptResult.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "查询模型列表")
|
||||
@GetMapping("list")
|
||||
public OptResult list(){
|
||||
log.info("查询模型列表");
|
||||
List<ModelVO> modelVOList = modelService.list();
|
||||
return OptResult.success(modelVOList);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询模型详情")
|
||||
@GetMapping("detail")
|
||||
public OptResult detail(Long id){
|
||||
log.info("查询模型详情");
|
||||
ModelVersion modelVersion = modelService.detail(id);
|
||||
return OptResult.success(modelVersion);
|
||||
}
|
||||
|
||||
@Operation(summary = "模型更新")
|
||||
@PutMapping("/updateModel")
|
||||
public OptResult updateModel(@RequestBody ModelVersionDTO dto){
|
||||
log.info("模型更新");
|
||||
modelService.updateModel(dto);
|
||||
return OptResult.success();
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "模型版本删除")
|
||||
@DeleteMapping("/deleteModelVersion")
|
||||
public OptResult deleteModelVersion(Long id){
|
||||
log.info("模型版本删除");
|
||||
modelService.deleteModelVersion(id);
|
||||
return OptResult.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "更新生命周期")
|
||||
@PutMapping("/updateLifeCycle")
|
||||
public OptResult updateLifeCycle(Long id,String lifeCycle){
|
||||
log.info("更新生命周期");
|
||||
modelService.updateLifeCycle(id,lifeCycle);
|
||||
return OptResult.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "查询生命周期列表")
|
||||
@GetMapping("/listLifeCycle")
|
||||
public OptResult listLifeCycle(){
|
||||
log.info("查询生命周期列表");
|
||||
List<Map<String, String>> lifeCycleList = modelService.listLifeCycle();
|
||||
return OptResult.success(lifeCycleList);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询数据集列表")
|
||||
@GetMapping("/listDataset")
|
||||
public OptResult listDataset(){
|
||||
List<DatasetEntity> datasetList = modelService.listDataset();
|
||||
return OptResult.success(datasetList);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.controller;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.*;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.service.PublishService;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.util.NacosServiceUtil;
|
||||
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.data.redis.core.RedisTemplate;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name ="服务发布相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/publish")
|
||||
@Slf4j
|
||||
public class PublishController {
|
||||
@Autowired
|
||||
private PublishService publishService;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
@Autowired
|
||||
private NacosServiceUtil nacosServiceUtil;
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary ="新增发布请求")
|
||||
@Transactional
|
||||
public OptResult<List<ServicePublishVO>> save(@RequestBody ServicePublishDTO servicePublishDTO) {
|
||||
log.info("模型发布请求:{}", servicePublishDTO);
|
||||
publishService.save(servicePublishDTO);
|
||||
//todo 调用模型部署
|
||||
|
||||
// 获取前端传来的IP字符串
|
||||
String ipListStr = servicePublishDTO.getIp();
|
||||
if (ipListStr == null || ipListStr.trim().isEmpty()) {
|
||||
log.warn("IP列表为空,不进行Nacos注册");
|
||||
return OptResult.success();
|
||||
}
|
||||
|
||||
try {
|
||||
// 使用逗号分割IP字符串
|
||||
String[] ipArray = ipListStr.split(",");
|
||||
// 循环注册每个IP到Nacos
|
||||
for (String ip : ipArray) {
|
||||
String trimmedIp = ip.trim();
|
||||
if (!trimmedIp.isEmpty()) {
|
||||
nacosServiceUtil.registerService(
|
||||
servicePublishDTO.getModelId().toString(),
|
||||
trimmedIp,
|
||||
8080,
|
||||
servicePublishDTO.getApiUrl()
|
||||
);
|
||||
log.info("Nacos服务注册成功: {}", trimmedIp);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Nacos服务注册失败", e);
|
||||
return OptResult.error("Nacos服务注册失败"); // 根据业务需求返回错误
|
||||
}
|
||||
|
||||
|
||||
return OptResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,178 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.controller;
|
||||
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.OptResult;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.service.ServiceAPIService;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.util.NacosServiceUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Tag(name ="服务API相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/API")
|
||||
@Slf4j
|
||||
public class ServiceAPIController {
|
||||
|
||||
@Autowired
|
||||
private ServiceAPIService serviceAPIService;
|
||||
|
||||
@Autowired
|
||||
private NacosServiceUtil nacosServiceUtil;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
@PostMapping("/release")
|
||||
@Operation(summary = "结束访问")
|
||||
@Transactional
|
||||
public OptResult releaseResource(@PathVariable Long modelId) {
|
||||
String key = "modelId:" + modelId;
|
||||
String modelConfig = (String) redisTemplate.opsForValue().get(key);
|
||||
int userMemorySize = parseGpuMemorySize(modelConfig);
|
||||
List<String> instanceIps;
|
||||
try {
|
||||
instanceIps = nacosServiceUtil.getServiceInstances(modelId.toString());
|
||||
} catch (Exception e) {
|
||||
log.error("获取Nacos实例失败", e);
|
||||
return OptResult.error("获取实例失败");
|
||||
}
|
||||
int memorySize;
|
||||
for (String ip : instanceIps) {
|
||||
String ipKey = "ip:" + ip;
|
||||
Integer nowMemorySizeOBJ = (Integer) redisTemplate.opsForValue().get(ipKey);
|
||||
int nowMemorySize = nowMemorySizeOBJ;
|
||||
memorySize = nowMemorySize + userMemorySize;
|
||||
// 更新IP对应的资源值
|
||||
redisTemplate.opsForValue().set(ipKey, memorySize);
|
||||
// 设置缓存过期时间(3600秒)
|
||||
redisTemplate.expire(ipKey, 3600, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
// 处理等待队列(先来先服务)
|
||||
String waitQueueKey = "waitQueue:" + modelId;
|
||||
// 取出队列头部的任务(最早加入的)
|
||||
Long waitModelId = (Long) redisTemplate.opsForList().leftPop(waitQueueKey);
|
||||
if (waitModelId != null) {
|
||||
log.info("检测到等待队列任务,尝试调度模型ID: {}", waitModelId);
|
||||
return schedule(waitModelId); // 重新调度最早的任务
|
||||
} else {
|
||||
log.info("等待队列为空,无任务需要处理");
|
||||
}
|
||||
|
||||
return OptResult.success("资源释放成功");
|
||||
}
|
||||
|
||||
@PostMapping("/request")
|
||||
@Operation(summary = "请求调度")
|
||||
@Transactional
|
||||
public OptResult schedule(@PathVariable Long modelId) {
|
||||
// 1. 存储modelConfig到缓存
|
||||
String modelConfig = serviceAPIService.getByModelId(modelId);
|
||||
int requestMemorySize = parseGpuMemorySize(modelConfig);
|
||||
String modelConfigKey = "modelConfig:" + modelId;
|
||||
redisTemplate.opsForValue().set(modelConfigKey, modelConfig);
|
||||
// 2. 获取Nacos实例IP列表
|
||||
List<String> instanceIps;
|
||||
try {
|
||||
instanceIps = nacosServiceUtil.getServiceInstances(modelId.toString());
|
||||
} catch (Exception e) {
|
||||
log.error("获取Nacos实例失败", e);
|
||||
return OptResult.error("获取实例失败");
|
||||
}
|
||||
Set<String> gpuKeys = redisTemplate.keys("gpu:*");
|
||||
//根据IP列表查找资源
|
||||
for (String instanceIp : instanceIps) {
|
||||
for (String gpuKey : gpuKeys) {
|
||||
String GPUConfig = (String) redisTemplate.opsForValue().get(gpuKey);
|
||||
if (GPUConfig != null) {
|
||||
// 分割键值对
|
||||
String[] pairs = GPUConfig.split(",");
|
||||
String ip = null;
|
||||
int memorySize = 0;
|
||||
for (String pair : pairs) {
|
||||
String[] keyValue = pair.split(":", 2);
|
||||
if (keyValue.length == 2) {
|
||||
String key = keyValue[0].trim();
|
||||
String value = keyValue[1].trim();
|
||||
if ("IP".equalsIgnoreCase(key)) {
|
||||
ip = value;
|
||||
} else if ("GPUMemorySize".equalsIgnoreCase(key)) {
|
||||
memorySize = Integer.parseInt(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 检查解析出的 IP 是否在 Nacos 实例列表中
|
||||
if (instanceIp.equals(ip)) {
|
||||
log.info("找到 IP {} 对应的 GPU 内存: {} ", ip, memorySize);
|
||||
if (memorySize>=requestMemorySize){
|
||||
int newMemorySize = memorySize - requestMemorySize;
|
||||
String ipKey = "ip:" + ip;
|
||||
redisTemplate.opsForValue().set(ipKey,newMemorySize);
|
||||
//访问请求最大时间为3600s
|
||||
redisTemplate.expire(ipKey, 3600, TimeUnit.SECONDS);
|
||||
}
|
||||
return OptResult.success("资源分配成功,使用ip:" + ip);
|
||||
}else {
|
||||
log.info("资源不足");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 所有实例检查完毕未找到足够资源
|
||||
String waitQueueKey = "waitQueue:" + modelId;
|
||||
// 改为右插入,保证队列顺序为FIFO(最早的任务在列表头部)
|
||||
redisTemplate.opsForList().rightPush(waitQueueKey, modelId);
|
||||
log.info("未找到足够资源,任务 {} 加入等待队列", modelId);
|
||||
return OptResult.error("资源不足,等待中");
|
||||
}
|
||||
/**
|
||||
* 从模型配置字符串中解析GPU内存需求
|
||||
* @param modelConfig 模型配置字符串,格式如 "GPUMemorySize:8000,version:1"
|
||||
* @return 解析到的GPU内存大小(MB),若解析失败返回-1
|
||||
*/
|
||||
private int parseGpuMemorySize(String modelConfig) {
|
||||
if (modelConfig == null || modelConfig.isEmpty()) {
|
||||
log.error("模型配置为空,无法解析GPU内存需求");
|
||||
return -1;
|
||||
}
|
||||
int requestMemorySize = 0;
|
||||
String[] config = modelConfig.split(",");
|
||||
for (String pair : config) {
|
||||
// 按冒号分割键值对
|
||||
String[] keyValue = pair.split(":", 2);
|
||||
if (keyValue.length == 2) {
|
||||
String key = keyValue[0].trim();
|
||||
String value = keyValue[1].trim();
|
||||
// 匹配 GPUMemorySize 字段(忽略大小写)
|
||||
if ("GPUMemorySize".equalsIgnoreCase(key)) {
|
||||
try {
|
||||
requestMemorySize = Integer.parseInt(value);
|
||||
log.info("模型GPU内存: {} MB", requestMemorySize);
|
||||
break; // 找到后即可退出循环
|
||||
} catch (NumberFormatException e) {
|
||||
log.error("解析GPUMemorySize失败,值: {}", value, e);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (requestMemorySize <= 0) {
|
||||
log.error("模型需求GPU内存未配置或无效");
|
||||
return -1;
|
||||
}
|
||||
return requestMemorySize;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.enumeration;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author hky
|
||||
*/
|
||||
|
||||
@Getter
|
||||
public enum DatasetType {
|
||||
UPLOAD(0,"用户上传"),
|
||||
FROM_DATABASE(1,"来源于数据库");
|
||||
|
||||
private final Integer code;
|
||||
private final String description;
|
||||
|
||||
DatasetType(Integer code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态码获取对应的枚举值
|
||||
* @param code 状态码
|
||||
* @return 对应的枚举值
|
||||
*/
|
||||
public static DatasetType fromCode(Integer code) {
|
||||
for (DatasetType datasetType : DatasetType.values()) {
|
||||
if (datasetType.getCode().equals(code)) {
|
||||
return datasetType;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("无效的数据集状态码: " + code);
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.enumeration;
|
||||
|
||||
/**
|
||||
* 日志类型
|
||||
*/
|
||||
public enum LogType {
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.enumeration;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.constant.MessageConstant;
|
||||
|
||||
/**
|
||||
* 模型生命周期状态枚举
|
||||
*/
|
||||
public enum ModelLifecycle {
|
||||
DESIGNING("设计中"),
|
||||
TRAINING("训练中"),
|
||||
EVALUATING("评估中"),
|
||||
DEPLOYED("已部署"),
|
||||
OFFLINE("已下线"),
|
||||
ABANDONED("已废弃");
|
||||
|
||||
private final String description;
|
||||
|
||||
private ModelLifecycle(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
// 将枚举名称转换成数据库存储的字符串
|
||||
public String getDbValue() {
|
||||
return name();
|
||||
}
|
||||
|
||||
// 将数据库存储的字符串转换为枚举实例
|
||||
public static ModelLifecycle getDbValueFromDb(String dbValue) {
|
||||
if(dbValue == null) return null;
|
||||
try {
|
||||
return ModelLifecycle.valueOf(dbValue);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new IllegalArgumentException(MessageConstant.LifeCycle_No_Exist + ":" + dbValue);
|
||||
}
|
||||
}
|
||||
|
||||
// 从前端传的中文描述 -> 转换为枚举
|
||||
public static ModelLifecycle fromDescription(String description) {
|
||||
for (ModelLifecycle lifecycle : ModelLifecycle.values()) {
|
||||
if (lifecycle.getDescription().equals(description)) {
|
||||
return lifecycle;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("生命周期描述非法: " + description);
|
||||
}
|
||||
}
|
@ -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,36 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.filter;
|
||||
|
||||
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
||||
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Component
|
||||
public class ApiRequestGlobalFilter implements GlobalFilter, Ordered {
|
||||
|
||||
@Override
|
||||
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
||||
ServerHttpRequest request = exchange.getRequest();
|
||||
|
||||
// 检查请求路径和方法
|
||||
if (request.getURI().getPath().equals("/request") &&
|
||||
request.getMethod() == HttpMethod.POST) {
|
||||
|
||||
// 在此处添加拦截逻辑
|
||||
System.out.println("拦截到POST /request请求");
|
||||
|
||||
}
|
||||
|
||||
// 继续处理请求
|
||||
return chain.filter(exchange);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 1; // 过滤器执行顺序,数值越小越先执行
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.handler;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.constant.MessageConstant;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.OptResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import java.sql.SQLIntegrityConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 全局异常处理器,处理项目中抛出的业务异常
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
@Slf4j
|
||||
public class GlobalExceptionHandler {
|
||||
/*
|
||||
* 捕获SQL异常
|
||||
* */
|
||||
@ExceptionHandler
|
||||
public OptResult exceptionHandler(SQLIntegrityConstraintViolationException ex){
|
||||
String message = ex.getMessage();
|
||||
if(message.contains("Duplicate entry")) {
|
||||
String[] split = message.split(" ");
|
||||
String username = split[2];
|
||||
String msg = username + MessageConstant.ALREADY_EXISTS;
|
||||
return OptResult.error(msg);
|
||||
}else {
|
||||
return OptResult.error(MessageConstant.UNKNOWN_ERROR);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.mapper;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.AlgorithmInfo;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AlgorithmInfoMapper {
|
||||
|
||||
@Select("SELECT * FROM algorithm_info WHERE id = #{id}")
|
||||
AlgorithmInfo selectById(Long id);
|
||||
|
||||
@Select("SELECT * FROM algorithm_info WHERE algorithm_name = #{algorithmName}")
|
||||
AlgorithmInfo selectByName(String algorithmName);
|
||||
|
||||
@Select("SELECT * FROM algorithm_info WHERE algorithm_type = #{algorithmType}")
|
||||
List<AlgorithmInfo> selectByType(String algorithmType);
|
||||
|
||||
@Insert("INSERT INTO algorithm_info(algorithm_name, algorithm_file, algorithm_type, description, created_by, file_size) " +
|
||||
"VALUES(#{algorithmName}, #{algorithmFile}, #{algorithmType}, #{description}, #{createdBy}, #{fileSize})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
int insert(AlgorithmInfo algorithmInfo);
|
||||
|
||||
@Update("UPDATE algorithm_info SET algorithm_name = #{algorithmName}, algorithm_file = #{algorithmFile}, " +
|
||||
"algorithm_type = #{algorithmType}, description = #{description}, file_size = #{fileSize} " +
|
||||
"WHERE id = #{id}")
|
||||
int update(AlgorithmInfo algorithmInfo);
|
||||
|
||||
@Delete("DELETE FROM algorithm_info WHERE id = #{id}")
|
||||
int deleteById(Long id);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.mapper;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetEntity;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetPageQueryDTO;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DatasetMapper {
|
||||
|
||||
void updata(DatasetEntity datasetEntity);
|
||||
|
||||
void insert(DatasetEntity datasetEntity);
|
||||
|
||||
Page<DatasetVO> pageQuery(DatasetPageQueryDTO dataSetPageQueryDTO);
|
||||
|
||||
@Select("select * from dataset where dataset_id=#{datasetId}")
|
||||
DatasetEntity getById(Long datasetId);
|
||||
|
||||
void deleteBatch(@Param("datasetIds") List<Long> datasetIds);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.mapper;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ModelLogVO;
|
||||
|
||||
public interface EvaluationMapper {
|
||||
/*
|
||||
* 查询模型评估日志详情
|
||||
* @param id 模型评估日志id
|
||||
* @return 模型评估日志详情
|
||||
*/
|
||||
ModelLogVO selectLogDetail(Long id);
|
||||
|
||||
/*
|
||||
* 更新模型评估日志状态(评估通过则上线)
|
||||
* @param id 模型评估日志id
|
||||
* @param status 模型评估日志状态
|
||||
*/
|
||||
void update(Long id, Integer status);
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.mapper;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.*;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ModelMapper {
|
||||
|
||||
/**
|
||||
* 插入模型基本信息
|
||||
* @param modelInfo
|
||||
*/
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id") //能够拿到主键值,并设置给modelInfo对象
|
||||
@Insert("insert into model_info(model_name) values(#{modelName})")
|
||||
void insertModelInfo(ModelInfo modelInfo);
|
||||
|
||||
/**
|
||||
* 插入模型版本信息
|
||||
* @param modelVersion
|
||||
*/
|
||||
void insertModelVersion(ModelVersion modelVersion);
|
||||
|
||||
/*
|
||||
* 查询模型列表
|
||||
*/
|
||||
List<ModelVO> list();
|
||||
|
||||
/**
|
||||
* 根据id查询模型详情
|
||||
* @param id 版本表id
|
||||
* @return
|
||||
*/
|
||||
ModelVersion selectById(Long id);
|
||||
|
||||
/**
|
||||
* 更新模型信息
|
||||
* @param dto
|
||||
*/
|
||||
void update(ModelVersionDTO dto);
|
||||
|
||||
/**
|
||||
* 删除模型版本
|
||||
* @param id 版本表id
|
||||
*/
|
||||
@Delete("delete from model_version where id=#{id}")
|
||||
void deleteModelVersion(Long id);
|
||||
|
||||
/**
|
||||
* 删除模型
|
||||
* @param id 模型id
|
||||
*/
|
||||
@Delete("delete from model_info where id= #{id}")
|
||||
void deleteModel(Long id);
|
||||
|
||||
/**
|
||||
* 查询模型生命周期
|
||||
* @param id 模型版本表id
|
||||
* 返回模型生命周期
|
||||
*/
|
||||
@Select("select life_cycle from model_version where id=#{id}")
|
||||
String selectLifeCycleById(Long id);
|
||||
|
||||
/**
|
||||
* 更新模型生命周期
|
||||
* @param id 模型版本表id
|
||||
* @param dbValue 数据库中存储的生命周期
|
||||
* @return
|
||||
*/
|
||||
@Update("update model_version set life_cycle=#{dbValue} where id=#{id}")
|
||||
int updateLifeCycleById(Long id, String dbValue);
|
||||
|
||||
/**
|
||||
* 查询数据集列表
|
||||
* @return
|
||||
*/
|
||||
@Select("select dataset_id,dataset_name from dataset")
|
||||
List<DatasetEntity> listDataset();
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
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);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
@Mapper
|
||||
public interface ServiceAPIMapper {
|
||||
@Select("select model_config from model_version where model_id=#{modelId} and status = 1")
|
||||
String getById(Long modelId);
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class AlgorithmInfo {
|
||||
private Long id;
|
||||
private String algorithmName;
|
||||
private String algorithmFile;
|
||||
private String algorithmType;
|
||||
private String description;
|
||||
private String createdBy;
|
||||
private LocalDateTime createTime;
|
||||
private Long fileSize;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAlgorithmName() {
|
||||
return algorithmName;
|
||||
}
|
||||
|
||||
public void setAlgorithmName(String algorithmName) {
|
||||
this.algorithmName = algorithmName;
|
||||
}
|
||||
|
||||
public String getAlgorithmFile() {
|
||||
return algorithmFile;
|
||||
}
|
||||
|
||||
public void setAlgorithmFile(String algorithmFile) {
|
||||
this.algorithmFile = algorithmFile;
|
||||
}
|
||||
|
||||
public String getAlgorithmType() {
|
||||
return algorithmType;
|
||||
}
|
||||
|
||||
public void setAlgorithmType(String algorithmType) {
|
||||
this.algorithmType = algorithmType;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(LocalDateTime createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Long getFileSize() {
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
public void setFileSize(Long fileSize) {
|
||||
this.fileSize = fileSize;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hky
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DatasetDTO implements Serializable {
|
||||
private Long datasetId;
|
||||
private String datasetName;
|
||||
private int datasetType;
|
||||
private String dsPath;
|
||||
// private Map<String,String> args;
|
||||
private String args;
|
||||
}
|
@ -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;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hky
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DatasetEntity implements Serializable {
|
||||
private Long datasetId;
|
||||
private String datasetName;
|
||||
private int datasetType;
|
||||
private int datasetStatus;
|
||||
private String dsPath;
|
||||
// private Map<String,String> args;
|
||||
private String args;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
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 DatasetPageQueryDTO implements Serializable{
|
||||
private int page;
|
||||
private int pageSize;
|
||||
private String datasetName;
|
||||
private int datasetType;
|
||||
private int datasetStatus;
|
||||
private String dsPath;
|
||||
private String args;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
@ -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 DatasetVO implements Serializable {
|
||||
private String datasetName;
|
||||
private Integer datasetType;
|
||||
private Integer datasetStatus;
|
||||
private String dsPath;
|
||||
// private Map<String,String> args;
|
||||
private String args;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 机器信息实体类
|
||||
* @author hky
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MachineInfo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id; // 机器唯一标识
|
||||
private String ip; // IP 地址
|
||||
private String hostname; // 主机名
|
||||
private Integer cpuCoreNum; // CPU 核心数
|
||||
private Long memoryTotal; // 总内存 (MB)
|
||||
private Long memoryUsed; // 已用内存 (MB)
|
||||
private String GPUModel; // GPU 型号
|
||||
private Integer GPUMemorySize; // GPU 显存大小 (GB)
|
||||
private Integer GPUCount; // GPU 数量
|
||||
private Integer status; // 机器状态 (0: 离线, 1: 在线, 2: 繁忙)
|
||||
private String os; // 操作系统
|
||||
private String region; // 所属区域
|
||||
private String zone; // 可用区
|
||||
private Date createTime; // 创建时间
|
||||
private Date updateTime; // 更新时间
|
||||
private Map<String, String> labels; // 自定义标签
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ModelDTO {
|
||||
private Long id; // 模型id
|
||||
private String modelName; // 模型名称
|
||||
private String version; // 模型版本
|
||||
private Integer datasetId; // 数据集id
|
||||
private String modelConfig; // 模型配置信息
|
||||
private String modelPath; // 模型存储路径
|
||||
private Integer status; // 模型状态(1代表上线,0代表不上线)D
|
||||
private Integer modelSize; // 模型大小
|
||||
private String dataPreHandleFile; // 数据预处理文件存储路径
|
||||
private String modelSuperArgs; // 模型超参数
|
||||
private String modelArgsSize; // 模型参数量
|
||||
private String modelSourceCodeUrl; // 模型源代码路径
|
||||
private String modelFile; // 模型文件存储路径
|
||||
private String modelDesignDocument; // 模型设计文档存储路径
|
||||
private String lifeCycle; // 模型生命周期
|
||||
private String operateUser; // 操作人
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
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 nh
|
||||
* @description:模型评估记录实体类
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ModelEvaluation implements Serializable {
|
||||
private Long id; // 评估记录id
|
||||
private Long modelId; // 关联模型id
|
||||
private LocalDateTime evaluationTime; // 评估时间
|
||||
private String evaluationResult; // 评估结果
|
||||
private String operator; // 评估操作人员
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
/**
|
||||
* @author nh
|
||||
* @description:模型实体类
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ModelInfo implements Serializable {
|
||||
private Long id; // 模型id
|
||||
private String modelName; // 模型名称
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
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 :nh
|
||||
* @description:模型日志实体类
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ModelLog implements Serializable {
|
||||
private Long id; // 日志id
|
||||
private Long modelId; // 关联模型id
|
||||
private Integer logType; // 日志类型(1,2,3...)
|
||||
private String logPath; // 日志存储路径
|
||||
private LocalDateTime logTime; // 日志生成时间
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
/**
|
||||
* @author nh
|
||||
* @description:模型日志视图对象
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ModelLogVO {
|
||||
private Long id; // 日志id
|
||||
private Long modelId; // 关联模型id
|
||||
private String modelName; // 模型名称
|
||||
private String version; // 模型版本
|
||||
private String modelConfig; // 模型配置
|
||||
private Integer logType; // 日志类型(1,2,3...)
|
||||
private String logPath; // 日志存储路径
|
||||
private LocalDateTime logTime; // 日志生成时间
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ModelVO {
|
||||
private Long id; // 模型id
|
||||
private Long versionId; // 用于保证react的map中key的唯一性
|
||||
private String modelName; // 模型名称
|
||||
private String version; // 模型版本
|
||||
private String dataPreHandleFile; // 数据预处理文件存储路径
|
||||
private String operateUser; // 操作人
|
||||
private LocalDateTime updateTime; // 修改时间
|
||||
private Integer status; // 模型状态(1代表上线,0代表不上线)
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
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 :nh
|
||||
* @description:模型版本信息实体类
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ModelVersion implements Serializable {
|
||||
private Long id; // 版本信息表id
|
||||
private Long modelId; // 关联模型id
|
||||
private String version; // 模型版本
|
||||
private Integer datasetId; // 数据集id
|
||||
private String modelConfig; // 模型配置信息
|
||||
private String modelPath; // 模型存储路径
|
||||
private Integer status; // 模型状态(1代表上线,0代表不上线)
|
||||
private LocalDateTime createTime; // 创建时间
|
||||
//补充更新时间字段
|
||||
private LocalDateTime updateTime; // 更新时间
|
||||
//创建模型部分补充的字段
|
||||
private Integer modelSize; // 模型大小
|
||||
private String dataPreHandleFile; // 数据预处理文件存储路径
|
||||
//模型信息管理部分补充的字段
|
||||
private String modelSuperArgs; // 模型超参数
|
||||
private String modelArgsSize; // 模型参数量
|
||||
private String modelSourceCodeUrl; // 模型源代码路径
|
||||
private String modelFile; // 模型文件存储路径
|
||||
private String modelDesignDocument; // 模型设计文档存储路径
|
||||
|
||||
private String lifeCycle; // 模型生命周期
|
||||
|
||||
private String operateUser; // 操作人
|
||||
|
||||
private String modelName; //模型名称
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ModelVersionDTO {
|
||||
private Long id; // 模型id
|
||||
private String version; // 模型版本
|
||||
private Integer datasetId; // 数据集id
|
||||
private String modelConfig; // 模型配置信息
|
||||
private String modelPath; // 模型存储路径
|
||||
private Integer status; // 模型状态(1代表上线,0代表不上线)
|
||||
private LocalDateTime createTime; // 创建时间
|
||||
private LocalDateTime updateTime; // 更新时间
|
||||
private Integer modelSize; // 模型大小
|
||||
private String dataPreHandleFile; // 数据预处理文件存储路径
|
||||
private String modelSuperArgs; // 模型超参数
|
||||
private String modelArgsSize; // 模型参数量
|
||||
private String modelSourceCodeUrl; // 模型源代码路径
|
||||
private String modelFile; // 模型文件存储路径
|
||||
private String modelDesignDocument; // 模型设计文档存储路径
|
||||
private String lifeCycle; // 模型生命周期
|
||||
private String operateUser; // 操作人
|
||||
}
|
@ -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,20 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PageResult implements Serializable {
|
||||
private long total;
|
||||
private List records;
|
||||
|
||||
}
|
@ -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 modelId;
|
||||
private String GPUModel;
|
||||
private String ip;
|
||||
private String GPUMemorySize;
|
||||
}
|
@ -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 ServicePublishDTO implements Serializable {
|
||||
private Long id;
|
||||
private Long modelId;
|
||||
private String apiUrl;
|
||||
private LocalDateTime createTime;
|
||||
private String ip;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
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 GPUModel;
|
||||
private String ip;
|
||||
private String GPUMemorySize;
|
||||
private String apiUrl;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.AlgorithmInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AlgorithmInfoService {
|
||||
AlgorithmInfo getById(Long id);
|
||||
AlgorithmInfo getByName(String algorithmName);
|
||||
List<AlgorithmInfo> getByType(String algorithmType);
|
||||
boolean update(AlgorithmInfo algorithmInfo);
|
||||
boolean delete(Long id);
|
||||
boolean validateAlgorithmInfo(AlgorithmInfo algorithmInfo);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetDTO;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetPageQueryDTO;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.PageResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hky
|
||||
*/
|
||||
public interface DatasetService {
|
||||
void save(DatasetDTO datasetDTO);
|
||||
|
||||
void update(DatasetDTO datasetDTO);
|
||||
|
||||
PageResult pageQuery(DatasetPageQueryDTO dataSetPageQueryDTO);
|
||||
|
||||
void deleteBatch(List<Long> datasetIds);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ModelLogVO;
|
||||
|
||||
public interface EvaluationService {
|
||||
ModelLogVO detail(Long id);
|
||||
|
||||
void startOrStop(Long id, Integer status);
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service.Impl;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.mapper.AlgorithmInfoMapper;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.AlgorithmInfo;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.service.AlgorithmInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AlgorithmInfoServiceImpl implements AlgorithmInfoService {
|
||||
|
||||
@Autowired
|
||||
private AlgorithmInfoMapper algorithmInfoMapper;
|
||||
|
||||
@Override
|
||||
public AlgorithmInfo getById(Long id) {
|
||||
return algorithmInfoMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlgorithmInfo getByName(String algorithmName) {
|
||||
return algorithmInfoMapper.selectByName(algorithmName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AlgorithmInfo> getByType(String algorithmType) {
|
||||
return algorithmInfoMapper.selectByType(algorithmType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean update(AlgorithmInfo algorithmInfo) {
|
||||
if (!validateAlgorithmInfo(algorithmInfo)) {
|
||||
return false;
|
||||
}
|
||||
return algorithmInfoMapper.update(algorithmInfo) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean delete(Long id) {
|
||||
return algorithmInfoMapper.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validateAlgorithmInfo(AlgorithmInfo algorithmInfo) {
|
||||
if (algorithmInfo == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!StringUtils.hasText(algorithmInfo.getAlgorithmName()) ||
|
||||
!StringUtils.hasText(algorithmInfo.getAlgorithmFile()) ||
|
||||
!StringUtils.hasText(algorithmInfo.getAlgorithmType())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service.Impl;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.constant.StatusConstant;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.enumeration.DatasetType;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.mapper.DatasetMapper;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.*;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.service.DatasetService;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
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.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.bipt.intelligentapplicationorchestrationservice.enumeration.DatasetType.FROM_DATABASE;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DatasetServiceImpl implements DatasetService {
|
||||
@Autowired
|
||||
private DatasetMapper datasetMapper;
|
||||
|
||||
/**
|
||||
* 新增数据集
|
||||
* @param datasetDTO
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(DatasetDTO datasetDTO) {
|
||||
//判断数据集类型,如果是本地上传则保存,若用调用数据仓库进入下一步
|
||||
// 获取数据集类型
|
||||
DatasetType datasetType = DatasetType.fromCode(datasetDTO.getDatasetType());
|
||||
// 根据类型处理数据
|
||||
switch (datasetType) {
|
||||
case UPLOAD:
|
||||
//TODO 保存到分布式文件系统
|
||||
break;
|
||||
case FROM_DATABASE:
|
||||
String args = datasetDTO.getArgs();
|
||||
//TODO 根据筛选条件调用数据仓库中的数据
|
||||
|
||||
//TODO 调用数据仓库保存到分布式文件系统
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("不支持的数据集类型: " + datasetType);
|
||||
}
|
||||
|
||||
DatasetEntity datasetEntity = new DatasetEntity();
|
||||
BeanUtils.copyProperties(datasetDTO,datasetEntity);
|
||||
datasetEntity.setDatasetStatus(StatusConstant.ENABLE);
|
||||
datasetEntity.setCreateTime(LocalDateTime.now());
|
||||
datasetEntity.setUpdateTime(LocalDateTime.now());
|
||||
datasetMapper.insert(datasetEntity);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据集
|
||||
*
|
||||
* @param datasetDTO
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void update(DatasetDTO datasetDTO) {
|
||||
/*DatasetEntity datasetEntity = new DatasetEntity();
|
||||
BeanUtils.copyProperties(datasetDTO,datasetEntity);*/
|
||||
DatasetType datasetType = DatasetType.fromCode(datasetDTO.getDatasetType());
|
||||
// 根据类型处理数据
|
||||
switch (datasetType) {
|
||||
case UPLOAD:
|
||||
//TODO 覆盖保存到分布式文件系统中
|
||||
break;
|
||||
case FROM_DATABASE:
|
||||
//TODO 覆盖数据文件
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("不支持的数据集类型: " + datasetType);
|
||||
}
|
||||
DatasetEntity datasetEntity = new DatasetEntity();
|
||||
BeanUtils.copyProperties(datasetDTO,datasetEntity);
|
||||
datasetEntity.setUpdateTime(LocalDateTime.now());
|
||||
datasetMapper.updata(datasetEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param dataSetPageQueryDTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageResult pageQuery(DatasetPageQueryDTO dataSetPageQueryDTO) {
|
||||
PageHelper.startPage(dataSetPageQueryDTO.getPage(), dataSetPageQueryDTO.getPageSize());
|
||||
Page<DatasetVO> page = datasetMapper.pageQuery(dataSetPageQueryDTO);
|
||||
return new PageResult(page.getTotal(), page.getResult());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param datasetIds
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteBatch(List<Long> datasetIds) {
|
||||
|
||||
//TODO 在分布式文件系统中删除
|
||||
datasetMapper.deleteBatch(datasetIds);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service.Impl;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.mapper.EvaluationMapper;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ModelLogVO;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.service.EvaluationService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class EvaluationServiceImpl implements EvaluationService {
|
||||
@Autowired
|
||||
private EvaluationMapper evaluationMapper;
|
||||
/**
|
||||
* 获取日志详情
|
||||
* @param id 模型日志id
|
||||
* @return 日志详情
|
||||
*/
|
||||
@Override
|
||||
public ModelLogVO detail(Long id) {
|
||||
log.info("id:{}", id);
|
||||
ModelLogVO modelLogVO = evaluationMapper.selectLogDetail(id);
|
||||
return modelLogVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 评估模型决定是否上线
|
||||
* @param id 模型id
|
||||
* @param status 模型评估状态,评估通过则上线(1.上线,0.下线)
|
||||
*/
|
||||
@Override
|
||||
public void startOrStop(Long id, Integer status) {
|
||||
evaluationMapper.update(id, status);
|
||||
}
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service.Impl;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.constant.MessageConstant;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.enumeration.ModelLifecycle;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.mapper.ModelMapper;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.*;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.service.ModelService;
|
||||
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.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ModelServiceImpl implements ModelService {
|
||||
@Autowired
|
||||
private ModelMapper modelMapper;
|
||||
/**
|
||||
* 创建模型
|
||||
* @param dto
|
||||
*/
|
||||
@Transactional //事务注解
|
||||
@Override
|
||||
public void createModel(ModelDTO dto) {
|
||||
log.info("创建模型");
|
||||
//1.插入模型基本信息
|
||||
ModelInfo modelInfo = new ModelInfo();
|
||||
BeanUtils.copyProperties(dto, modelInfo, "id");
|
||||
modelMapper.insertModelInfo(modelInfo);
|
||||
log.info("模型id: {}", modelInfo.getId());
|
||||
//2.插入模型版本信息
|
||||
ModelVersion modelVersion = new ModelVersion();
|
||||
//使用工具类将dto属性复制给modelVersion
|
||||
BeanUtils.copyProperties(dto, modelVersion, "id");
|
||||
modelVersion.setModelId(modelInfo.getId());
|
||||
modelVersion.setCreateTime(LocalDateTime.now());
|
||||
modelVersion.setUpdateTime(LocalDateTime.now());
|
||||
modelVersion.setOperateUser("zs");
|
||||
modelMapper.insertModelVersion(modelVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增模型版本
|
||||
* @param dto
|
||||
*/
|
||||
@Override
|
||||
public void createModelVersion(ModelDTO dto) {
|
||||
log.info("新增模型版本");
|
||||
ModelVersion modelVersion = new ModelVersion();
|
||||
BeanUtils.copyProperties(dto, modelVersion, "id");
|
||||
modelVersion.setModelId(dto.getId());
|
||||
modelVersion.setCreateTime(LocalDateTime.now());
|
||||
modelVersion.setUpdateTime(LocalDateTime.now());
|
||||
modelVersion.setOperateUser("zs");
|
||||
modelMapper.insertModelVersion(modelVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询模型列表
|
||||
*/
|
||||
@Override
|
||||
public List<ModelVO> list() {
|
||||
log.info("查询模型列表");
|
||||
List<ModelVO> modelVOList = modelMapper.list();
|
||||
return modelVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelVersion detail(Long id) {
|
||||
log.info("查询模型详情");
|
||||
ModelVersion modelVersion = modelMapper.selectById(id);
|
||||
return modelVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateModel(ModelVersionDTO dto) {
|
||||
log.info("更新模型");
|
||||
modelMapper.update(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteModelVersion(Long id) {
|
||||
log.info("删除模型版本");
|
||||
modelMapper.deleteModelVersion(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新模型生命周期
|
||||
* @param id 版本表id
|
||||
* @param
|
||||
*/
|
||||
@Override
|
||||
public void updateLifeCycle(Long id, String lifeCycleDescription) {
|
||||
log.info("更新模型生命周期");
|
||||
|
||||
// 1. 查询当前生命周期并转为枚举
|
||||
String currentLifeCycleStr = modelMapper.selectLifeCycleById(id);
|
||||
if (currentLifeCycleStr == null) {
|
||||
log.error("未找到对应模型信息,无法更新生命周期");
|
||||
throw new IllegalArgumentException(MessageConstant.LifeCycle_No_Exist);
|
||||
}
|
||||
|
||||
ModelLifecycle currentLifeCycle;
|
||||
ModelLifecycle targetLifeCycle;
|
||||
try {
|
||||
currentLifeCycle = ModelLifecycle.valueOf(currentLifeCycleStr.trim()); // 数据库中是英文
|
||||
targetLifeCycle = ModelLifecycle.fromDescription((lifeCycleDescription).trim()); // 前端传中文
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.error(MessageConstant.LifeCycle_Undefined + ":{}", e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
|
||||
// 2. 业务逻辑校验
|
||||
switch (currentLifeCycle) {
|
||||
case DEPLOYED:
|
||||
if (targetLifeCycle == ModelLifecycle.DESIGNING) {
|
||||
log.error("已部署的模型不能直接调整成设计,需先下线再设计");
|
||||
throw new IllegalArgumentException(MessageConstant.ERROR_DEPLOYED_TO_DESIGNING);
|
||||
}
|
||||
break;
|
||||
case ABANDONED:
|
||||
log.error("已废弃的模型只能查看信息,不能更新生命周期");
|
||||
throw new IllegalArgumentException(MessageConstant.ERROR_ABANDONED_CANNOT_UPDATE);
|
||||
case TRAINING:
|
||||
if (targetLifeCycle != ModelLifecycle.DESIGNING && targetLifeCycle != ModelLifecycle.EVALUATING) {
|
||||
log.error("训练中的模型只能调整成设计和评估");
|
||||
throw new IllegalArgumentException(MessageConstant.ERROR_TRAINING_INVALID_TRANSITION);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// 3. 执行更新
|
||||
int affectedRows = modelMapper.updateLifeCycleById(id, targetLifeCycle.getDbValue());
|
||||
if (affectedRows == 0) {
|
||||
log.error("更新模型生命周期失败");
|
||||
throw new RuntimeException(MessageConstant.UPDATE_FAILURE);
|
||||
}
|
||||
|
||||
log.info("模型生命周期更新成功,新状态为: {}", targetLifeCycle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> listLifeCycle() {
|
||||
return Arrays.stream(ModelLifecycle.values())
|
||||
.map(lifecycle -> Map.of(
|
||||
"code", lifecycle.name(), // 枚举名称(如 "DESIGNING")
|
||||
"description", lifecycle.getDescription() // 中文描述(如 "设计中")
|
||||
))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DatasetEntity> listDataset() {
|
||||
List<DatasetEntity> datasetEntityList = modelMapper.listDataset();
|
||||
return datasetEntityList;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service.Impl;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.mapper.PublishMapper;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
|
||||
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);
|
||||
}
|
||||
|
||||
//todo调用服务部署
|
||||
|
||||
publishMapper.insert(servicePublishDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service.Impl;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.mapper.ServiceAPIMapper;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.service.ServiceAPIService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ServiceAPIImpl implements ServiceAPIService {
|
||||
@Autowired
|
||||
private ServiceAPIMapper serviceAPIMapper;
|
||||
/**
|
||||
* 根据id查找配置信息
|
||||
* @param modelId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getByModelId(Long modelId) {
|
||||
return serviceAPIMapper.getById(modelId);
|
||||
};
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ModelService {
|
||||
void createModel(ModelDTO dto);
|
||||
|
||||
void createModelVersion(ModelDTO dto);
|
||||
|
||||
List<ModelVO> list();
|
||||
|
||||
ModelVersion detail(Long id);
|
||||
|
||||
void updateModel(ModelVersionDTO dto);
|
||||
|
||||
void deleteModelVersion(Long id);
|
||||
|
||||
void updateLifeCycle(Long id, String lifeCycle);
|
||||
|
||||
List<Map<String, String>> listLifeCycle();
|
||||
|
||||
List<DatasetEntity> listDataset();
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
|
||||
|
||||
public interface PublishService {
|
||||
|
||||
void save(ServicePublishDTO servicePublishDTO);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service;
|
||||
|
||||
public interface ServiceAPIService {
|
||||
String getByModelId(Long modelId);
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.util;
|
||||
|
||||
import com.alibaba.nacos.api.naming.NamingFactory;
|
||||
import com.alibaba.nacos.api.naming.NamingService;
|
||||
import com.alibaba.nacos.api.naming.pojo.Instance;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class NacosServiceUtil {
|
||||
|
||||
@Value("${spring.cloud.nacos.discovery.server-addr}")
|
||||
private String nacosServerAddr;
|
||||
|
||||
public void registerService(String serviceName, String ip, int port, String url) throws Exception { // 新增url参数
|
||||
NamingService naming = NamingFactory.createNamingService(nacosServerAddr);
|
||||
Instance instance = new Instance();
|
||||
instance.setIp(ip);
|
||||
instance.setPort(port);
|
||||
// 添加元数据存储URL
|
||||
Map<String, String> metadata = new HashMap<>();
|
||||
metadata.put("url", url); // 将URL存入元数据
|
||||
instance.setMetadata(metadata);
|
||||
naming.registerInstance(serviceName, instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务所有实例IP
|
||||
*/
|
||||
public List<String> getServiceInstances(String serviceName) throws Exception {
|
||||
NamingService naming = NamingFactory.createNamingService(nacosServerAddr);
|
||||
List<Instance> instances = naming.getAllInstances(serviceName);
|
||||
return instances.stream()
|
||||
.map(Instance::getIp)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
10
src/main/resources/bootstrap.properties
Normal file
10
src/main/resources/bootstrap.properties
Normal file
@ -0,0 +1,10 @@
|
||||
# 应用名称(必须与Nacos配置的dataId前缀一致)
|
||||
spring.application.name=intelligent-application-orchestration-service
|
||||
|
||||
# Nacos配置中心地址(引导阶段加载配置)
|
||||
spring.cloud.nacos.config.server-addr=192.168.100.1:8848
|
||||
spring.cloud.nacos.config.data-id=${spring.application.name}.properties
|
||||
spring.cloud.nacos.config.group=DEFAULT_GROUP
|
||||
|
||||
# Nacos服务注册地址(引导阶段注册服务)
|
||||
spring.cloud.nacos.discovery.server-addr=192.168.100.1:8848
|
67
src/main/resources/mapper/DatasetMapper.xml
Normal file
67
src/main/resources/mapper/DatasetMapper.xml
Normal file
@ -0,0 +1,67 @@
|
||||
<?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">
|
||||
<insert id="insert">
|
||||
INSERT INTO dataset
|
||||
(dataset_name,dataset_type,dataset_status,ds_path,args,create_time,update_time)
|
||||
values (#{datasetName}, #{datasetType}, #{datasetStatus}, #{dsPath}, #{args},#{createTime},#{updateTime})
|
||||
</insert>
|
||||
|
||||
<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="updateTime != null">
|
||||
update_time=#{updateTime}
|
||||
</if>
|
||||
</set>
|
||||
where dataset_id = #{datasetId}
|
||||
</update>
|
||||
<delete id="deleteBatch">
|
||||
DELETE FROM dataset
|
||||
WHERE dataset_id IN
|
||||
<foreach collection="datasetIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<select id="pageQuery" resultType="com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetVO">
|
||||
SELECT * FROM dataset
|
||||
<where>
|
||||
<if test="datasetName != null and datasetName!=''">
|
||||
dataset_name LIKE CONCAT('%', #{datasetName}, '%')
|
||||
</if>
|
||||
<if test="datasetType != null">
|
||||
and dataset_type=#{datasetType}
|
||||
</if>
|
||||
<if test="datasetStatus != null">
|
||||
and dataset_status=#{datasetStatus}
|
||||
</if>
|
||||
<if test="dsPath != null">
|
||||
and ds_path=#{dsPath}
|
||||
</if>
|
||||
<if test="args != null">
|
||||
and args=#{args}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time=#{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time=#{updateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
23
src/main/resources/mapper/EvaluationMapper.xml
Normal file
23
src/main/resources/mapper/EvaluationMapper.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?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.EvaluationMapper">
|
||||
<!--查询模型日志详细信息-->
|
||||
<select id="selectLogDetail" resultType="modelLogVO">
|
||||
select m1.*,
|
||||
m2.model_name,
|
||||
m3.model_config, m3.version
|
||||
from model_log m1,
|
||||
model_info m2,
|
||||
model_version m3
|
||||
where m1.model_id=m2.id and m3.model_id=m2.id and m1.model_id = #{id}
|
||||
</select>
|
||||
|
||||
<!--更新模型信息(目前只更新模型是否上线,后续如果更多需求可优化>-->
|
||||
<update id="update">
|
||||
update model_version set
|
||||
<if test="status != null">
|
||||
status=#{status}
|
||||
</if>
|
||||
where model_id=#{id}
|
||||
</update>
|
||||
</mapper>
|
59
src/main/resources/mapper/ModelMapper.xml
Normal file
59
src/main/resources/mapper/ModelMapper.xml
Normal file
@ -0,0 +1,59 @@
|
||||
<?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.ModelMapper">
|
||||
|
||||
<!--(新增新的模型)插入模型版本信息-->
|
||||
<insert id="insertModelVersion">
|
||||
insert into model_version (
|
||||
model_id, version, dataset_id, model_config,
|
||||
model_path, status, create_time, update_time, model_size,
|
||||
data_pre_handle_file, model_super_args, model_args_size, model_source_code_url, model_file,
|
||||
model_design_document, life_cycle, operate_user
|
||||
)
|
||||
values (
|
||||
#{modelId}, #{version}, #{datasetId}, #{modelConfig},
|
||||
#{modelPath}, #{status}, #{createTime}, #{updateTime}, #{modelSize},
|
||||
#{dataPreHandleFile}, #{modelSuperArgs}, #{modelArgsSize}, #{modelSourceCodeUrl}, #{modelFile},
|
||||
#{modelDesignDocument}, #{lifeCycle}, #{operateUser}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!--查询模型列表-->
|
||||
<select id="list" resultType="modelVO">
|
||||
select t1.*,
|
||||
t2.id as versionId,t2.version, t2.version, t2.data_pre_handle_file, t2.operate_user, t2.update_time,
|
||||
t2.status
|
||||
from model_info t1
|
||||
left join model_version t2 on t1.id = t2.model_id
|
||||
order by t2.update_time desc
|
||||
</select>
|
||||
|
||||
<!--查询模型详细信息-->
|
||||
<select id="selectById" resultType="modelVersion">
|
||||
SELECT
|
||||
t1.model_name,
|
||||
t2.version, t2.dataset_id, t2.model_config,
|
||||
t2.model_path, t2.status, t2.create_time, t2.update_time, t2.model_size,
|
||||
t2.data_pre_handle_file, t2.model_super_args, t2.model_args_size, t2.model_source_code_url, t2.model_file,
|
||||
t2.model_design_document, t2.life_cycle, t2.operate_user
|
||||
FROM model_info t1 JOIN model_version t2 ON t1.id = t2.model_id
|
||||
where t2.id = #{id}
|
||||
</select>
|
||||
|
||||
<!--更新模型信息-->
|
||||
<update id="update">
|
||||
UPDATE model_version
|
||||
<set>
|
||||
<if test="modelSize != null">
|
||||
model_size = #{modelSize},
|
||||
</if>
|
||||
<if test="modelSuperArgs != null">
|
||||
model_super_args = #{modelSuperArgs},
|
||||
</if>
|
||||
<if test="modelArgsSize != null">
|
||||
model_args_size = #{modelArgsSize},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id
|
||||
</update>
|
||||
</mapper>
|
20
src/main/resources/mapper/PublishMapper.xml
Normal file
20
src/main/resources/mapper/PublishMapper.xml
Normal 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>
|
@ -1,13 +1,24 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
@SpringBootTest
|
||||
class IntelligentApplicationOrchestrationServiceApplicationTests {
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
@Test
|
||||
void contextLoads() {
|
||||
void contextLoads() throws SQLException {
|
||||
// 尝试获取连接
|
||||
assertNotNull(dataSource.getConnection(), "无法获取数据库连接!");
|
||||
System.out.println("数据库连接成功!");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,53 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.redis.core.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@SpringBootTest
|
||||
public class RedisTest {
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
@Test
|
||||
public void testRedisTemplate(){
|
||||
System.out.println(redisTemplate);
|
||||
ValueOperations valueOperations = redisTemplate.opsForValue();
|
||||
HashOperations hashOperations = redisTemplate.opsForHash();
|
||||
ListOperations listOperations = redisTemplate.opsForList();
|
||||
SetOperations setOperations = redisTemplate.opsForSet();
|
||||
ZSetOperations zSetOperations = redisTemplate.opsForZSet();
|
||||
}
|
||||
@Test
|
||||
public void testString(){
|
||||
//set get setex setnx
|
||||
redisTemplate.opsForValue().set("name","小明");
|
||||
String city =(String) redisTemplate.opsForValue().get("name");
|
||||
System.out.println(city);
|
||||
redisTemplate.opsForValue().set("code","1234",3, TimeUnit.MINUTES);
|
||||
redisTemplate.opsForValue().setIfAbsent("lock","1");
|
||||
redisTemplate.opsForValue().setIfAbsent("lock","2");
|
||||
}
|
||||
@Test
|
||||
public void testHash(){
|
||||
// hset hget hdel hkeys hvals
|
||||
HashOperations hashOperations = redisTemplate.opsForHash();
|
||||
hashOperations.put("100","name","tom");
|
||||
hashOperations.put("100","age","20");
|
||||
|
||||
String name = (String) hashOperations.get("100", "name");
|
||||
System.out.println(name);
|
||||
|
||||
Set keys = hashOperations.keys("100");
|
||||
System.out.println(keys);
|
||||
List values = hashOperations.values("100");
|
||||
System.out.println(values);
|
||||
hashOperations.delete("100","age");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user