From fe9e9ed2caadd59434e6ce72d33ca42b4b625fcf Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Sat, 16 Nov 2024 16:21:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=9C=BA=E5=99=A8=E5=AD=A6?= =?UTF-8?q?=E4=B9=A0=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/autoML/AutoMLController.java | 48 +++- .../com/ruoyi/platform/domain/AutoMlIns.java | 77 ++++++ .../com/ruoyi/platform/mapper/AutoMLDao.java | 2 +- .../ruoyi/platform/mapper/AutoMLInsDao.java | 21 ++ .../ruoyi/platform/service/AutoMLService.java | 19 +- .../service/impl/AutoMLServiceImpl.java | 223 +++++++++++++++++- .../service/impl/JupyterServiceImpl.java | 2 - .../managementPlatform/AutoMLDaoMapper.xml | 2 +- .../managementPlatform/AutoMLInsDaoMapper.xml | 132 +++++++++++ 9 files changed, 514 insertions(+), 12 deletions(-) create mode 100644 ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/AutoMlIns.java create mode 100644 ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/AutoMLInsDao.java create mode 100644 ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/AutoMLInsDaoMapper.xml diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/autoML/AutoMLController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/autoML/AutoMLController.java index 8b0c9a74..47e291ee 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/autoML/AutoMLController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/autoML/AutoMLController.java @@ -1,14 +1,17 @@ package com.ruoyi.platform.controller.autoML; import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.GenericsAjaxResult; import com.ruoyi.platform.domain.AutoMl; +import com.ruoyi.platform.domain.AutoMlIns; import com.ruoyi.platform.service.AutoMLService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; @@ -24,7 +27,7 @@ public class AutoMLController extends BaseController { @ApiOperation("分页查询") public GenericsAjaxResult> queryByPage(@RequestParam("page") int page, @RequestParam("size") int size, - @RequestParam(value = "mlName", required = false) String mlName) { + @RequestParam(value = "ml_name", required = false) String mlName) { PageRequest pageRequest = PageRequest.of(page, size); return genericsSuccess(this.autoMLService.queryByPage(mlName, pageRequest)); } @@ -37,14 +40,53 @@ public class AutoMLController extends BaseController { @PutMapping @ApiOperation("编辑自动机器学习") - public GenericsAjaxResult editAutoMl(@RequestBody AutoMl autoMl){ + public GenericsAjaxResult editAutoMl(@RequestBody AutoMl autoMl) { return genericsSuccess(this.autoMLService.edit(autoMl)); } @DeleteMapping("{id}") @ApiOperation("删除自动机器学习") - public GenericsAjaxResult deleteAutoMl(@PathVariable("id") Long id){ + public GenericsAjaxResult deleteAutoMl(@PathVariable("id") Long id) { return genericsSuccess(this.autoMLService.delete(id)); } + @GetMapping("/autoMlIns") + @ApiOperation("分页查询自动机器学习实例") + public GenericsAjaxResult> queryByPage(@RequestParam("page") int page, + @RequestParam("size") int size, + @RequestParam("auto_ml_id") Long autoMlId) { + PageRequest pageRequest = PageRequest.of(page, size); + return genericsSuccess(this.autoMLService.queryAutoMlInsByPage(autoMlId, pageRequest)); + } + + @PostMapping("/autoMlIns") + @ApiOperation("新增自动机器学习实例") + public GenericsAjaxResult addAutoMlIns(@RequestBody AutoMlIns autoMlIns) throws Exception { + return genericsSuccess(this.autoMLService.saveAutoMlIns(autoMlIns)); + } + + @PutMapping("/autoMlIns") + @ApiOperation("编辑自动机器学习实例") + public GenericsAjaxResult editAutoMlIns(@RequestBody AutoMlIns autoMlIns) throws Exception { + return genericsSuccess(this.autoMLService.editAutoMlIns(autoMlIns)); + } + + @DeleteMapping("/autoMlIns/{id}") + @ApiOperation("删除自动机器学习实例") + public GenericsAjaxResult deleteAutoMlIns(@PathVariable("id") Long id) { + return genericsSuccess(this.autoMLService.deleteAutoMlIns(id)); + } + + @CrossOrigin(origins = "*", allowedHeaders = "*") + @PostMapping("/upload") + @ApiOperation(value = "上传数据文件csv", notes = "上传数据文件csv,并将信息存入数据库。") + public AjaxResult upload(@RequestParam("file") MultipartFile file, @RequestParam("uuid") String uuid) throws Exception { + return AjaxResult.success(this.autoMLService.upload(file, uuid)); + } + + @PostMapping("{id}") + @ApiOperation("运行自动机器学习实验") + public GenericsAjaxResult runAutoML(@PathVariable("id") Long id) throws Exception { + return genericsSuccess(this.autoMLService.runAutoMlIns(id)); + } } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/AutoMlIns.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/AutoMlIns.java new file mode 100644 index 00000000..653c212d --- /dev/null +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/AutoMlIns.java @@ -0,0 +1,77 @@ +package com.ruoyi.platform.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import com.ruoyi.platform.vo.VersionVo; +import lombok.Data; + +import java.util.Date; + +@Data +@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) +public class AutoMlIns { + private Long id; + + private Long autoMlId; + + private String taskType; + + private String datasetName; + + private Integer timeLeftForThisTask; + + private Integer perRunTimeLimit; + + private Integer ensembleSize; + + private String ensembleClass; + + private Integer ensembleNbest; + + private Integer maxModelsOnDisc; + + private Integer seed; + + private Integer memoryLimit; + + private String includeClassifier; + + private String includeFeaturePreprocessor; + + private String includeRegressor; + + private String excludeClassifier; + + private String excludeRegressor; + + private String excludeFeaturePreprocessor; + + private String resamplingStrategy; + + private Float trainSize; + + private Boolean shuffle; + + private Integer folds; + + private Boolean deleteTmpFolderAfterTerminate; + + private String dataCsv; + + private String targetColumns; + + private Integer state; + + private String createBy; + + private String updateBy; + + private Date createTime; + + private Date updateTime; + + @TableField(exist = false) + private VersionVo versionVo; + +} diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/AutoMLDao.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/AutoMLDao.java index ed68d8a9..b10f5235 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/AutoMLDao.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/AutoMLDao.java @@ -11,7 +11,7 @@ public interface AutoMLDao { List queryByPage(@Param("mlName") String mlName, @Param("pageable") Pageable pageable); - AutoMl getAutoById(@Param("id") Long id); + AutoMl getAutoMlById(@Param("id") Long id); int save(@Param("autoMl") AutoMl autoMl); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/AutoMLInsDao.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/AutoMLInsDao.java new file mode 100644 index 00000000..a541fc53 --- /dev/null +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/AutoMLInsDao.java @@ -0,0 +1,21 @@ +package com.ruoyi.platform.mapper; + +import com.ruoyi.platform.domain.AutoMlIns; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +public interface AutoMLInsDao { + long count(@Param("autoMlId") Long autoMlId); + + List queryByPage(@Param("autoMlId") Long autoMlId, @Param("pageable") Pageable pageable); + + int save(@Param("autoMlIns") AutoMlIns autoMlIns); + + int edit(@Param("autoMlIns") AutoMlIns autoMlIns); + + AutoMlIns getById(@Param("id") Long id); + + AutoMlIns findByDatasetName(@Param("datasetName") String datasetName, @Param("autoMlId") Long autoMlId); +} diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AutoMLService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AutoMLService.java index ce06b9c4..d475d5a3 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AutoMLService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AutoMLService.java @@ -1,15 +1,32 @@ package com.ruoyi.platform.service; import com.ruoyi.platform.domain.AutoMl; +import com.ruoyi.platform.domain.AutoMlIns; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.Map; public interface AutoMLService { - Page queryByPage(String mlName, PageRequest pageRequest); + Page queryByPage(String mlName, PageRequest pageRequest); AutoMl save(AutoMl autoMl); String edit(AutoMl autoMl); String delete(Long id); + + Page queryAutoMlInsByPage(Long autoMlId, PageRequest pageRequest); + + AutoMlIns saveAutoMlIns(AutoMlIns autoMlIns) throws Exception; + + String editAutoMlIns(AutoMlIns autoMlIns) throws Exception; + + String deleteAutoMlIns(Long id); + + Map upload(MultipartFile file, String uuid) throws Exception; + + String runAutoMlIns(Long id) throws Exception; } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMLServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMLServiceImpl.java index 4504c4f7..19bb878b 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMLServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AutoMLServiceImpl.java @@ -3,22 +3,57 @@ package com.ruoyi.platform.service.impl; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.platform.constant.Constant; import com.ruoyi.platform.domain.AutoMl; +import com.ruoyi.platform.domain.AutoMlIns; import com.ruoyi.platform.mapper.AutoMLDao; +import com.ruoyi.platform.mapper.AutoMLInsDao; import com.ruoyi.platform.service.AutoMLService; -import com.ruoyi.system.api.model.LoginUser; +import com.ruoyi.platform.utils.DVCUtils; +import com.ruoyi.platform.utils.FileUtil; +import com.ruoyi.platform.utils.K8sClientUtil; +import io.kubernetes.client.openapi.models.V1Pod; +import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.io.File; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; @Service("autoMLService") public class AutoMLServiceImpl implements AutoMLService { + @Value("${harbor.serviceNS}") + private String serviceNS; + @Value("${dockerpush.proxyUrl}") + private String proxyUrl; + @Value("${dockerpush.mountPath}") + private String mountPath; + @Value("${minio.pvcName}") + private String pvcName; + @Value("${automl.image}") + private String image; + @Value("${git.localPath}") + String localPath; + + private static final Logger logger = LoggerFactory.getLogger(ModelsServiceImpl.class); + @Resource private AutoMLDao autoMLDao; + @Resource + private AutoMLInsDao autoMLInsDao; + @Resource + private K8sClientUtil k8sClientUtil; + @Resource + private DVCUtils dvcUtils; @Override public Page queryByPage(String mlName, PageRequest pageRequest) { @@ -29,25 +64,29 @@ public class AutoMLServiceImpl implements AutoMLService { @Override public AutoMl save(AutoMl autoMl) { + String username = SecurityUtils.getLoginUser().getUsername(); + autoMl.setCreateBy(username); + autoMl.setUpdateBy(username); autoMLDao.save(autoMl); return autoMl; } @Override public String edit(AutoMl autoMl) { + String username = SecurityUtils.getLoginUser().getUsername(); + autoMl.setUpdateBy(username); autoMLDao.edit(autoMl); return "修改成功"; } @Override public String delete(Long id) { - AutoMl autoMl = autoMLDao.getAutoById(id); + AutoMl autoMl = autoMLDao.getAutoMlById(id); if (autoMl == null) { throw new RuntimeException("服务不存在"); } - LoginUser loginUser = SecurityUtils.getLoginUser(); - String username = loginUser.getUsername(); + String username = SecurityUtils.getLoginUser().getUsername(); String createBy = autoMl.getCreateBy(); if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createBy))) { throw new RuntimeException("无权限删除该服务"); @@ -56,4 +95,180 @@ public class AutoMLServiceImpl implements AutoMLService { autoMl.setState(Constant.State_invalid); return autoMLDao.edit(autoMl) > 0 ? "删除成功" : "删除失败"; } + + @Override + public Page queryAutoMlInsByPage(Long autoMlId, PageRequest pageRequest) { + long total = autoMLInsDao.count(autoMlId); + List autoMlIns = autoMLInsDao.queryByPage(autoMlId, pageRequest); + return new PageImpl<>(autoMlIns, pageRequest, total); + } + + @Override + public AutoMlIns saveAutoMlIns(AutoMlIns autoMlIns) throws Exception { + String ci4sUsername = SecurityUtils.getLoginUser().getUsername(); + AutoMlIns oldAutoMlIns = autoMLInsDao.findByDatasetName(autoMlIns.getDatasetName(), autoMlIns.getAutoMlId()); + if (oldAutoMlIns != null) { + throw new RuntimeException("数据集名称已存在"); + } + + String sourcePath = autoMlIns.getVersionVo().getUrl(); + String rootPath = localPath + ci4sUsername + "/automl/" + autoMlIns.getAutoMlId() + "/" + autoMlIns.getDatasetName(); + dvcUtils.moveFiles(sourcePath, rootPath); + autoMlIns.setDataCsv(rootPath + "/" + autoMlIns.getVersionVo().getFileName()); + autoMlIns.setCreateBy(ci4sUsername); + autoMlIns.setUpdateBy(ci4sUsername); + autoMLInsDao.save(autoMlIns); + return autoMlIns; + } + + @Override + public String editAutoMlIns(AutoMlIns autoMlIns) throws Exception { + AutoMlIns oldAutoMlIns = autoMLInsDao.findByDatasetName(autoMlIns.getDatasetName(), autoMlIns.getAutoMlId()); + if (oldAutoMlIns != null && !oldAutoMlIns.getId().equals(autoMlIns.getId())) { + throw new RuntimeException("数据集名称已存在"); + } + String ci4sUsername = SecurityUtils.getLoginUser().getUsername(); + autoMlIns.setUpdateBy(ci4sUsername); + if (autoMlIns.getVersionVo() != null && StringUtils.isNotEmpty(autoMlIns.getVersionVo().getUrl())) { + String sourcePath = autoMlIns.getVersionVo().getUrl(); + String rootPath = localPath + ci4sUsername + "/automl/" + autoMlIns.getAutoMlId() + "/" + autoMlIns.getDatasetName(); + dvcUtils.moveFiles(sourcePath, rootPath); + autoMlIns.setDataCsv(rootPath + "/" + autoMlIns.getVersionVo().getFileName()); + } + autoMLInsDao.edit(autoMlIns); + return "修改成功"; + } + + @Override + public String deleteAutoMlIns(Long id) { + AutoMlIns autoMlIns = autoMLInsDao.getById(id); + if (autoMlIns == null) { + throw new RuntimeException("实例不存在"); + } + String username = SecurityUtils.getLoginUser().getUsername(); + String createBy = autoMlIns.getCreateBy(); + if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createBy))) { + throw new RuntimeException("无权限删除该实例"); + } + autoMlIns.setState(Constant.State_invalid); + return autoMLInsDao.edit(autoMlIns) > 0 ? "删除成功" : "删除失败"; + } + + @Override + public Map upload(MultipartFile file, String uuid) throws Exception { + Map result = new HashMap<>(); + + String username = SecurityUtils.getLoginUser().getUsername(); + String fileName = file.getOriginalFilename(); + String path = localPath + "temp/" + username + "/automl_data/" + uuid; + long sizeInBytes = file.getSize(); + String formattedSize = FileUtil.formatFileSize(sizeInBytes); + File targetFile = new File(path, file.getOriginalFilename()); + // 确保目录存在 + targetFile.getParentFile().mkdirs(); + // 保存文件到目标路径 + FileUtils.copyInputStreamToFile(file.getInputStream(), targetFile); + // 返回上传文件的路径 + result.put("fileName", fileName); + result.put("url", path); // objectName根据实际情况定义 + result.put("fileSize", formattedSize); + return result; + } + + @Override + public String runAutoMlIns(Long id) throws Exception { + AutoMlIns autoMlIns = autoMLInsDao.getById(id); + if (autoMlIns == null) { + throw new Exception("开发环境配置不存在"); + } + + StringBuffer command = new StringBuffer(); + command.append("nohup python /opt/automl.py --task_type " + autoMlIns.getTaskType()); + if (StringUtils.isNotEmpty(autoMlIns.getDataCsv())) { + command.append(" --data_csv " + autoMlIns.getDataCsv()); + } else { + throw new Exception("训练数据为空"); + } + if (StringUtils.isNotEmpty(autoMlIns.getTargetColumns())) { + command.append(" --target_columns " + autoMlIns.getTargetColumns()); + } else { + throw new Exception("目标列为空"); + } + if (StringUtils.isNotEmpty(autoMlIns.getDatasetName())) { + command.append(" --dataset_name " + autoMlIns.getDatasetName()); + } else { + throw new Exception("数据集名称为空"); + } + +// String username = SecurityUtils.getLoginUser().getUsername().toLowerCase(); + String username = "admin"; + //构造pod名称 + String podName = username + "-autoMlIns-pod-" + id; + V1Pod pod = k8sClientUtil.createPodWithEnv(podName, serviceNS, proxyUrl, mountPath, pvcName, image); + + if (autoMlIns.getTimeLeftForThisTask() != null) { + command.append(" --time_left_for_this_task " + autoMlIns.getTimeLeftForThisTask()); + } + if (autoMlIns.getPerRunTimeLimit() != null) { + command.append(" --per_run_time_limit " + autoMlIns.getPerRunTimeLimit()); + } + if (autoMlIns.getEnsembleSize() != null) { + command.append(" --ensemble_size " + autoMlIns.getEnsembleSize()); + } + if (StringUtils.isNotEmpty(autoMlIns.getEnsembleClass())) { + command.append(" --ensemble_class " + autoMlIns.getEnsembleClass()); + } + if (autoMlIns.getEnsembleNbest() != null) { + command.append(" --ensemble_nbest " + autoMlIns.getEnsembleNbest()); + } + if (autoMlIns.getMaxModelsOnDisc() != null) { + command.append(" --max_models_on_disc " + autoMlIns.getMaxModelsOnDisc()); + } + if (autoMlIns.getSeed() != null) { + command.append(" --seed " + autoMlIns.getSeed()); + } + if (autoMlIns.getMemoryLimit() != null) { + command.append(" --memory_limit " + autoMlIns.getMemoryLimit()); + } + if (StringUtils.isNotEmpty(autoMlIns.getIncludeClassifier())) { + command.append(" --include_classifier " + autoMlIns.getIncludeClassifier()); + } + if (StringUtils.isNotEmpty(autoMlIns.getIncludeRegressor())) { + command.append(" --include_regressor " + autoMlIns.getIncludeRegressor()); + } + if (StringUtils.isNotEmpty(autoMlIns.getIncludeFeaturePreprocessor())) { + command.append(" --include_feature_preprocessor " + autoMlIns.getIncludeFeaturePreprocessor()); + } + if (StringUtils.isNotEmpty(autoMlIns.getExcludeClassifier())) { + command.append(" --exclude_classifier " + autoMlIns.getExcludeClassifier()); + } + if (StringUtils.isNotEmpty(autoMlIns.getExcludeRegressor())) { + command.append(" --exclude_regressor " + autoMlIns.getExcludeRegressor()); + } + if (StringUtils.isNotEmpty(autoMlIns.getExcludeFeaturePreprocessor())) { + command.append(" --exclude_feature_preprocessor " + autoMlIns.getExcludeFeaturePreprocessor()); + } + if (StringUtils.isNotEmpty(autoMlIns.getResamplingStrategy())) { + command.append(" --resampling_strategy " + autoMlIns.getResamplingStrategy()); + } + if (autoMlIns.getTrainSize() != null) { + command.append(" --train_size " + autoMlIns.getTrainSize()); + } + if (autoMlIns.getShuffle() != null) { + command.append(" --shuffle " + autoMlIns.getShuffle()); + } + if (autoMlIns.getFolds() != null) { + command.append(" --folds " + autoMlIns.getFolds()); + } + command.append(" &"); + CompletableFuture.supplyAsync(() -> { + try { + String log = k8sClientUtil.executeCommand(pod, String.valueOf(command)); + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + return null; + }); + return "执行成功"; + } } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java index 87111365..02cb59a2 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java @@ -104,8 +104,6 @@ public class JupyterServiceImpl implements JupyterService { // String pvcName = loginUser.getUsername().toLowerCase() + "-editor-pvc"; // V1PersistentVolumeClaim pvc = k8sClientUtil.createPvc(namespace, pvcName, storage, storageClassName); - //TODO 设置镜像可配置,这里先用默认镜像启动pod - // 调用修改后的 createPod 方法,传入额外的参数 // Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, pvc, devEnvironment, minioPvcName, datasetPath, modelPath); Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, null, devEnvironment, minioPvcName, datasetPath, modelPath); diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/AutoMLDaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/AutoMLDaoMapper.xml index 788c2dec..8f4bc742 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/AutoMLDaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/AutoMLDaoMapper.xml @@ -38,7 +38,7 @@ - select * from auto_ml where id = #{id} diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/AutoMLInsDaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/AutoMLInsDaoMapper.xml new file mode 100644 index 00000000..7f85a9d5 --- /dev/null +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/AutoMLInsDaoMapper.xml @@ -0,0 +1,132 @@ + + + + + insert into auto_ml_ins(auto_ml_id, task_type, dataset_name, time_left_for_this_task, per_run_time_limit, + ensemble_size, ensemble_class, ensemble_nbest, max_models_on_disc, seed, memory_limit, + include_classifier, include_feature_preprocessor, include_regressor, exclude_classifier, + exclude_regressor, exclude_feature_preprocessor, resampling_strategy, train_size, + shuffle, folds, delete_tmp_folder_after_terminate, data_csv, target_columns, create_by, + update_by) + values (#{autoMlIns.autoMlId}, #{autoMlIns.taskType}, #{autoMlIns.datasetName}, + #{autoMlIns.timeLeftForThisTask}, #{autoMlIns.perRunTimeLimit}, + #{autoMlIns.ensembleSize}, #{autoMlIns.ensembleClass}, #{autoMlIns.ensembleNbest}, + #{autoMlIns.maxModelsOnDisc}, #{autoMlIns.seed}, + #{autoMlIns.memoryLimit}, #{autoMlIns.includeClassifier}, #{autoMlIns.includeFeaturePreprocessor}, + #{autoMlIns.includeRegressor}, #{autoMlIns.excludeClassifier}, + #{autoMlIns.excludeRegressor}, #{autoMlIns.excludeFeaturePreprocessor}, #{autoMlIns.resamplingStrategy}, + #{autoMlIns.trainSize}, #{autoMlIns.shuffle}, + #{autoMlIns.folds}, #{autoMlIns.deleteTmpFolderAfterTerminate}, #{autoMlIns.dataCsv}, + #{autoMlIns.targetColumns}, #{autoMlIns.createBy}, #{autoMlIns.updateBy}) + + + + update auto_ml_ins + + + task_type = #{autoMlIns.taskType}, + + + dataset_name = #{autoMlIns.datasetName}, + + + time_left_for_this_task = #{autoMlIns.timeLeftForThisTask}, + + + per_run_time_limit = #{autoMlIns.perRunTimeLimit}, + + + ensemble_size = #{autoMlIns.ensembleSize}, + + + ensemble_class = #{autoMlIns.ensembleClass}, + + + ensemble_nbest = #{autoMlIns.ensembleNbest}, + + + max_models_on_disc = #{autoMlIns.maxModelsOnDisc}, + + + seed = #{autoMlIns.seed}, + + + memory_limit = #{autoMlIns.memoryLimit}, + + + include_classifier = #{autoMlIns.includeClassifier}, + + + include_feature_preprocessor = #{autoMlIns.includeFeaturePreprocessor}, + + + include_regressor = #{autoMlIns.includeRegressor}, + + + exclude_classifier = #{autoMlIns.excludeClassifier}, + + + exclude_regressor = #{autoMlIns.excludeRegressor}, + + + exclude_feature_preprocessor = #{autoMlIns.excludeFeaturePreprocessor}, + + + resampling_strategy = #{autoMlIns.resamplingStrategy}, + + + train_size = #{autoMlIns.trainSize}, + + + shuffle = #{autoMlIns.shuffle}, + + + folds = #{autoMlIns.folds}, + + + delete_tmp_folder_after_terminate = #{autoMlIns.deleteTmpFolderAfterTerminate}, + + + data_csv = #{autoMlIns.dataCsv}, + + + target_columns = #{autoMlIns.targetColumns}, + + + state = #{autoMlIns.state}, + + + update_by = #{autoMlIns.updateBy}, + + + where id = #{autoMlIns.id} + + + + + + + + + + + + + state = 1 and auto_ml_id = #{autoMlId} + + + \ No newline at end of file