Compare commits
6 Commits
f499e53dad
...
nh
Author | SHA1 | Date | |
---|---|---|---|
ae97005a7c | |||
fb2ee66b5b | |||
5ef521438a | |||
ed4cd0643a | |||
02538ef4f4 | |||
d219fbc92a |
@ -102,5 +102,31 @@ public class ModelController {
|
||||
return OptResult.success(datasetList);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取模型训练信息")
|
||||
@GetMapping("/getModelTrainInfo")
|
||||
public OptResult getModelTrainInfo(Long id){
|
||||
log.info("获取模型训练信息");
|
||||
ModelTrainInfoVO modelTrainInfo = modelService.getModelTrainInfo(id);
|
||||
return OptResult.success(modelTrainInfo);
|
||||
}
|
||||
|
||||
@Operation(summary = "模型修改成训练中")
|
||||
@PutMapping("/updateModelTrain")
|
||||
public OptResult updateModelTrain(Long id){
|
||||
log.info("模型修改成训练中");
|
||||
modelService.updateModelTrain(id);
|
||||
return OptResult.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "模型更新小版本")
|
||||
@PutMapping("/updateModelVersionMinor")
|
||||
public OptResult updateModelVersionMinor(@RequestBody ModelVersionDTO dto){
|
||||
log.info("模型更新小版本");
|
||||
modelService.updateModelVersionMinor(dto);
|
||||
return OptResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.bipt.intelligentapplicationorchestrationservice.controller;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.config.IpConfig;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.entity.DeployRequest;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.entity.ModelSelectVO;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.mapper.ModelMapper;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.*;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.service.ModelDeployer;
|
||||
@ -49,7 +48,7 @@ public class PublishController {
|
||||
//调用模型部署
|
||||
DeployRequest request = new DeployRequest();
|
||||
Long modelId = servicePublishDTO.getModelId();
|
||||
ModelVersion modelVersion = modelMapper.selectByModelId(modelId);
|
||||
ModelVersion modelVersion = modelMapper.selectById(modelId);
|
||||
String modelConfig = modelVersion.getModelConfig();
|
||||
//假设modelConfig只存GPU数据
|
||||
request.setModelId(String.valueOf(modelId));
|
||||
@ -108,10 +107,4 @@ public class PublishController {
|
||||
log.info("返回列表;{}",ips);
|
||||
return OptResult.success(ips);
|
||||
}
|
||||
@GetMapping("/config/ids")
|
||||
public OptResult<List<ModelSelectVO>> getModelNames(){
|
||||
List<ModelSelectVO> modelSelectVOS = publishService.getModelNames();
|
||||
log.info("获取到模型列表:{}",modelSelectVOS);
|
||||
return OptResult.success(modelSelectVOS);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ModelSelectVO {
|
||||
private Long modelId; // 模型ID(即modelId,对应ModelVersion的id)
|
||||
private String modelName; // 模型名称(如"图像识别模型")
|
||||
private String version; // 版本信息(如"v1.0.0")
|
||||
}
|
@ -5,14 +5,14 @@ import com.bipt.intelligentapplicationorchestrationservice.pojo.ModelLogVO;
|
||||
public interface EvaluationMapper {
|
||||
/*
|
||||
* 查询模型评估日志详情
|
||||
* @param id 模型评估日志id
|
||||
* @param id 模型版本id
|
||||
* @return 模型评估日志详情
|
||||
*/
|
||||
ModelLogVO selectLogDetail(Long id);
|
||||
|
||||
/*
|
||||
* 更新模型评估日志状态(评估通过则上线)
|
||||
* @param id 模型评估日志id
|
||||
* @param id 模型版本id
|
||||
* @param status 模型评估日志状态
|
||||
*/
|
||||
void update(Long id, Integer status);
|
||||
|
@ -77,5 +77,10 @@ public interface ModelMapper {
|
||||
@Select("select dataset_id,dataset_name from dataset")
|
||||
List<DatasetEntity> listDataset();
|
||||
|
||||
ModelVersion selectByModelId(Long modelId);
|
||||
/**
|
||||
* 获取模型训练信息
|
||||
* @param id 模型版本表id
|
||||
* 返回模型训练信息
|
||||
*/
|
||||
ModelTrainInfoVO getModelTrainInfo(Long id);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.mapper;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.entity.ModelSelectVO;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ModelVersion;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -19,11 +19,4 @@ public interface PublishMapper {
|
||||
|
||||
@Select("SELECT model_id,api_url,ip FROM service_publish")
|
||||
List<ServicePublishVO> listPublishedServices();
|
||||
@Select("SELECT " +
|
||||
"mv.model_id AS modelId, " +
|
||||
"m.model_name AS modelName, " +
|
||||
"mv.version AS version " +
|
||||
"FROM model_version mv " +
|
||||
"LEFT JOIN model_info m ON mv.model_id = m.id")
|
||||
List<ModelSelectVO> selectModelSelectList();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import java.time.LocalDateTime;
|
||||
@AllArgsConstructor
|
||||
public class ModelEvaluation implements Serializable {
|
||||
private Long id; // 评估记录id
|
||||
private Long modelId; // 关联模型id
|
||||
private Long modelVersionId; // 关联模型id,后续修改成了模型版本id
|
||||
private LocalDateTime evaluationTime; // 评估时间
|
||||
private String evaluationResult; // 评估结果
|
||||
private String operator; // 评估操作人员
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ModelTrainInfoVO {
|
||||
private Long id;
|
||||
private Integer datasetId; // 数据集id
|
||||
private String modelConfig; // 模型配置信息
|
||||
private String dsPath;// 版本信息表id
|
||||
private String dataPreHandleFile; // 数据预处理文件存储路径
|
||||
}
|
@ -12,6 +12,7 @@ import java.time.LocalDateTime;
|
||||
@AllArgsConstructor
|
||||
public class ModelVersionDTO {
|
||||
private Long id; // 模型版本id
|
||||
private Long modelId; // 模型id
|
||||
private String version; // 模型版本
|
||||
private Integer datasetId; // 数据集id
|
||||
private String modelConfig; // 模型配置信息
|
||||
|
@ -72,6 +72,10 @@ public class ModelServiceImpl implements ModelService {
|
||||
return modelVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询模型详情
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public ModelVersion detail(Long id) {
|
||||
log.info("查询模型详情");
|
||||
@ -79,13 +83,23 @@ public class ModelServiceImpl implements ModelService {
|
||||
return modelVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新模型
|
||||
* @param dto
|
||||
*/
|
||||
@Override
|
||||
public void updateModel(ModelVersionDTO dto) {
|
||||
// 更新模型还需要更新操作人和时间
|
||||
// TODO: 更新模型还需要更新操作人和时间
|
||||
log.info("更新模型");
|
||||
dto.setCreateTime(LocalDateTime.now());
|
||||
dto.setUpdateTime(LocalDateTime.now());
|
||||
modelMapper.update(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模型版本
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void deleteModelVersion(Long id) {
|
||||
log.info("删除模型版本");
|
||||
@ -149,6 +163,9 @@ public class ModelServiceImpl implements ModelService {
|
||||
log.info("模型生命周期更新成功,新状态为: {}", targetLifeCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模型生命周期列表
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, String>> listLifeCycle() {
|
||||
return Arrays.stream(ModelLifecycle.values())
|
||||
@ -159,6 +176,9 @@ public class ModelServiceImpl implements ModelService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模型数据集列表
|
||||
*/
|
||||
@Override
|
||||
public List<DatasetEntity> listDataset() {
|
||||
List<DatasetEntity> datasetEntityList = modelMapper.listDataset();
|
||||
@ -166,4 +186,41 @@ public class ModelServiceImpl implements ModelService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模型训练信息
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public ModelTrainInfoVO getModelTrainInfo(Long id) {
|
||||
ModelTrainInfoVO modelTrainInfoVO = modelMapper.getModelTrainInfo(id);
|
||||
return modelTrainInfoVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型训练(把模型修改成训练中)
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void updateModelTrain(Long id) {
|
||||
// 更新当前模型的生命周期为训练中
|
||||
modelMapper.updateLifeCycleById(id, ModelLifecycle.TRAINING.getDbValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型小版本更新
|
||||
* @param dto
|
||||
*/
|
||||
@Override
|
||||
public void updateModelVersionMinor(ModelVersionDTO dto) {
|
||||
// 更新模型小版本(其实是新增一个小版本)
|
||||
ModelVersion modelVersion = new ModelVersion();
|
||||
BeanUtils.copyProperties(dto, modelVersion, "id", "modelId");
|
||||
modelVersion.setModelId(dto.getModelId()); // 把模型id设置成该模型版本关联的模型id
|
||||
modelVersion.setCreateTime(LocalDateTime.now());
|
||||
modelVersion.setUpdateTime(LocalDateTime.now());
|
||||
modelVersion.setOperateUser("zs");
|
||||
// TODO: 后续可能还需要更新操作人
|
||||
modelMapper.insertModelVersion(modelVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service.Impl;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.entity.ModelSelectVO;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.mapper.PublishMapper;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishVO;
|
||||
@ -10,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -35,6 +33,8 @@ public class PublishServiceImpl implements PublishService {
|
||||
throw new IllegalArgumentException("请求已存在: " + apiUrl);
|
||||
}
|
||||
|
||||
//todo调用服务部署
|
||||
|
||||
publishMapper.insert(servicePublishDTO);
|
||||
}
|
||||
|
||||
@ -43,10 +43,5 @@ public class PublishServiceImpl implements PublishService {
|
||||
return publishMapper.listPublishedServices();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ModelSelectVO> getModelNames() {
|
||||
return publishMapper.selectModelSelectList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -23,4 +23,10 @@ public interface ModelService {
|
||||
List<Map<String, String>> listLifeCycle();
|
||||
|
||||
List<DatasetEntity> listDataset();
|
||||
|
||||
ModelTrainInfoVO getModelTrainInfo(Long id);
|
||||
|
||||
void updateModelTrain(Long id);
|
||||
|
||||
void updateModelVersionMinor(ModelVersionDTO dto);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.bipt.intelligentapplicationorchestrationservice.service;
|
||||
|
||||
import com.bipt.intelligentapplicationorchestrationservice.entity.ModelSelectVO;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
|
||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishVO;
|
||||
|
||||
@ -12,6 +11,4 @@ public interface PublishService {
|
||||
|
||||
|
||||
List<ServicePublishVO> listPublishedServices();
|
||||
|
||||
List<ModelSelectVO> getModelNames();
|
||||
}
|
||||
|
5
src/main/resources/application-dev.properties
Normal file
5
src/main/resources/application-dev.properties
Normal file
@ -0,0 +1,5 @@
|
||||
# 阿里云OSS配置
|
||||
aliyun.oss.endpoint=oss-cn-beijing.aliyuncs.com
|
||||
aliyun.oss.bucketName=ipz-nh
|
||||
aliyun.oss.accessKeyId=LTAI5tBeto7V7BPWBcCjeP7A
|
||||
aliyun.oss.accessKeySecret=bjQGt2G4J5yetxuY5cT5ZnKnIOqe4O
|
@ -9,7 +9,7 @@
|
||||
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}
|
||||
where m1.model_version_id=m3.id and m3.model_id=m2.id and m1.model_version_id = #{id}
|
||||
</select>
|
||||
|
||||
<!--更新模型信息(目前只更新模型是否上线,后续如果更多需求可优化>-->
|
||||
|
@ -31,25 +31,14 @@
|
||||
<!--查询模型详细信息-->
|
||||
<select id="selectById" resultType="com.bipt.intelligentapplicationorchestrationservice.pojo.ModelVersion">
|
||||
SELECT
|
||||
t1.model_name,
|
||||
t2.version, t2.dataset_id, t2.model_config,
|
||||
t1.model_name, t1.id modelId,
|
||||
t2.version, t2.dataset_id, t2.model_config, t2.id,
|
||||
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>
|
||||
<select id="selectByModelId"
|
||||
resultType="com.bipt.intelligentapplicationorchestrationservice.pojo.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.model_id = #{id}
|
||||
</select>
|
||||
|
||||
<!--更新模型信息-->
|
||||
<update id="update">
|
||||
@ -73,4 +62,15 @@
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!--获取模型训练信息-->
|
||||
<select id="getModelTrainInfo" resultType="com.bipt.intelligentapplicationorchestrationservice.pojo.ModelTrainInfoVO">
|
||||
select m1.dataset_id,
|
||||
m1.id,
|
||||
m1.model_config,
|
||||
d2.ds_path,
|
||||
m1.data_pre_handle_file
|
||||
from model_version m1,dataset d2
|
||||
where m1.dataset_id=d2.dataset_id and m1.id=#{id}
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user