| @@ -4,6 +4,7 @@ import com.ruoyi.common.core.web.controller.BaseController; | |||
| import com.ruoyi.common.core.web.domain.GenericsAjaxResult; | |||
| import com.ruoyi.platform.domain.ExperimentIns; | |||
| import com.ruoyi.platform.service.ExperimentInsService; | |||
| import com.ruoyi.platform.vo.ExperimentInsVo; | |||
| import com.ruoyi.platform.vo.LogRequestVo; | |||
| import com.ruoyi.platform.vo.PodLogVo; | |||
| import io.swagger.annotations.Api; | |||
| @@ -55,7 +56,7 @@ public class ExperimentInsController extends BaseController { | |||
| */ | |||
| @GetMapping("{id}") | |||
| @ApiOperation("通过id查询实验实例") | |||
| public GenericsAjaxResult<ExperimentIns> queryById(@PathVariable("id") Integer id) throws IOException { | |||
| public GenericsAjaxResult<ExperimentInsVo> queryById(@PathVariable("id") Integer id) throws IOException { | |||
| return genericsSuccess(this.experimentInsService.queryById(id)); | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.ruoyi.platform.service; | |||
| import com.ruoyi.platform.domain.ExperimentIns; | |||
| import com.ruoyi.platform.vo.ExperimentInsVo; | |||
| import com.ruoyi.platform.vo.LogRequestVo; | |||
| import com.ruoyi.platform.vo.PodLogVo; | |||
| import org.springframework.data.domain.Page; | |||
| @@ -24,7 +25,7 @@ public interface ExperimentInsService { | |||
| * @param id 主键 | |||
| * @return 实例对象 | |||
| */ | |||
| ExperimentIns queryById(Integer id) throws IOException; | |||
| ExperimentInsVo queryById(Integer id) throws IOException; | |||
| @@ -159,11 +159,21 @@ public class ComponentServiceImpl implements ComponentService { | |||
| Map<String, Object> command = (Map<String, Object>) taskInfo.get("command"); | |||
| Map<String, Object> runArgs = (Map<String, Object>) taskInfo.get("run_args"); | |||
| Map<String, Object> resourcesStandard = (Map<String, Object>) taskInfo.get("resources_standard"); | |||
| component.setImage(JacksonUtil.toJSONString(image)); | |||
| component.setWorkingDirectory(JacksonUtil.toJSONString(workingDirectory)); | |||
| component.setCommand(JacksonUtil.toJSONString(command)); | |||
| component.setRunArgs(JacksonUtil.toJSONString(runArgs)); | |||
| component.setResourcesStandard(JacksonUtil.toJSONString(resourcesStandard)); | |||
| if (image != null) { | |||
| component.setImage(JacksonUtil.toJSONString(image)); | |||
| } | |||
| if (workingDirectory != null) { | |||
| component.setWorkingDirectory(JacksonUtil.toJSONString(workingDirectory)); | |||
| } | |||
| if (command != null) { | |||
| component.setCommand(JacksonUtil.toJSONString(command)); | |||
| } | |||
| if (runArgs != null) { | |||
| component.setRunArgs(JacksonUtil.toJSONString(runArgs)); | |||
| } | |||
| if (resourcesStandard != null) { | |||
| component.setResourcesStandard(JacksonUtil.toJSONString(resourcesStandard)); | |||
| } | |||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | |||
| component.setCreateBy(loginUser.getUsername()); | |||
| @@ -216,14 +226,24 @@ public class ComponentServiceImpl implements ComponentService { | |||
| Map<String, Object> command = (Map<String, Object>) taskInfo.get("command"); | |||
| Map<String, Object> runArgs = (Map<String, Object>) taskInfo.get("run_args"); | |||
| Map<String, Object> resourcesStandard = (Map<String, Object>) taskInfo.get("resources_standard"); | |||
| component.setImage(JacksonUtil.toJSONString(image)); | |||
| component.setWorkingDirectory(JacksonUtil.toJSONString(workingDirectory)); | |||
| component.setCommand(JacksonUtil.toJSONString(command)); | |||
| component.setRunArgs(JacksonUtil.toJSONString(runArgs)); | |||
| component.setResourcesStandard(JacksonUtil.toJSONString(resourcesStandard)); | |||
| if (image != null) { | |||
| component.setImage(JacksonUtil.toJSONString(image)); | |||
| } | |||
| if (workingDirectory != null) { | |||
| component.setWorkingDirectory(JacksonUtil.toJSONString(workingDirectory)); | |||
| } | |||
| if (command != null) { | |||
| component.setCommand(JacksonUtil.toJSONString(command)); | |||
| } | |||
| if (runArgs != null) { | |||
| component.setRunArgs(JacksonUtil.toJSONString(runArgs)); | |||
| } | |||
| if (resourcesStandard != null) { | |||
| component.setResourcesStandard(JacksonUtil.toJSONString(resourcesStandard)); | |||
| } | |||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | |||
| component.setUpdateBy(loginUser.getUsername()); | |||
| // LoginUser loginUser = SecurityUtils.getLoginUser(); | |||
| // component.setUpdateBy(loginUser.getUsername()); | |||
| component.setUpdateTime(new Date()); | |||
| this.componentDao.update(component); | |||
| return this.queryById(component.getId()); | |||
| @@ -13,6 +13,7 @@ import com.ruoyi.platform.mapper.ModelDependency1Dao; | |||
| import com.ruoyi.platform.service.ExperimentInsService; | |||
| import com.ruoyi.platform.service.ResourceOccupyService; | |||
| import com.ruoyi.platform.utils.*; | |||
| import com.ruoyi.platform.vo.ExperimentInsVo; | |||
| import com.ruoyi.platform.vo.LogRequestVo; | |||
| import com.ruoyi.platform.vo.PodLogVo; | |||
| import com.ruoyi.system.api.constant.Constant; | |||
| @@ -20,6 +21,7 @@ import com.ruoyi.system.api.model.LoginUser; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.BeanUtils; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageImpl; | |||
| @@ -100,9 +102,13 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||
| * @return 实例对象 | |||
| */ | |||
| @Override | |||
| public ExperimentIns queryById(Integer id) throws IOException { | |||
| public ExperimentInsVo queryById(Integer id) throws IOException { | |||
| ExperimentIns experimentIns = this.experimentInsDao.queryById(id); | |||
| ExperimentInsVo experimentInsVo = new ExperimentInsVo(); | |||
| BeanUtils.copyProperties(experimentIns, experimentInsVo); | |||
| if (StringUtils.isNotEmpty(experimentIns.getDag())) { | |||
| experimentInsVo.setDag(JsonUtils.jsonToMap(experimentIns.getDag())); | |||
| } | |||
| //已经迁移至定时任务进行更新操作 | |||
| // if (experimentIns != null && (StringUtils.isEmpty(experimentIns.getStatus())) || !isTerminatedState(experimentIns)) { | |||
| // experimentIns = this.queryStatusFromArgo(experimentIns); | |||
| @@ -112,7 +118,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||
| // this.update(experimentIns); | |||
| // } | |||
| // } | |||
| return experimentIns; | |||
| return experimentInsVo; | |||
| } | |||
| /** | |||
| @@ -5,6 +5,7 @@ import com.ruoyi.platform.domain.*; | |||
| import com.ruoyi.platform.mapper.ModelDependencyDao; | |||
| import com.ruoyi.platform.service.*; | |||
| import com.ruoyi.platform.utils.JacksonUtil; | |||
| import com.ruoyi.platform.vo.ExperimentInsVo; | |||
| import com.ruoyi.platform.vo.ModelDependcyTreeVo; | |||
| import com.ruoyi.platform.vo.ModelVersionDependcyVo; | |||
| import com.ruoyi.system.api.model.LoginUser; | |||
| @@ -188,7 +189,7 @@ public class ModelDependencyServiceImpl implements ModelDependencyService { | |||
| modelVersionDependcyVo.setCreateBy(modelsVersion.getCreateBy()); | |||
| modelVersionDependcyVo.setCreateTime(modelsVersion.getCreateTime()); | |||
| modelDependcyTreeVo.setModelVersionDependcyVo(modelVersionDependcyVo); | |||
| ExperimentIns experimentIns = experimentInsService.queryById(expInsId); | |||
| ExperimentInsVo experimentIns = experimentInsService.queryById(expInsId); | |||
| if (experimentIns == null){ | |||
| return modelDependcyTreeVo; | |||
| } | |||
| @@ -0,0 +1,84 @@ | |||
| package com.ruoyi.platform.vo; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.fasterxml.jackson.annotation.JsonRawValue; | |||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | |||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| import java.util.Date; | |||
| import java.util.Map; | |||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||
| @ApiModel("实验实例对象") | |||
| @Data | |||
| public class ExperimentInsVo { | |||
| @ApiModelProperty(name = "id") | |||
| private Integer id; | |||
| /** | |||
| * 实验ID | |||
| */ | |||
| @ApiModelProperty(value = "实验ID") | |||
| private Integer experimentId; | |||
| @ApiModelProperty(value = "Argo实例名称") | |||
| private String argoInsName; | |||
| @ApiModelProperty(value = "Argo命名空间") | |||
| private String argoInsNs; | |||
| @ApiModelProperty(value = "实例运行状态") | |||
| private String status; | |||
| @ApiModelProperty(value = "节点状态") | |||
| private String nodesStatus; | |||
| @ApiModelProperty(value = "节点结果") | |||
| private String nodesResult; | |||
| @ApiModelProperty(value = "节点日志") | |||
| private String nodesLogs; | |||
| @ApiModelProperty(value = "实验实例全局参数", notes = "以JSON字符串格式存储") | |||
| @JsonRawValue | |||
| private String globalParam; | |||
| @ApiModelProperty(value = "参数记录", notes = "以JSON字符串格式存储") | |||
| @JsonRawValue | |||
| private String metricRecord; | |||
| @ApiModelProperty(value = "指标数值", notes = "以JSON字符串格式存储") | |||
| @JsonRawValue | |||
| private String metricValue; | |||
| @ApiModelProperty(value = "开始时间") | |||
| private Date startTime; | |||
| @ApiModelProperty(value = "结束时间") | |||
| private Date finishTime; | |||
| @ApiModelProperty(value = "创建者") | |||
| private String createBy; | |||
| @ApiModelProperty(value = "创建时间") | |||
| private Date createTime; | |||
| @ApiModelProperty(value = "更新者") | |||
| private String updateBy; | |||
| @ApiModelProperty(value = "更新时间") | |||
| private Date updateTime; | |||
| @ApiModelProperty(value = "状态:0失效,1生效") | |||
| private Integer state; | |||
| @ApiModelProperty(value = "DAG图") | |||
| private Map<String, Object> dag; | |||
| @ApiModelProperty(value = "实验实例对应的流水线ID") | |||
| private Long workflowId; | |||
| @TableField(exist = false) | |||
| private String experimentName; | |||
| } | |||