| @@ -113,7 +113,7 @@ public class ExperimentController { | |||||
| */ | */ | ||||
| @PutMapping("/experiments/{id}") | @PutMapping("/experiments/{id}") | ||||
| @ApiOperation("运行实验") | @ApiOperation("运行实验") | ||||
| public AjaxResult runExperiment(@PathVariable("id") Integer id) { | |||||
| public AjaxResult runExperiment(@PathVariable("id") Integer id) throws Exception { | |||||
| return AjaxResult.success(this.experimentService.runExperiment(id)); | return AjaxResult.success(this.experimentService.runExperiment(id)); | ||||
| } | } | ||||
| @@ -42,6 +42,20 @@ public class ExperimentIns implements Serializable { | |||||
| private String nodesStatus; | private String nodesStatus; | ||||
| @ApiModelProperty(name = "nodes_logs") | @ApiModelProperty(name = "nodes_logs") | ||||
| private String nodesLogs; | private String nodesLogs; | ||||
| /** | |||||
| * 开始时间 | |||||
| */ | |||||
| @ApiModelProperty(name = "start_time") | |||||
| private Date startTime; | |||||
| /** | |||||
| * 结束时间 | |||||
| */ | |||||
| @ApiModelProperty(name = "finish_time") | |||||
| private Date finishTime; | |||||
| /** | /** | ||||
| * 创建者 | * 创建者 | ||||
| */ | */ | ||||
| @@ -129,6 +143,19 @@ public class ExperimentIns implements Serializable { | |||||
| this.nodesLogs = nodesLogs; | this.nodesLogs = nodesLogs; | ||||
| } | } | ||||
| public void setStartTime(Date startTime) { | |||||
| this.startTime = startTime; | |||||
| } | |||||
| public Date getStartTime() {return startTime;} | |||||
| public void setFinishTime(Date finishTime) { | |||||
| this.finishTime = finishTime; | |||||
| } | |||||
| public Date getFinishTime() {return finishTime;} | |||||
| public String getCreateBy() { | public String getCreateBy() { | ||||
| return createBy; | return createBy; | ||||
| } | } | ||||
| @@ -55,6 +55,8 @@ public interface DatasetVersionDao { | |||||
| */ | */ | ||||
| int insertBatch(@Param("entities") List<DatasetVersion> entities); | int insertBatch(@Param("entities") List<DatasetVersion> entities); | ||||
| /** | /** | ||||
| * 批量新增或按主键更新数据(MyBatis原生foreach方法) | * 批量新增或按主键更新数据(MyBatis原生foreach方法) | ||||
| * | * | ||||
| @@ -83,5 +85,7 @@ public interface DatasetVersionDao { | |||||
| List<DatasetVersion> queryByDatasetId(Integer datasetId); | List<DatasetVersion> queryByDatasetId(Integer datasetId); | ||||
| DatasetVersion queryByDatasetVersion(DatasetVersion datasetVersion); | DatasetVersion queryByDatasetVersion(DatasetVersion datasetVersion); | ||||
| } | } | ||||
| @@ -29,7 +29,7 @@ public interface ExperimentInsDao { | |||||
| * @param pageable 分页对象 | * @param pageable 分页对象 | ||||
| * @return 对象列表 | * @return 对象列表 | ||||
| */ | */ | ||||
| List<ExperimentIns> queryAllByLimit(@Param("experimentIns")ExperimentIns experimentIns, @Param("pageable") Pageable pageable); | |||||
| List<ExperimentIns> queryAllByLimit(@Param("experimentIns") ExperimentIns experimentIns, @Param("pageable") Pageable pageable); | |||||
| /** | /** | ||||
| * 统计总行数 | * 统计总行数 | ||||
| @@ -37,7 +37,7 @@ public interface ExperimentInsDao { | |||||
| * @param experimentIns 查询条件 | * @param experimentIns 查询条件 | ||||
| * @return 总行数 | * @return 总行数 | ||||
| */ | */ | ||||
| long count(@Param("experimentIns")ExperimentIns experimentIns); | |||||
| long count(@Param("experimentIns") ExperimentIns experimentIns); | |||||
| /** | /** | ||||
| * 新增数据 | * 新增数据 | ||||
| @@ -45,7 +45,7 @@ public interface ExperimentInsDao { | |||||
| * @param experimentIns 实例对象 | * @param experimentIns 实例对象 | ||||
| * @return 影响行数 | * @return 影响行数 | ||||
| */ | */ | ||||
| int insert(ExperimentIns experimentIns); | |||||
| int insert(@Param("experimentIns") ExperimentIns experimentIns); | |||||
| /** | /** | ||||
| * 批量新增数据(MyBatis原生foreach方法) | * 批量新增数据(MyBatis原生foreach方法) | ||||
| @@ -70,7 +70,7 @@ public interface ExperimentInsDao { | |||||
| * @param experimentIns 实例对象 | * @param experimentIns 实例对象 | ||||
| * @return 影响行数 | * @return 影响行数 | ||||
| */ | */ | ||||
| int update(ExperimentIns experimentIns); | |||||
| int update(@Param("experimentIns") ExperimentIns experimentIns); | |||||
| /** | /** | ||||
| * 通过主键删除数据 | * 通过主键删除数据 | ||||
| @@ -68,6 +68,7 @@ public interface ExperimentInsService { | |||||
| */ | */ | ||||
| boolean deleteById(Integer id); | boolean deleteById(Integer id); | ||||
| List<ExperimentIns> queryByExperimentId(Integer id); | List<ExperimentIns> queryByExperimentId(Integer id); | ||||
| @@ -56,7 +56,7 @@ public interface ExperimentService { | |||||
| */ | */ | ||||
| boolean deleteById(Integer id); | boolean deleteById(Integer id); | ||||
| String removeById(Integer id); | String removeById(Integer id); | ||||
| Experiment runExperiment(Integer id); | |||||
| Experiment runExperiment(Integer id) throws Exception; | |||||
| Experiment addAndRunExperiment(Experiment experiment); | Experiment addAndRunExperiment(Experiment experiment); | ||||
| @@ -17,6 +17,7 @@ import org.springframework.data.domain.PageRequest; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -63,6 +64,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| @Override | @Override | ||||
| public ExperimentIns queryById(Integer id) { | public ExperimentIns queryById(Integer id) { | ||||
| ExperimentIns experimentIns = this.experimentInsDao.queryById(id); | ExperimentIns experimentIns = this.experimentInsDao.queryById(id); | ||||
| //获取实例当前状态 | |||||
| String currentStatus = experimentIns.getStatus(); | String currentStatus = experimentIns.getStatus(); | ||||
| // 检查是否需要调用接口查询状态:当原本状态为null或running或Pending时调用argo接口 | // 检查是否需要调用接口查询状态:当原本状态为null或running或Pending时调用argo接口 | ||||
| @@ -76,7 +78,6 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| } | } | ||||
| } | } | ||||
| return experimentIns; | return experimentIns; | ||||
| } | } | ||||
| @@ -241,6 +242,19 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| if (status == null || status.isEmpty()) { | if (status == null || status.isEmpty()) { | ||||
| throw new RuntimeException("工作流状态为空。"); | throw new RuntimeException("工作流状态为空。"); | ||||
| } | } | ||||
| //解析流水线开始时间,开始时间一定存在,所以不需要判断 | |||||
| SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); | |||||
| String startedAtString = (String) status.get("startedAt"); | |||||
| Date startTime = dateFormat.parse(startedAtString); | |||||
| experimentIns.setStartTime(startTime); | |||||
| //解析流水线结束时间 | |||||
| String finishedAtString = (String) status.get("finishedAt"); | |||||
| if (finishedAtString != null && !finishedAtString.isEmpty()) { | |||||
| Date finishTime = dateFormat.parse(finishedAtString); | |||||
| experimentIns.setFinishTime(finishTime); | |||||
| } | |||||
| // 解析nodes字段,提取节点状态并转换为JSON字符串 | // 解析nodes字段,提取节点状态并转换为JSON字符串 | ||||
| Map<String, Object> nodes = (Map<String, Object>) status.get("nodes"); | Map<String, Object> nodes = (Map<String, Object>) status.get("nodes"); | ||||
| @@ -261,7 +275,6 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| } | } | ||||
| /** | /** | ||||
| * 终止已经创建的实验实例 | * 终止已经创建的实验实例 | ||||
| * | * | ||||
| @@ -303,9 +316,8 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| // 检查响应是否为空或无内容 | // 检查响应是否为空或无内容 | ||||
| if (StringUtils.isEmpty(req)) { | if (StringUtils.isEmpty(req)) { | ||||
| throw new RuntimeException("终止响应内容为空。"); | throw new RuntimeException("终止响应内容为空。"); | ||||
| } | |||||
| } | |||||
| // 将响应的JSON字符串转换为Map对象 | // 将响应的JSON字符串转换为Map对象 | ||||
| Map<String, Object> runResMap = JsonUtils.jsonToMap(req); | Map<String, Object> runResMap = JsonUtils.jsonToMap(req); | ||||
| // 从响应Map中直接获取"errCode"的值 | // 从响应Map中直接获取"errCode"的值 | ||||
| @@ -5,6 +5,7 @@ import com.ruoyi.platform.domain.Experiment; | |||||
| import com.ruoyi.platform.domain.ExperimentIns; | import com.ruoyi.platform.domain.ExperimentIns; | ||||
| import com.ruoyi.platform.domain.Workflow; | import com.ruoyi.platform.domain.Workflow; | ||||
| import com.ruoyi.platform.mapper.ExperimentDao; | import com.ruoyi.platform.mapper.ExperimentDao; | ||||
| import com.ruoyi.platform.mapper.ExperimentInsDao; | |||||
| import com.ruoyi.platform.service.ExperimentInsService; | import com.ruoyi.platform.service.ExperimentInsService; | ||||
| import com.ruoyi.platform.service.ExperimentService; | import com.ruoyi.platform.service.ExperimentService; | ||||
| import com.ruoyi.platform.service.WorkflowService; | import com.ruoyi.platform.service.WorkflowService; | ||||
| @@ -35,6 +36,11 @@ public class ExperimentServiceImpl implements ExperimentService { | |||||
| @Resource | @Resource | ||||
| private ExperimentDao experimentDao; | private ExperimentDao experimentDao; | ||||
| @Resource | |||||
| private ExperimentInsDao experimentInsDao; | |||||
| @Resource | @Resource | ||||
| @Lazy | @Lazy | ||||
| private WorkflowService workflowService; | private WorkflowService workflowService; | ||||
| @@ -192,7 +198,7 @@ public class ExperimentServiceImpl implements ExperimentService { | |||||
| * @return 是否成功 | * @return 是否成功 | ||||
| */ | */ | ||||
| @Override | @Override | ||||
| public Experiment runExperiment(Integer id) { | |||||
| public Experiment runExperiment(Integer id) throws Exception { | |||||
| //先查出实验记录 | //先查出实验记录 | ||||
| Experiment experiment = this.queryById(id); | Experiment experiment = this.queryById(id); | ||||
| @@ -200,13 +206,18 @@ public class ExperimentServiceImpl implements ExperimentService { | |||||
| System.out.println("No experiment"); | System.out.println("No experiment"); | ||||
| } | } | ||||
| Workflow workflow = workflowService.queryById(experiment.getWorkflowId()); | Workflow workflow = workflowService.queryById(experiment.getWorkflowId()); | ||||
| if(workflow == null) { | |||||
| throw new RuntimeException("流水线不存在,请先创建流水线"); | |||||
| } | |||||
| String dag = workflow.getDag(); | String dag = workflow.getDag(); | ||||
| // 调argo转换接口 | // 调argo转换接口 | ||||
| try { | try { | ||||
| String convertRes = HttpUtils.sendPost(argoUrl + argoConvert, dag); | String convertRes = HttpUtils.sendPost(argoUrl + argoConvert, dag); | ||||
| if (convertRes == null || StringUtils.isEmpty(convertRes)) { | if (convertRes == null || StringUtils.isEmpty(convertRes)) { | ||||
| throw new RuntimeException("Failed to convert workflow."); | |||||
| throw new RuntimeException("转换流水线失败"); | |||||
| } | } | ||||
| Map<String, Object> converMap = JsonUtils.jsonToMap(convertRes); | Map<String, Object> converMap = JsonUtils.jsonToMap(convertRes); | ||||
| // 组装运行接口json | // 组装运行接口json | ||||
| @@ -234,13 +245,16 @@ public class ExperimentServiceImpl implements ExperimentService { | |||||
| experimentIns.setArgoInsNs((String) metadata.get("namespace")); | experimentIns.setArgoInsNs((String) metadata.get("namespace")); | ||||
| experimentIns.setArgoInsName((String) metadata.get("name")); | experimentIns.setArgoInsName((String) metadata.get("name")); | ||||
| //插入ExperimentIns表中 | //插入ExperimentIns表中 | ||||
| experimentInsService.insert(experimentIns); | |||||
| experimentInsDao.insert(experimentIns); | |||||
| }catch (Exception e){ | }catch (Exception e){ | ||||
| throw new RuntimeException(e); | throw new RuntimeException(e); | ||||
| } | } | ||||
| List<ExperimentIns> experimentIns = experimentInsService.queryByExperimentId(id); | List<ExperimentIns> experimentIns = experimentInsService.queryByExperimentId(id); | ||||
| experiment.setExperimentInsList(experimentIns); | experiment.setExperimentInsList(experimentIns); | ||||
| return experiment; | return experiment; | ||||
| } | } | ||||
| @@ -253,7 +267,11 @@ public class ExperimentServiceImpl implements ExperimentService { | |||||
| throw new RuntimeException("Failed to add experiment."); | throw new RuntimeException("Failed to add experiment."); | ||||
| } | } | ||||
| // 调用runExperiment方法运行实验 | // 调用runExperiment方法运行实验 | ||||
| newExperiment = this.runExperiment(newExperiment.getId()); | |||||
| try { | |||||
| newExperiment = this.runExperiment(newExperiment.getId()); | |||||
| } catch (Exception e) { | |||||
| throw new RuntimeException(e); | |||||
| } | |||||
| return newExperiment; | return newExperiment; | ||||
| } | } | ||||
| @@ -10,6 +10,8 @@ | |||||
| <result property="status" column="status" jdbcType="VARCHAR"/> | <result property="status" column="status" jdbcType="VARCHAR"/> | ||||
| <result property="nodesStatus" column="nodes_status" jdbcType="VARCHAR"/> | <result property="nodesStatus" column="nodes_status" jdbcType="VARCHAR"/> | ||||
| <result property="nodesLogs" column="nodes_logs" jdbcType="VARCHAR"/> | <result property="nodesLogs" column="nodes_logs" jdbcType="VARCHAR"/> | ||||
| <result property="startTime" column="start_time" jdbcType="TIMESTAMP"/> | |||||
| <result property="finishTime" column="finish_time" jdbcType="TIMESTAMP"/> | |||||
| <result property="createBy" column="create_by" jdbcType="VARCHAR"/> | <result property="createBy" column="create_by" jdbcType="VARCHAR"/> | ||||
| <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> | ||||
| <result property="updateBy" column="update_by" jdbcType="VARCHAR"/> | <result property="updateBy" column="update_by" jdbcType="VARCHAR"/> | ||||
| @@ -19,25 +21,23 @@ | |||||
| <!--查询单个--> | <!--查询单个--> | ||||
| <select id="queryById" resultMap="ExperimentInsMap"> | <select id="queryById" resultMap="ExperimentInsMap"> | ||||
| select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_logs, create_by, create_time, update_by, update_time, state | |||||
| select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_logs, start_time, finish_time, create_by, create_time, update_by, update_time, state | |||||
| from experiment_ins | from experiment_ins | ||||
| where id = #{id} and state = 1 | where id = #{id} and state = 1 | ||||
| </select> | </select> | ||||
| <!--查询列表--> | <!--查询列表--> | ||||
| <select id="getByExperimentId" resultMap="ExperimentInsMap"> | <select id="getByExperimentId" resultMap="ExperimentInsMap"> | ||||
| select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_logs, create_by, create_time, update_by, update_time, state | |||||
| select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_logs, start_time, finish_time, create_by, create_time, update_by, update_time, state | |||||
| from experiment_ins | from experiment_ins | ||||
| where experiment_id = #{experiment_id} and state = 1 order by create_time limit 5 | where experiment_id = #{experiment_id} and state = 1 order by create_time limit 5 | ||||
| </select> | </select> | ||||
| <select id="queryByExperiment" resultMap="ExperimentInsMap"> | <select id="queryByExperiment" resultMap="ExperimentInsMap"> | ||||
| select | select | ||||
| id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_logs, create_by, create_time, update_by, update_time, state | |||||
| id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_logs, start_time, finish_time, create_by, create_time, update_by, update_time, state | |||||
| from experiment_ins | from experiment_ins | ||||
| <where> | <where> | ||||
| state = 1 | state = 1 | ||||
| @@ -62,6 +62,12 @@ | |||||
| <if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''"> | <if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''"> | ||||
| and nodes_logs = #{experimentIns.nodesLogs} | and nodes_logs = #{experimentIns.nodesLogs} | ||||
| </if> | </if> | ||||
| <if test="experimentIns.startTime != null"> | |||||
| and start_time = #{experimentIns.startTime} | |||||
| </if> | |||||
| <if test="experimentIns.finishTime != null"> | |||||
| and finish_time = #{experimentIns.finishTime} | |||||
| </if> | |||||
| <if test="experimentIns.createBy != null and experimentIns.createBy != ''"> | <if test="experimentIns.createBy != null and experimentIns.createBy != ''"> | ||||
| and create_by = #{experimentIns.createBy} | and create_by = #{experimentIns.createBy} | ||||
| </if> | </if> | ||||
| @@ -80,7 +86,7 @@ | |||||
| <!--查询指定行数据--> | <!--查询指定行数据--> | ||||
| <select id="queryAllByLimit" resultMap="ExperimentInsMap"> | <select id="queryAllByLimit" resultMap="ExperimentInsMap"> | ||||
| select | select | ||||
| id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_logs, create_by, create_time, update_by, update_time, state | |||||
| id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_logs, start_time, finish_time, create_by, create_time, update_by, update_time, state | |||||
| from experiment_ins | from experiment_ins | ||||
| <where> | <where> | ||||
| state = 1 | state = 1 | ||||
| @@ -105,6 +111,12 @@ | |||||
| <if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''"> | <if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''"> | ||||
| and nodes_logs = #{experimentIns.nodesLogs} | and nodes_logs = #{experimentIns.nodesLogs} | ||||
| </if> | </if> | ||||
| <if test="experimentIns.startTime != null"> | |||||
| and start_time = #{experimentIns.startTime} | |||||
| </if> | |||||
| <if test="experimentIns.finishTime != null"> | |||||
| and finish_time = #{experimentIns.finishTime} | |||||
| </if> | |||||
| <if test="experimentIns.createBy != null and experimentIns.createBy != ''"> | <if test="experimentIns.createBy != null and experimentIns.createBy != ''"> | ||||
| and create_by = #{experimentIns.createBy} | and create_by = #{experimentIns.createBy} | ||||
| </if> | </if> | ||||
| @@ -149,6 +161,12 @@ | |||||
| <if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''"> | <if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''"> | ||||
| and nodes_logs = #{experimentIns.nodesLogs} | and nodes_logs = #{experimentIns.nodesLogs} | ||||
| </if> | </if> | ||||
| <if test="experimentIns.startTime != null"> | |||||
| and start_time = #{experimentIns.startTime} | |||||
| </if> | |||||
| <if test="experimentIns.finishTime != null"> | |||||
| and finish_time = #{experimentIns.finishTime} | |||||
| </if> | |||||
| <if test="experimentIns.createBy != null and experimentIns.createBy != ''"> | <if test="experimentIns.createBy != null and experimentIns.createBy != ''"> | ||||
| and create_by = #{experimentIns.createBy} | and create_by = #{experimentIns.createBy} | ||||
| </if> | </if> | ||||
| @@ -166,25 +184,25 @@ | |||||
| <!--新增所有列--> | <!--新增所有列--> | ||||
| <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | ||||
| insert into experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_logs,create_by,create_time,update_by,update_time,state) | |||||
| values (#{experimentIns.experimentId},#{experimentIns.argoInsName},#{experimentIns.argoInsNs},#{experimentIns.status},#{experimentIns.nodesStatus},#{experimentIns.nodesLogs},#{experimentIns.createBy},#{experimentIns.createTime},#{experimentIns.updateBy},#{experimentIns.updateTime},#{experimentIns.state}) | |||||
| insert into experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_logs,start_time,finish_time,create_by,create_time,update_by,update_time,state) | |||||
| values (#{experimentIns.experimentId},#{experimentIns.argoInsName},#{experimentIns.argoInsNs},#{experimentIns.status},#{experimentIns.nodesStatus},#{experimentIns.nodesLogs},#{experimentIns.startTime},#{experimentIns.finishTime},#{experimentIns.createBy},#{experimentIns.createTime},#{experimentIns.updateBy},#{experimentIns.updateTime},#{experimentIns.state}) | |||||
| </insert> | </insert> | ||||
| <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true"> | <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true"> | ||||
| insert into | insert into | ||||
| experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_logs,create_by,create_time,update_by,update_time,state) | |||||
| experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_logs,start_time,finish_time,create_by,create_time,update_by,update_time,state) | |||||
| values | values | ||||
| <foreach collection="entities" item="entity" separator=","> | <foreach collection="entities" item="entity" separator=","> | ||||
| (#{entity.experimentId},#{entity.argoInsName},#{entity.argoInsNs},#{entity.status},#{entity.nodesStatus},#{entity.nodesStatus},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state}) | |||||
| (#{entity.experimentId},#{entity.argoInsName},#{entity.argoInsNs},#{entity.status},#{entity.nodesStatus},#{entity.nodesLogs},#{entity.startTime},#{entity.finishTime},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state}) | |||||
| </foreach> | </foreach> | ||||
| </insert> | </insert> | ||||
| <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> | <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> | ||||
| insert into | insert into | ||||
| experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,create_by,create_time,update_by,update_time,state) | |||||
| experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,start_time,finish_time,create_by,create_time,update_by,update_time,state) | |||||
| values | values | ||||
| <foreach collection="entities" item="entity" separator=","> | <foreach collection="entities" item="entity" separator=","> | ||||
| (#{entity.experimentId},#{entity.argoInsName},#{entity.argoInsNs},#{entity.status},#{entity.nodesStatus},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state}) | |||||
| (#{entity.experimentId},#{entity.argoInsName},#{entity.argoInsNs},#{entity.status},#{entity.nodesStatus},#{entity.startTime},#{entity.finishTime},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state}) | |||||
| </foreach> | </foreach> | ||||
| on duplicate key update | on duplicate key update | ||||
| experiment_id = values(experiment_id)argo_ins_name = values(argo_ins_name)argo_ins_ns = | experiment_id = values(experiment_id)argo_ins_name = values(argo_ins_name)argo_ins_ns = | ||||
| @@ -213,6 +231,12 @@ | |||||
| <if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''"> | <if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''"> | ||||
| nodes_logs = #{experimentIns.nodesLogs}, | nodes_logs = #{experimentIns.nodesLogs}, | ||||
| </if> | </if> | ||||
| <if test="experimentIns.startTime != null"> | |||||
| start_time = #{experimentIns.startTime}, | |||||
| </if> | |||||
| <if test="experimentIns.finishTime != null"> | |||||
| finish_time = #{experimentIns.finishTime}, | |||||
| </if> | |||||
| <if test="experimentIns.createBy != null and experimentIns.createBy != ''"> | <if test="experimentIns.createBy != null and experimentIns.createBy != ''"> | ||||
| create_by = #{experimentIns.createBy}, | create_by = #{experimentIns.createBy}, | ||||
| </if> | </if> | ||||
| @@ -33,7 +33,7 @@ | |||||
| and id = #{workflow.id} | and id = #{workflow.id} | ||||
| </if> | </if> | ||||
| <if test="workflow.name != null and workflow.name != ''"> | <if test="workflow.name != null and workflow.name != ''"> | ||||
| and name = #{workflow.name} | |||||
| and name like "%"#{workflow.name}"%" | |||||
| </if> | </if> | ||||
| <if test="workflow.description != null and workflow.description != ''"> | <if test="workflow.description != null and workflow.description != ''"> | ||||
| and description = #{workflow.description} | and description = #{workflow.description} | ||||
| @@ -68,7 +68,7 @@ | |||||
| and id = #{workflow.id} | and id = #{workflow.id} | ||||
| </if> | </if> | ||||
| <if test="workflow.name != null and workflow.name != ''"> | <if test="workflow.name != null and workflow.name != ''"> | ||||
| and name = #{workflow.name} | |||||
| and name like "%"#{workflow.name}"%" | |||||
| </if> | </if> | ||||
| <if test="workflow.description != null and workflow.description != ''"> | <if test="workflow.description != null and workflow.description != ''"> | ||||
| and description = #{workflow.description} | and description = #{workflow.description} | ||||
| @@ -171,6 +171,7 @@ | |||||
| <where> | <where> | ||||
| state = 1 | state = 1 | ||||
| <if test="workflow.name != null and workflow.name != ''"> | <if test="workflow.name != null and workflow.name != ''"> | ||||
| and name like "%"#{workflow.name}"%" | and name like "%"#{workflow.name}"%" | ||||
| </if> | </if> | ||||
| </where> | </where> | ||||