| @@ -4,7 +4,6 @@ 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; | |||
| @@ -34,13 +33,13 @@ public class AutoMLController extends BaseController { | |||
| @PostMapping | |||
| @ApiOperation("新增自动机器学习") | |||
| public GenericsAjaxResult<AutoMl> addAutoMl(@RequestBody AutoMl autoMl) { | |||
| public GenericsAjaxResult<AutoMl> addAutoMl(@RequestBody AutoMl autoMl) throws Exception { | |||
| return genericsSuccess(this.autoMLService.save(autoMl)); | |||
| } | |||
| @PutMapping | |||
| @ApiOperation("编辑自动机器学习") | |||
| public GenericsAjaxResult<String> editAutoMl(@RequestBody AutoMl autoMl) { | |||
| public GenericsAjaxResult<String> editAutoMl(@RequestBody AutoMl autoMl) throws Exception { | |||
| return genericsSuccess(this.autoMLService.edit(autoMl)); | |||
| } | |||
| @@ -50,33 +49,6 @@ public class AutoMLController extends BaseController { | |||
| return genericsSuccess(this.autoMLService.delete(id)); | |||
| } | |||
| @GetMapping("/autoMlIns") | |||
| @ApiOperation("分页查询自动机器学习实例") | |||
| public GenericsAjaxResult<Page<AutoMlIns>> 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<AutoMlIns> addAutoMlIns(@RequestBody AutoMlIns autoMlIns) throws Exception { | |||
| return genericsSuccess(this.autoMLService.saveAutoMlIns(autoMlIns)); | |||
| } | |||
| @PutMapping("/autoMlIns") | |||
| @ApiOperation("编辑自动机器学习实例") | |||
| public GenericsAjaxResult<String> editAutoMlIns(@RequestBody AutoMlIns autoMlIns) throws Exception { | |||
| return genericsSuccess(this.autoMLService.editAutoMlIns(autoMlIns)); | |||
| } | |||
| @DeleteMapping("/autoMlIns/{id}") | |||
| @ApiOperation("删除自动机器学习实例") | |||
| public GenericsAjaxResult<String> deleteAutoMlIns(@PathVariable("id") Long id) { | |||
| return genericsSuccess(this.autoMLService.deleteAutoMlIns(id)); | |||
| } | |||
| @CrossOrigin(origins = "*", allowedHeaders = "*") | |||
| @PostMapping("/upload") | |||
| @ApiOperation(value = "上传数据文件csv", notes = "上传数据文件csv,并将信息存入数据库。") | |||
| @@ -1,20 +1,74 @@ | |||
| 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 io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| import java.util.Date; | |||
| @Data | |||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||
| @ApiModel(description = "自动机器学习") | |||
| public class AutoMl { | |||
| private Long id; | |||
| @ApiModelProperty(value = "实验名称") | |||
| private String mlName; | |||
| @ApiModelProperty(value = "实验描述") | |||
| private String mlDescription; | |||
| @ApiModelProperty(value = "任务类型") | |||
| 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 runState; | |||
| @@ -28,4 +82,7 @@ public class AutoMl { | |||
| private String updateBy; | |||
| private Date updateTime; | |||
| @TableField(exist = false) | |||
| private VersionVo versionVo; | |||
| } | |||
| @@ -1,77 +0,0 @@ | |||
| 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; | |||
| } | |||
| @@ -13,6 +13,8 @@ public interface AutoMLDao { | |||
| AutoMl getAutoMlById(@Param("id") Long id); | |||
| AutoMl getAutoMlByName(@Param("mlName") String mlName); | |||
| int save(@Param("autoMl") AutoMl autoMl); | |||
| int edit(@Param("autoMl") AutoMl autoMl); | |||
| @@ -1,21 +0,0 @@ | |||
| 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<AutoMlIns> 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); | |||
| } | |||
| @@ -1,32 +1,22 @@ | |||
| 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<AutoMl> queryByPage(String mlName, PageRequest pageRequest); | |||
| AutoMl save(AutoMl autoMl); | |||
| AutoMl save(AutoMl autoMl) throws Exception; | |||
| String edit(AutoMl autoMl); | |||
| String edit(AutoMl autoMl) throws Exception; | |||
| String delete(Long id); | |||
| Page<AutoMlIns> queryAutoMlInsByPage(Long autoMlId, PageRequest pageRequest); | |||
| AutoMlIns saveAutoMlIns(AutoMlIns autoMlIns) throws Exception; | |||
| String editAutoMlIns(AutoMlIns autoMlIns) throws Exception; | |||
| String deleteAutoMlIns(Long id); | |||
| Map<String, String> upload(MultipartFile file, String uuid) throws Exception; | |||
| Map<String, String> upload(MultipartFile file, String uuid) throws Exception; | |||
| String runAutoMlIns(Long id) throws Exception; | |||
| } | |||
| @@ -3,9 +3,7 @@ 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.platform.utils.DVCUtils; | |||
| import com.ruoyi.platform.utils.FileUtil; | |||
| @@ -49,8 +47,6 @@ public class AutoMLServiceImpl implements AutoMLService { | |||
| @Resource | |||
| private AutoMLDao autoMLDao; | |||
| @Resource | |||
| private AutoMLInsDao autoMLInsDao; | |||
| @Resource | |||
| private K8sClientUtil k8sClientUtil; | |||
| @Resource | |||
| private DVCUtils dvcUtils; | |||
| @@ -63,18 +59,40 @@ public class AutoMLServiceImpl implements AutoMLService { | |||
| } | |||
| @Override | |||
| public AutoMl save(AutoMl autoMl) { | |||
| public AutoMl save(AutoMl autoMl) throws Exception { | |||
| AutoMl autoMlByName = autoMLDao.getAutoMlByName(autoMl.getMlName()); | |||
| if (autoMlByName != null) { | |||
| throw new RuntimeException("实验名称已存在"); | |||
| } | |||
| String username = SecurityUtils.getLoginUser().getUsername(); | |||
| autoMl.setCreateBy(username); | |||
| autoMl.setUpdateBy(username); | |||
| String sourcePath = autoMl.getVersionVo().getUrl(); | |||
| String rootPath = localPath + username + "/automl/" + autoMl.getMlName() + "/" + autoMl.getDatasetName(); | |||
| dvcUtils.moveFiles(sourcePath, rootPath); | |||
| autoMl.setDataCsv(rootPath + "/" + autoMl.getVersionVo().getFileName()); | |||
| autoMLDao.save(autoMl); | |||
| return autoMl; | |||
| } | |||
| @Override | |||
| public String edit(AutoMl autoMl) { | |||
| public String edit(AutoMl autoMl) throws Exception { | |||
| AutoMl oldAutoMl = autoMLDao.getAutoMlByName(autoMl.getMlName()); | |||
| if (oldAutoMl != null && !oldAutoMl.getId().equals(autoMl.getId())) { | |||
| throw new RuntimeException("实验名称已存在"); | |||
| } | |||
| String username = SecurityUtils.getLoginUser().getUsername(); | |||
| autoMl.setUpdateBy(username); | |||
| if (autoMl.getVersionVo() != null && StringUtils.isNotEmpty(autoMl.getVersionVo().getUrl())) { | |||
| String sourcePath = autoMl.getVersionVo().getUrl(); | |||
| String rootPath = localPath + username + "/automl/" + autoMl.getMlName() + "/" + autoMl.getDatasetName(); | |||
| dvcUtils.moveFiles(sourcePath, rootPath); | |||
| autoMl.setDataCsv(rootPath + "/" + autoMl.getVersionVo().getFileName()); | |||
| } | |||
| autoMLDao.edit(autoMl); | |||
| return "修改成功"; | |||
| } | |||
| @@ -86,7 +104,8 @@ public class AutoMLServiceImpl implements AutoMLService { | |||
| throw new RuntimeException("服务不存在"); | |||
| } | |||
| String username = SecurityUtils.getLoginUser().getUsername(); | |||
| // String username = SecurityUtils.getLoginUser().getUsername(); | |||
| String username = "admin"; | |||
| String createBy = autoMl.getCreateBy(); | |||
| if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createBy))) { | |||
| throw new RuntimeException("无权限删除该服务"); | |||
| @@ -96,69 +115,12 @@ public class AutoMLServiceImpl implements AutoMLService { | |||
| return autoMLDao.edit(autoMl) > 0 ? "删除成功" : "删除失败"; | |||
| } | |||
| @Override | |||
| public Page<AutoMlIns> queryAutoMlInsByPage(Long autoMlId, PageRequest pageRequest) { | |||
| long total = autoMLInsDao.count(autoMlId); | |||
| List<AutoMlIns> 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<String, String> upload(MultipartFile file, String uuid) throws Exception { | |||
| Map<String, String> result = new HashMap<>(); | |||
| String username = SecurityUtils.getLoginUser().getUsername(); | |||
| // String username = SecurityUtils.getLoginUser().getUsername(); | |||
| String username = "admin"; | |||
| String fileName = file.getOriginalFilename(); | |||
| String path = localPath + "temp/" + username + "/automl_data/" + uuid; | |||
| long sizeInBytes = file.getSize(); | |||
| @@ -177,25 +139,25 @@ public class AutoMLServiceImpl implements AutoMLService { | |||
| @Override | |||
| public String runAutoMlIns(Long id) throws Exception { | |||
| AutoMlIns autoMlIns = autoMLInsDao.getById(id); | |||
| if (autoMlIns == null) { | |||
| AutoMl autoMl = autoMLDao.getAutoMlById(id); | |||
| if (autoMl == 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()); | |||
| command.append("nohup python /opt/automl.py --task_type " + autoMl.getTaskType()); | |||
| if (StringUtils.isNotEmpty(autoMl.getDataCsv())) { | |||
| command.append(" --data_csv " + autoMl.getDataCsv()); | |||
| } else { | |||
| throw new Exception("训练数据为空"); | |||
| } | |||
| if (StringUtils.isNotEmpty(autoMlIns.getTargetColumns())) { | |||
| command.append(" --target_columns " + autoMlIns.getTargetColumns()); | |||
| if (StringUtils.isNotEmpty(autoMl.getTargetColumns())) { | |||
| command.append(" --target_columns " + autoMl.getTargetColumns()); | |||
| } else { | |||
| throw new Exception("目标列为空"); | |||
| } | |||
| if (StringUtils.isNotEmpty(autoMlIns.getDatasetName())) { | |||
| command.append(" --dataset_name " + autoMlIns.getDatasetName()); | |||
| if (StringUtils.isNotEmpty(autoMl.getDatasetName())) { | |||
| command.append(" --dataset_name " + autoMl.getDatasetName()); | |||
| } else { | |||
| throw new Exception("数据集名称为空"); | |||
| } | |||
| @@ -206,59 +168,59 @@ public class AutoMLServiceImpl implements AutoMLService { | |||
| 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 (autoMl.getTimeLeftForThisTask() != null) { | |||
| command.append(" --time_left_for_this_task " + autoMl.getTimeLeftForThisTask()); | |||
| } | |||
| if (autoMlIns.getPerRunTimeLimit() != null) { | |||
| command.append(" --per_run_time_limit " + autoMlIns.getPerRunTimeLimit()); | |||
| if (autoMl.getPerRunTimeLimit() != null) { | |||
| command.append(" --per_run_time_limit " + autoMl.getPerRunTimeLimit()); | |||
| } | |||
| if (autoMlIns.getEnsembleSize() != null) { | |||
| command.append(" --ensemble_size " + autoMlIns.getEnsembleSize()); | |||
| if (autoMl.getEnsembleSize() != null) { | |||
| command.append(" --ensemble_size " + autoMl.getEnsembleSize()); | |||
| } | |||
| if (StringUtils.isNotEmpty(autoMlIns.getEnsembleClass())) { | |||
| command.append(" --ensemble_class " + autoMlIns.getEnsembleClass()); | |||
| if (StringUtils.isNotEmpty(autoMl.getEnsembleClass())) { | |||
| command.append(" --ensemble_class " + autoMl.getEnsembleClass()); | |||
| } | |||
| if (autoMlIns.getEnsembleNbest() != null) { | |||
| command.append(" --ensemble_nbest " + autoMlIns.getEnsembleNbest()); | |||
| if (autoMl.getEnsembleNbest() != null) { | |||
| command.append(" --ensemble_nbest " + autoMl.getEnsembleNbest()); | |||
| } | |||
| if (autoMlIns.getMaxModelsOnDisc() != null) { | |||
| command.append(" --max_models_on_disc " + autoMlIns.getMaxModelsOnDisc()); | |||
| if (autoMl.getMaxModelsOnDisc() != null) { | |||
| command.append(" --max_models_on_disc " + autoMl.getMaxModelsOnDisc()); | |||
| } | |||
| if (autoMlIns.getSeed() != null) { | |||
| command.append(" --seed " + autoMlIns.getSeed()); | |||
| if (autoMl.getSeed() != null) { | |||
| command.append(" --seed " + autoMl.getSeed()); | |||
| } | |||
| if (autoMlIns.getMemoryLimit() != null) { | |||
| command.append(" --memory_limit " + autoMlIns.getMemoryLimit()); | |||
| if (autoMl.getMemoryLimit() != null) { | |||
| command.append(" --memory_limit " + autoMl.getMemoryLimit()); | |||
| } | |||
| if (StringUtils.isNotEmpty(autoMlIns.getIncludeClassifier())) { | |||
| command.append(" --include_classifier " + autoMlIns.getIncludeClassifier()); | |||
| if (StringUtils.isNotEmpty(autoMl.getIncludeClassifier())) { | |||
| command.append(" --include_classifier " + autoMl.getIncludeClassifier()); | |||
| } | |||
| if (StringUtils.isNotEmpty(autoMlIns.getIncludeRegressor())) { | |||
| command.append(" --include_regressor " + autoMlIns.getIncludeRegressor()); | |||
| if (StringUtils.isNotEmpty(autoMl.getIncludeRegressor())) { | |||
| command.append(" --include_regressor " + autoMl.getIncludeRegressor()); | |||
| } | |||
| if (StringUtils.isNotEmpty(autoMlIns.getIncludeFeaturePreprocessor())) { | |||
| command.append(" --include_feature_preprocessor " + autoMlIns.getIncludeFeaturePreprocessor()); | |||
| if (StringUtils.isNotEmpty(autoMl.getIncludeFeaturePreprocessor())) { | |||
| command.append(" --include_feature_preprocessor " + autoMl.getIncludeFeaturePreprocessor()); | |||
| } | |||
| if (StringUtils.isNotEmpty(autoMlIns.getExcludeClassifier())) { | |||
| command.append(" --exclude_classifier " + autoMlIns.getExcludeClassifier()); | |||
| if (StringUtils.isNotEmpty(autoMl.getExcludeClassifier())) { | |||
| command.append(" --exclude_classifier " + autoMl.getExcludeClassifier()); | |||
| } | |||
| if (StringUtils.isNotEmpty(autoMlIns.getExcludeRegressor())) { | |||
| command.append(" --exclude_regressor " + autoMlIns.getExcludeRegressor()); | |||
| if (StringUtils.isNotEmpty(autoMl.getExcludeRegressor())) { | |||
| command.append(" --exclude_regressor " + autoMl.getExcludeRegressor()); | |||
| } | |||
| if (StringUtils.isNotEmpty(autoMlIns.getExcludeFeaturePreprocessor())) { | |||
| command.append(" --exclude_feature_preprocessor " + autoMlIns.getExcludeFeaturePreprocessor()); | |||
| if (StringUtils.isNotEmpty(autoMl.getExcludeFeaturePreprocessor())) { | |||
| command.append(" --exclude_feature_preprocessor " + autoMl.getExcludeFeaturePreprocessor()); | |||
| } | |||
| if (StringUtils.isNotEmpty(autoMlIns.getResamplingStrategy())) { | |||
| command.append(" --resampling_strategy " + autoMlIns.getResamplingStrategy()); | |||
| if (StringUtils.isNotEmpty(autoMl.getResamplingStrategy())) { | |||
| command.append(" --resampling_strategy " + autoMl.getResamplingStrategy()); | |||
| } | |||
| if (autoMlIns.getTrainSize() != null) { | |||
| command.append(" --train_size " + autoMlIns.getTrainSize()); | |||
| if (autoMl.getTrainSize() != null) { | |||
| command.append(" --train_size " + autoMl.getTrainSize()); | |||
| } | |||
| if (autoMlIns.getShuffle() != null) { | |||
| command.append(" --shuffle " + autoMlIns.getShuffle()); | |||
| if (autoMl.getShuffle() != null) { | |||
| command.append(" --shuffle " + autoMl.getShuffle()); | |||
| } | |||
| if (autoMlIns.getFolds() != null) { | |||
| command.append(" --folds " + autoMlIns.getFolds()); | |||
| if (autoMl.getFolds() != null) { | |||
| command.append(" --folds " + autoMl.getFolds()); | |||
| } | |||
| command.append(" &"); | |||
| CompletableFuture.supplyAsync(() -> { | |||
| @@ -2,8 +2,23 @@ | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.ruoyi.platform.mapper.AutoMLDao"> | |||
| <insert id="save"> | |||
| insert into auto_ml(ml_name, ml_description) | |||
| values (#{autoMl.mlName}, #{autoMl.mlDescription}) | |||
| insert into auto_ml(ml_name, ml_description, 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, data_csv, target_columns, create_by, | |||
| update_by) | |||
| values (#{autoMl.mlName}, #{autoMl.mlDescription}, #{autoMl.taskType}, #{autoMl.datasetName}, | |||
| #{autoMl.timeLeftForThisTask}, #{autoMl.perRunTimeLimit}, | |||
| #{autoMl.ensembleSize}, #{autoMl.ensembleClass}, #{autoMl.ensembleNbest}, | |||
| #{autoMl.maxModelsOnDisc}, #{autoMl.seed}, | |||
| #{autoMl.memoryLimit}, #{autoMl.includeClassifier}, #{autoMl.includeFeaturePreprocessor}, | |||
| #{autoMl.includeRegressor}, #{autoMl.excludeClassifier}, | |||
| #{autoMl.excludeRegressor}, #{autoMl.excludeFeaturePreprocessor}, #{autoMl.resamplingStrategy}, | |||
| #{autoMl.trainSize}, #{autoMl.shuffle}, | |||
| #{autoMl.folds}, #{autoMl.dataCsv}, | |||
| #{autoMl.targetColumns}, #{autoMl.createBy}, #{autoMl.updateBy}) | |||
| </insert> | |||
| <update id="edit"> | |||
| @@ -15,11 +30,77 @@ | |||
| <if test="autoMl.mlDescription != null and autoMl.mlDescription !=''"> | |||
| ml_description = #{autoMl.mlDescription}, | |||
| </if> | |||
| <if test="autoMl.runState != null and autoMl.runState !=''"> | |||
| run_state = #{autoMl.runState}, | |||
| <!-- <if test="autoMl.runState != null and autoMl.runState !=''">--> | |||
| <!-- run_state = #{autoMl.runState},--> | |||
| <!-- </if>--> | |||
| <!-- <if test="autoMl.progress != null">--> | |||
| <!-- progress = #{autoMl.progress},--> | |||
| <!-- </if>--> | |||
| <if test="autoMl.taskType != null and autoMl.taskType !=''"> | |||
| task_type = #{autoMl.taskType}, | |||
| </if> | |||
| <if test="autoMl.progress != null"> | |||
| progress = #{autoMl.progress}, | |||
| <if test="autoMl.datasetName != null and autoMl.datasetName !=''"> | |||
| dataset_name = #{autoMl.datasetName}, | |||
| </if> | |||
| <if test="autoMl.timeLeftForThisTask != null"> | |||
| time_left_for_this_task = #{autoMl.timeLeftForThisTask}, | |||
| </if> | |||
| <if test="autoMl.perRunTimeLimit != null"> | |||
| per_run_time_limit = #{autoMl.perRunTimeLimit}, | |||
| </if> | |||
| <if test="autoMl.ensembleSize != null"> | |||
| ensemble_size = #{autoMl.ensembleSize}, | |||
| </if> | |||
| <if test="autoMl.ensembleClass != null and autoMl.ensembleClass !=''"> | |||
| ensemble_class = #{autoMl.ensembleClass}, | |||
| </if> | |||
| <if test="autoMl.ensembleNbest != null"> | |||
| ensemble_nbest = #{autoMl.ensembleNbest}, | |||
| </if> | |||
| <if test="autoMl.maxModelsOnDisc != null"> | |||
| max_models_on_disc = #{autoMl.maxModelsOnDisc}, | |||
| </if> | |||
| <if test="autoMl.seed != null"> | |||
| seed = #{autoMl.seed}, | |||
| </if> | |||
| <if test="autoMl.memoryLimit != null"> | |||
| memory_limit = #{autoMl.memoryLimit}, | |||
| </if> | |||
| <if test="autoMl.includeClassifier != null and autoMl.includeClassifier !=''"> | |||
| include_classifier = #{autoMl.includeClassifier}, | |||
| </if> | |||
| <if test="autoMl.includeFeaturePreprocessor != null and autoMl.includeFeaturePreprocessor !=''"> | |||
| include_feature_preprocessor = #{autoMl.includeFeaturePreprocessor}, | |||
| </if> | |||
| <if test="autoMl.includeRegressor != null and autoMl.includeRegressor !=''"> | |||
| include_regressor = #{autoMl.includeRegressor}, | |||
| </if> | |||
| <if test="autoMl.excludeClassifier != null and autoMl.excludeClassifier !=''"> | |||
| exclude_classifier = #{autoMl.excludeClassifier}, | |||
| </if> | |||
| <if test="autoMl.excludeRegressor != null and autoMl.excludeRegressor !=''"> | |||
| exclude_regressor = #{autoMl.excludeRegressor}, | |||
| </if> | |||
| <if test="autoMl.excludeFeaturePreprocessor != null and autoMl.excludeFeaturePreprocessor !=''"> | |||
| exclude_feature_preprocessor = #{autoMl.excludeFeaturePreprocessor}, | |||
| </if> | |||
| <if test="autoMl.resamplingStrategy != null and autoMl.resamplingStrategy !=''"> | |||
| resampling_strategy = #{autoMl.resamplingStrategy}, | |||
| </if> | |||
| <if test="autoMl.trainSize != null and autoMl.trainSize !=''"> | |||
| train_size = #{autoMl.trainSize}, | |||
| </if> | |||
| <if test="autoMl.shuffle != null"> | |||
| shuffle = #{autoMl.shuffle}, | |||
| </if> | |||
| <if test="autoMl.folds != null"> | |||
| folds = #{autoMl.folds}, | |||
| </if> | |||
| <if test="autoMl.dataCsv != null and autoMl.dataCsv !=''"> | |||
| data_csv = #{autoMl.dataCsv}, | |||
| </if> | |||
| <if test="autoMl.targetColumns != null and autoMl.targetColumns !=''"> | |||
| target_columns = #{autoMl.targetColumns}, | |||
| </if> | |||
| <if test="autoMl.state != null"> | |||
| state = #{autoMl.state}, | |||
| @@ -39,7 +120,16 @@ | |||
| </select> | |||
| <select id="getAutoMlById" resultType="com.ruoyi.platform.domain.AutoMl"> | |||
| select * from auto_ml where id = #{id} | |||
| select * | |||
| from auto_ml | |||
| where id = #{id} | |||
| </select> | |||
| <select id="getAutoMlByName" resultType="com.ruoyi.platform.domain.AutoMl"> | |||
| select * | |||
| from auto_ml | |||
| where ml_name = #{mlName} | |||
| and state = 1 | |||
| </select> | |||
| <sql id="common_condition"> | |||
| @@ -1,132 +0,0 @@ | |||
| <?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.ruoyi.platform.mapper.AutoMLInsDao"> | |||
| <insert id="save"> | |||
| 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}) | |||
| </insert> | |||
| <update id="edit"> | |||
| update auto_ml_ins | |||
| <set> | |||
| <if test="autoMlIns.taskType != null and autoMlIns.taskType !=''"> | |||
| task_type = #{autoMlIns.taskType}, | |||
| </if> | |||
| <if test="autoMlIns.datasetName != null and autoMlIns.datasetName !=''"> | |||
| dataset_name = #{autoMlIns.datasetName}, | |||
| </if> | |||
| <if test="autoMlIns.timeLeftForThisTask != null"> | |||
| time_left_for_this_task = #{autoMlIns.timeLeftForThisTask}, | |||
| </if> | |||
| <if test="autoMlIns.perRunTimeLimit != null"> | |||
| per_run_time_limit = #{autoMlIns.perRunTimeLimit}, | |||
| </if> | |||
| <if test="autoMlIns.ensembleSize != null"> | |||
| ensemble_size = #{autoMlIns.ensembleSize}, | |||
| </if> | |||
| <if test="autoMlIns.ensembleClass != null and autoMlIns.ensembleClass !=''"> | |||
| ensemble_class = #{autoMlIns.ensembleClass}, | |||
| </if> | |||
| <if test="autoMlIns.ensembleNbest != null"> | |||
| ensemble_nbest = #{autoMlIns.ensembleNbest}, | |||
| </if> | |||
| <if test="autoMlIns.maxModelsOnDisc != null"> | |||
| max_models_on_disc = #{autoMlIns.maxModelsOnDisc}, | |||
| </if> | |||
| <if test="autoMlIns.seed != null"> | |||
| seed = #{autoMlIns.seed}, | |||
| </if> | |||
| <if test="autoMlIns.memoryLimit != null"> | |||
| memory_limit = #{autoMlIns.memoryLimit}, | |||
| </if> | |||
| <if test="autoMlIns.includeClassifier != null and autoMlIns.includeClassifier !=''"> | |||
| include_classifier = #{autoMlIns.includeClassifier}, | |||
| </if> | |||
| <if test="autoMlIns.includeFeaturePreprocessor != null and autoMlIns.includeFeaturePreprocessor !=''"> | |||
| include_feature_preprocessor = #{autoMlIns.includeFeaturePreprocessor}, | |||
| </if> | |||
| <if test="autoMlIns.includeRegressor != null and autoMlIns.includeRegressor !=''"> | |||
| include_regressor = #{autoMlIns.includeRegressor}, | |||
| </if> | |||
| <if test="autoMlIns.excludeClassifier != null and autoMlIns.excludeClassifier !=''"> | |||
| exclude_classifier = #{autoMlIns.excludeClassifier}, | |||
| </if> | |||
| <if test="autoMlIns.excludeRegressor != null and autoMlIns.excludeRegressor !=''"> | |||
| exclude_regressor = #{autoMlIns.excludeRegressor}, | |||
| </if> | |||
| <if test="autoMlIns.excludeFeaturePreprocessor != null and autoMlIns.excludeFeaturePreprocessor !=''"> | |||
| exclude_feature_preprocessor = #{autoMlIns.excludeFeaturePreprocessor}, | |||
| </if> | |||
| <if test="autoMlIns.resamplingStrategy != null and autoMlIns.resamplingStrategy !=''"> | |||
| resampling_strategy = #{autoMlIns.resamplingStrategy}, | |||
| </if> | |||
| <if test="autoMlIns.trainSize != null and autoMlIns.trainSize !=''"> | |||
| train_size = #{autoMlIns.trainSize}, | |||
| </if> | |||
| <if test="autoMlIns.shuffle != null"> | |||
| shuffle = #{autoMlIns.shuffle}, | |||
| </if> | |||
| <if test="autoMlIns.folds != null"> | |||
| folds = #{autoMlIns.folds}, | |||
| </if> | |||
| <if test="autoMlIns.deleteTmpFolderAfterTerminate != null"> | |||
| delete_tmp_folder_after_terminate = #{autoMlIns.deleteTmpFolderAfterTerminate}, | |||
| </if> | |||
| <if test="autoMlIns.dataCsv != null and autoMlIns.dataCsv !=''"> | |||
| data_csv = #{autoMlIns.dataCsv}, | |||
| </if> | |||
| <if test="autoMlIns.targetColumns != null and autoMlIns.targetColumns !=''"> | |||
| target_columns = #{autoMlIns.targetColumns}, | |||
| </if> | |||
| <if test="autoMlIns.state != null"> | |||
| state = #{autoMlIns.state}, | |||
| </if> | |||
| <if test="autoMlIns.updateBy != null and autoMlIns.updateBy !=''"> | |||
| update_by = #{autoMlIns.updateBy}, | |||
| </if> | |||
| </set> | |||
| where id = #{autoMlIns.id} | |||
| </update> | |||
| <select id="getById" resultType="com.ruoyi.platform.domain.AutoMlIns"> | |||
| select * | |||
| from auto_ml_ins | |||
| where id = #{id} | |||
| </select> | |||
| <select id="count" resultType="java.lang.Long"> | |||
| select count(1) from auto_ml_ins | |||
| <include refid="common_condition"></include> | |||
| </select> | |||
| <select id="queryByPage" resultType="com.ruoyi.platform.domain.AutoMlIns"> | |||
| select * from auto_ml_ins | |||
| <include refid="common_condition"></include> | |||
| </select> | |||
| <select id="findByDatasetName" resultType="com.ruoyi.platform.domain.AutoMlIns"> | |||
| select * from auto_ml_ins | |||
| <include refid="common_condition"></include> | |||
| and dataset_name = #{datasetName} | |||
| </select> | |||
| <sql id="common_condition"> | |||
| <where> | |||
| state = 1 and auto_ml_id = #{autoMlId} | |||
| </where> | |||
| </sql> | |||
| </mapper> | |||