Browse Source

增加global_param字段

pull/9/head
西大锐 1 year ago
parent
commit
9be4b9dbcf
10 changed files with 80 additions and 23 deletions
  1. +3
    -3
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentController.java
  2. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentInsController.java
  3. +17
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ExperimentIns.java
  4. +12
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/Workflow.java
  5. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java
  6. +3
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java
  7. +3
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java
  8. +20
    -8
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml
  9. +19
    -9
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/WorkflowDaoMapper.xml
  10. +1
    -1
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/WorkflowParamDaoMapper.xml

+ 3
- 3
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentController.java View File

@@ -45,7 +45,7 @@ public class ExperimentController extends BaseController {
return genericsSuccess(this.experimentService.queryByPage(experiment, pageRequest));
}

@GetMapping(("/status"))
@GetMapping("/status")
@ApiOperation("查询实验状态")
public GenericsAjaxResult<Page<Experiment>> selectStatus(@RequestBody Experiment experiment, PageRequest pageRequest) throws IOException {
return genericsSuccess(this.experimentService.selectStatus(experiment, pageRequest));
@@ -53,8 +53,8 @@ public class ExperimentController extends BaseController {



@GetMapping(("/configuration"))
@ApiOperation("查询实验配置")
@GetMapping("/configuration")
@ApiOperation("查询实验配置参数")
public GenericsAjaxResult<ResponseEntity<Experiment>> showExperimentConfig(@RequestBody Experiment experiment){
return genericsSuccess(this.experimentService.showExperimentConfig(experiment));
}


+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentInsController.java View File

@@ -138,7 +138,7 @@ public class ExperimentInsController extends BaseController {

@GetMapping("/pods/log")
@ApiOperation("获取pod实时日志请求")
public GenericsAjaxResult<Map> getRealtimePodLog(@RequestParam("pod_name") String podName,
public GenericsAjaxResult<Map<String, Object>> getRealtimePodLog(@RequestParam("pod_name") String podName,
@RequestParam("start_time") String startTime){
return genericsSuccess(this.experimentInsService.getRealtimePodLog(podName,startTime));
}


+ 17
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ExperimentIns.java View File

@@ -15,6 +15,7 @@ import java.util.Date;
* @since 2023-11-09 09:48:36
*/
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@ApiModel("实验实例对象")
public class ExperimentIns implements Serializable {
private static final long serialVersionUID = 623464560240790680L;
@ApiModelProperty(name = "id")
@@ -46,6 +47,14 @@ public class ExperimentIns implements Serializable {
@ApiModelProperty(name = "nodes_logs")
private String nodesLogs;



/**
* 实验实例全局参数
*/
// @ApiModelProperty(name = "global_param")
private String globalParam;

/**
* 开始时间
*/
@@ -154,6 +163,14 @@ public class ExperimentIns implements Serializable {
this.nodesLogs = nodesLogs;
}

public String getGlobalParam() {
return globalParam;
}

public void setGlobalParam(String globalParam) {
this.globalParam = globalParam;
}

public void setStartTime(Date startTime) {
this.startTime = startTime;
}


+ 12
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/Workflow.java View File

@@ -46,6 +46,10 @@ public class Workflow extends BaseMetaObjectHandler implements Serializable {
*/
@ApiModelProperty(name = "dag")
private String dag;

// @ApiModelProperty(name = "global_param")
private String globalParam;

/**
* 创建者
*/
@@ -105,6 +109,14 @@ public class Workflow extends BaseMetaObjectHandler implements Serializable {
this.dag = dag;
}

public String getGlobalParam() {
return globalParam;
}

public void setGlobalParam(String globalParam) {
this.globalParam = globalParam;
}

public String getCreateBy() {
return createBy;
}


+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java View File

@@ -91,7 +91,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
//搞个标记,当状态改变才去改表
boolean flag = false;
List<ExperimentIns> result = new ArrayList<ExperimentIns>();
if (experimentInsList!=null&&experimentInsList.size()>0) {
if (experimentInsList!=null&& experimentInsList.size()>0) {
for (ExperimentIns experimentIns : experimentInsList) {
//当原本状态为null或非终止态时才调用argo接口
if (experimentIns != null && (StringUtils.isEmpty(experimentIns.getStatus())) || !isTerminatedState(experimentIns)) {


+ 3
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java View File

@@ -243,10 +243,13 @@ public class ExperimentServiceImpl implements ExperimentService {

Map<String, Object> metadata = (Map<String, Object>) data.get("metadata");

// 插入记录到实验实例表
ExperimentIns experimentIns = new ExperimentIns();
experimentIns.setExperimentId(experiment.getId());
experimentIns.setArgoInsNs((String) metadata.get("namespace"));
experimentIns.setArgoInsName((String) metadata.get("name"));
//传入实验全局参数
experimentIns.setGlobalParam(experiment.getGlobalParam());

//替换argoInsName
String outputString = JsonUtils.mapToJson(output);


+ 3
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java View File

@@ -153,6 +153,8 @@ public class WorkflowServiceImpl implements WorkflowService {
return new PageImpl<>(this.workflowDao.queryByName(name));
}



@Override
public Workflow duplicateWorkflow(Long id) {
//先去查找数据库中存在的数据
@@ -180,6 +182,7 @@ public class WorkflowServiceImpl implements WorkflowService {
}
duplicateWorkflow.setDag(newDag);
duplicateWorkflow.setDescription(workflow.getDescription());
duplicateWorkflow.setGlobalParam(workflow.getGlobalParam());
return this.insert(duplicateWorkflow);
} catch (Exception e) {
throw new RuntimeException("复制流水线失败: " + e.getMessage(), e);


+ 20
- 8
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml View File

@@ -24,14 +24,14 @@

<!--查询单个-->
<select id="queryById" resultMap="ExperimentInsMap">
select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, start_time, finish_time, create_by, create_time, update_by, update_time, state
select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs,global_param, start_time, finish_time, create_by, create_time, update_by, update_time, state
from experiment_ins
where id = #{id} and state = 1
</select>

<!--查询列表-->
<select id="getByExperimentId" resultMap="ExperimentInsMap">
select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, start_time, finish_time, create_by, create_time, update_by, update_time, state
select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs,global_param, start_time, finish_time, create_by, create_time, update_by, update_time, state
from experiment_ins
where experiment_id = #{experiment_id} and state = 1
order by create_time DESC
@@ -41,7 +41,7 @@

<select id="queryByExperiment" resultMap="ExperimentInsMap">
select
id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, start_time, finish_time, create_by, create_time, update_by, update_time, state
id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs,global_param, start_time, finish_time, create_by, create_time, update_by, update_time, state
from experiment_ins
<where>
state = 1
@@ -66,6 +66,9 @@
<if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''">
and nodes_logs = #{experimentIns.nodesLogs}
</if>
<if test="experimentIns.globalParam != null and experimentIns.globalParam != ''">
and global_param = #{experimentIns.globalParam}
</if>
<if test="experimentIns.startTime != null">
and start_time = #{experimentIns.startTime}
</if>
@@ -90,7 +93,7 @@
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="ExperimentInsMap">
select
id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, start_time, finish_time, create_by, create_time, update_by, update_time, state
id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs,global_param, start_time, finish_time, create_by, create_time, update_by, update_time, state
from experiment_ins
<where>
state = 1
@@ -115,6 +118,9 @@
<if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''">
and nodes_logs = #{experimentIns.nodesLogs}
</if>
<if test="experimentIns.globalParam != null and experimentIns.globalParam != ''">
and global_param = #{experimentIns.globalParam}
</if>
<if test="experimentIns.startTime != null">
and start_time = #{experimentIns.startTime}
</if>
@@ -165,6 +171,9 @@
<if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''">
and nodes_logs = #{experimentIns.nodesLogs}
</if>
<if test="experimentIns.globalParam != null and experimentIns.globalParam != ''">
and global_param = #{experimentIns.globalParam}
</if>
<if test="experimentIns.startTime != null">
and start_time = #{experimentIns.startTime}
</if>
@@ -188,16 +197,16 @@

<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,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.nodesResult},#{experimentIns.nodesLogs},#{experimentIns.startTime},#{experimentIns.finishTime},#{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_result,nodes_logs,global_param,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.nodesResult},#{experimentIns.nodesLogs},#{experimentIns.globalParam},#{experimentIns.startTime},#{experimentIns.finishTime},#{experimentIns.createBy},#{experimentIns.createTime},#{experimentIns.updateBy},#{experimentIns.updateTime},#{experimentIns.state})
</insert>

<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into
experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,nodes_logs,start_time,finish_time,create_by,create_time,update_by,update_time,state)
experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,nodes_logs,global_param,start_time,finish_time,create_by,create_time,update_by,update_time,state)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.experimentId},#{entity.argoInsName},#{entity.argoInsNs},#{entity.status},#{entity.nodesStatus},#{entity.nodesResult},#{entity.nodesLogs},#{entity.startTime},#{entity.finishTime},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state})
(#{entity.experimentId},#{entity.argoInsName},#{entity.argoInsNs},#{entity.status},#{entity.nodesStatus},#{entity.nodesResult},#{entity.nodesLogs},#{entity.globalParam},#{entity.startTime},#{entity.finishTime},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state})
</foreach>
</insert>

@@ -238,6 +247,9 @@
<if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''">
nodes_logs = #{experimentIns.nodesLogs},
</if>
<if test="experimentIns.globalParam != null and experimentIns.globalParam != ''">
global_param = #{experimentIns.globalParam}
</if>
<if test="experimentIns.startTime != null">
start_time = #{experimentIns.startTime},
</if>


+ 19
- 9
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/WorkflowDaoMapper.xml View File

@@ -7,6 +7,7 @@
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="description" column="description" jdbcType="VARCHAR"/>
<result property="dag" column="dag" jdbcType="VARCHAR"/>
<result property="globalParam" column="global_param" jdbcType="VARCHAR"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
@@ -17,7 +18,7 @@
<!--查询单个-->
<select id="queryById" resultMap="WorkflowMap">
select
id, name, description, dag, create_by, create_time, update_by, update_time, state
id, name, description, dag, global_param, create_by, create_time, update_by, update_time, state
from workflow
where id = #{id} and state = 1
</select>
@@ -25,7 +26,7 @@
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="WorkflowMap" >
select
id, name, description, dag, create_by, create_time, update_by, update_time, state
id, name, description, dag, global_param, create_by, create_time, update_by, update_time, state
from workflow
<where>
state = 1
@@ -41,6 +42,9 @@
<if test="workflow.dag != null and workflow.dag != ''">
and dag = #{workflow.dag}
</if>
<if test="workflow.globalParam != null and workflow.globalParam != ''">
and global_param = #{workflow.globalParam}
</if>
<if test="workflow.createBy != null and workflow.createBy != ''">
and create_by = #{workflow.createBy}
</if>
@@ -76,6 +80,9 @@
<if test="workflow.dag != null and workflow.dag != ''">
and dag = #{workflow.dag}
</if>
<if test="workflow.globalParam != null and workflow.globalParam != ''">
and global_param = #{workflow.globalParam}
</if>
<if test="workflow.createBy != null and workflow.createBy != ''">
and create_by = #{workflow.createBy}
</if>
@@ -93,26 +100,26 @@

<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into workflow(name, description, dag, create_by, create_time, update_by, update_time,state)
values (#{workflow.name}, #{workflow.description}, #{workflow.dag}, #{workflow.createBy}, #{workflow.createTime}, #{workflow.updateBy}, #{workflow.updateTime}, #{workflow.state})
insert into workflow(name, description, dag, global_param, create_by, create_time, update_by, update_time,state)
values (#{workflow.name}, #{workflow.description}, #{workflow.dag},#{workflow.globalParam}, #{workflow.createBy}, #{workflow.createTime}, #{workflow.updateBy}, #{workflow.updateTime}, #{workflow.state})
</insert>



<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into workflow(name, description, dag, create_by, create_time, update_by, update_time, state)
insert into workflow(name, description, dag, global_param, create_by, create_time, update_by, update_time, state)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.name}, #{entity.description}, #{entity.dag}, #{entity.createBy}, #{entity.createTime},
(#{entity.name}, #{entity.description}, #{entity.dag}, #{entity.globalParam}, #{entity.createBy}, #{entity.createTime},
#{entity.updateBy}, #{entity.updateTime}, #{entity.state})
</foreach>
</insert>

<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into workflow(name, description, dag, create_by, create_time, update_by, update_time, state)
insert into workflow(name, description, dag, global_param, create_by, create_time, update_by, update_time, state)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.name}, #{entity.description}, #{entity.dag}, #{entity.createBy}, #{entity.createTime},
(#{entity.name}, #{entity.description}, #{entity.dag}, #{entity.globalParam},#{entity.createBy}, #{entity.createTime},
#{entity.updateBy}, #{entity.updateTime}, #{entity.state})
</foreach>
on duplicate key update
@@ -139,6 +146,9 @@
<if test="workflow.dag != null and workflow.dag != ''">
dag = #{workflow.dag},
</if>
<if test="workflow.globalParam != null and workflow.globalParam != ''">
global_param = #{workflow.globalParam}
</if>
<if test="workflow.createBy != null and workflow.createBy != ''">
create_by = #{workflow.createBy},
</if>
@@ -166,7 +176,7 @@
<!--通过流水线名字进行模糊查询-->
<select id="queryByName" resultMap="WorkflowMap">
select
id, name, description, dag, create_by, create_time, update_by, update_time, state
id, name, description, dag, global_param, create_by, create_time, update_by, update_time, state
from workflow
<where>
state = 1


+ 1
- 1
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/WorkflowParamDaoMapper.xml View File

@@ -7,7 +7,7 @@
<result property="workflowId" column="workflow_id" jdbcType="INTEGER"/>
<result property="paramName" column="param_name" jdbcType="VARCHAR"/>
<result property="description" column="description" jdbcType="VARCHAR"/>
<result property="paramType" column="param_type" jdbcType="INTEGER"/>
<result property="paramType" column="param_type" jdbcType="VARCHAR"/>
<result property="paramValue" column="param_value" jdbcType="VARCHAR"/>
<result property="isSensitive" column="is_sensitive" jdbcType="INTEGER"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>


Loading…
Cancel
Save