Browse Source

新增字段参数记录

pull/83/head
fanshuai 1 year ago
parent
commit
9e140d1944
3 changed files with 40 additions and 13 deletions
  1. +10
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ExperimentIns.java
  2. +3
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java
  3. +27
    -13
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml

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

@@ -48,6 +48,9 @@ public class ExperimentIns implements Serializable {
@ApiModelProperty(value = "实验实例全局参数", notes = "以JSON字符串格式存储") @ApiModelProperty(value = "实验实例全局参数", notes = "以JSON字符串格式存储")
@JsonRawValue @JsonRawValue
private String globalParam; private String globalParam;
@ApiModelProperty(value = "参数记录", notes = "以JSON字符串格式存储")
@JsonRawValue
private String metricRecord;


@ApiModelProperty(value = "开始时间") @ApiModelProperty(value = "开始时间")
private Date startTime; private Date startTime;
@@ -210,5 +213,12 @@ public class ExperimentIns implements Serializable {


public void setWorkflowId(Long workflowId) {this.workflowId = workflowId;} public void setWorkflowId(Long workflowId) {this.workflowId = workflowId;}


public String getMetricRecord() {
return metricRecord;
}

public void setMetricRecord(String metricRecord) {
this.metricRecord = metricRecord;
}
} }



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

@@ -251,6 +251,9 @@ public class ExperimentServiceImpl implements ExperimentService {
if (data == null || MapUtils.isEmpty(data)) { if (data == null || MapUtils.isEmpty(data)) {
throw new RuntimeException("Failed to run workflow."); throw new RuntimeException("Failed to run workflow.");
} }
//获取训练参数
Map<String, Object> metricRecord = (Map<String, Object>) runResMap.get("metric_record");

Map<String, Object> metadata = (Map<String, Object>) data.get("metadata"); Map<String, Object> metadata = (Map<String, Object>) data.get("metadata");
// 插入记录到实验实例表 // 插入记录到实验实例表
ExperimentIns experimentIns = new ExperimentIns(); ExperimentIns experimentIns = new ExperimentIns();


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

@@ -12,6 +12,7 @@
<result property="nodesResult" column="nodes_result" jdbcType="VARCHAR"/> <result property="nodesResult" column="nodes_result" jdbcType="VARCHAR"/>
<result property="nodesLogs" column="nodes_logs" jdbcType="VARCHAR"/> <result property="nodesLogs" column="nodes_logs" jdbcType="VARCHAR"/>
<result property="globalParam" column="global_param" jdbcType="VARCHAR"/> <result property="globalParam" column="global_param" jdbcType="VARCHAR"/>
<result property="metricRecord" column="metric_record" jdbcType="VARCHAR"/>
<result property="startTime" column="start_time" jdbcType="TIMESTAMP"/> <result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
<result property="finishTime" column="finish_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"/>
@@ -23,7 +24,7 @@


<!--查询非终止态的实例--> <!--查询非终止态的实例-->
<select id="queryByExperimentIsNotTerminated" resultMap="ExperimentInsMap"> <select id="queryByExperimentIsNotTerminated" resultMap="ExperimentInsMap">
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
select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs,global_param,metric_record, start_time, finish_time, create_by, create_time, update_by, update_time, state
from experiment_ins from experiment_ins
where (status NOT IN ('Terminated', 'Succeeded', 'Failed') where (status NOT IN ('Terminated', 'Succeeded', 'Failed')
OR status IS NULL) and state = 1 OR status IS NULL) and state = 1
@@ -31,14 +32,14 @@


<!--查询单个--> <!--查询单个-->
<select id="queryById" resultMap="ExperimentInsMap"> <select id="queryById" resultMap="ExperimentInsMap">
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
select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs,global_param,metric_record, 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_result, nodes_logs, global_param, 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,metric_record, 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 where experiment_id = #{experiment_id} and state = 1
order by create_time DESC order by create_time DESC
@@ -47,7 +48,7 @@


<!--查询最近的3个实例列表--> <!--查询最近的3个实例列表-->
<select id="getLatestInsList" resultMap="ExperimentInsMap"> <select id="getLatestInsList" resultMap="ExperimentInsMap">
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
select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, global_param,metric_record, start_time, finish_time, create_by, create_time, update_by, update_time, state
from experiment_ins from experiment_ins
where state = 1 where state = 1
order by create_time DESC order by create_time DESC
@@ -58,7 +59,7 @@


<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_result, nodes_logs,global_param, 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,metric_record, 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
@@ -86,6 +87,9 @@
<if test="experimentIns.globalParam != null and experimentIns.globalParam != ''"> <if test="experimentIns.globalParam != null and experimentIns.globalParam != ''">
and global_param = #{experimentIns.globalParam} and global_param = #{experimentIns.globalParam}
</if> </if>
<if test="experimentIns.metricRecord != null and experimentIns.metricRecord != ''">
and metric_record = #{experimentIns.metricRecord}
</if>
<if test="experimentIns.startTime != null"> <if test="experimentIns.startTime != null">
and start_time = #{experimentIns.startTime} and start_time = #{experimentIns.startTime}
</if> </if>
@@ -110,7 +114,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_result, nodes_logs,global_param, 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,metric_record, 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
@@ -138,6 +142,9 @@
<if test="experimentIns.globalParam != null and experimentIns.globalParam != ''"> <if test="experimentIns.globalParam != null and experimentIns.globalParam != ''">
and global_param = #{experimentIns.globalParam} and global_param = #{experimentIns.globalParam}
</if> </if>
<if test="experimentIns.metricRecord != null and experimentIns.metricRecord != ''">
and metric_record = #{experimentIns.metricRecord}
</if>
<if test="experimentIns.startTime != null"> <if test="experimentIns.startTime != null">
and start_time = #{experimentIns.startTime} and start_time = #{experimentIns.startTime}
</if> </if>
@@ -191,6 +198,9 @@
<if test="experimentIns.globalParam != null and experimentIns.globalParam != ''"> <if test="experimentIns.globalParam != null and experimentIns.globalParam != ''">
and global_param = #{experimentIns.globalParam} and global_param = #{experimentIns.globalParam}
</if> </if>
<if test="experimentIns.metricRecord != null and experimentIns.metricRecord != ''">
and metric_record = #{experimentIns.metricRecord}
</if>
<if test="experimentIns.startTime != null"> <if test="experimentIns.startTime != null">
and start_time = #{experimentIns.startTime} and start_time = #{experimentIns.startTime}
</if> </if>
@@ -213,23 +223,23 @@
</select> </select>


<select id="queryByExperimentId" resultMap="ExperimentInsMap"> <select id="queryByExperimentId" resultMap="ExperimentInsMap">
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
select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, global_param,metric_record, start_time, finish_time, create_by, create_time, update_by, update_time, state
from experiment_ins from experiment_ins
where experiment_id = #{id} and state = 1 where experiment_id = #{id} and state = 1
</select> </select>


<!--新增所有列--> <!--新增所有列-->
<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_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 into experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,nodes_logs,global_param,metric_record,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.metricRecord},#{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_result,nodes_logs,global_param,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,metric_record,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.nodesResult},#{entity.nodesLogs},#{entity.globalParam},#{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.metricRecord},#{entity.startTime},#{entity.finishTime},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state})
</foreach> </foreach>
</insert> </insert>


@@ -244,10 +254,10 @@
<!-- experiment_id = values(experiment_id)argo_ins_name = values(argo_ins_name)argo_ins_ns = values(argo_ins_ns)status = values(status) nodes_status = values(nodes_status) create_by = values(create_by)create_time = values(create_time)update_by = values(update_by)update_time = values(update_time)state = values(state)--> <!-- experiment_id = values(experiment_id)argo_ins_name = values(argo_ins_name)argo_ins_ns = values(argo_ins_ns)status = values(status) nodes_status = values(nodes_status) create_by = values(create_by)create_time = values(create_time)update_by = values(update_by)update_time = values(update_time)state = values(state)-->
<!-- </insert>--> <!-- </insert>-->
<update id="insertOrUpdateBatch"> <update id="insertOrUpdateBatch">
insert into experiment_ins (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)
insert into experiment_ins (id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_result, nodes_logs, global_param,metric_record, start_time, finish_time, create_by, create_time, update_by, update_time, state)
values values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
(#{item.id}, #{item.experimentId}, #{item.argoInsName}, #{item.argoInsNs}, #{item.status}, #{item.nodesStatus}, #{item.nodesResult}, #{item.nodesLogs}, #{item.globalParam}, #{item.startTime}, #{item.finishTime}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.state})
(#{item.id}, #{item.experimentId}, #{item.argoInsName}, #{item.argoInsNs}, #{item.status}, #{item.nodesStatus}, #{item.nodesResult}, #{item.nodesLogs}, #{item.globalParam},#{item.metricRecord}, #{item.startTime}, #{item.finishTime}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.state})
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
experiment_id = VALUES(experiment_id), experiment_id = VALUES(experiment_id),
@@ -258,6 +268,7 @@
nodes_result = VALUES(nodes_result), nodes_result = VALUES(nodes_result),
nodes_logs = VALUES(nodes_logs), nodes_logs = VALUES(nodes_logs),
global_param = VALUES(global_param), global_param = VALUES(global_param),
metric_record = VALUES(metric_record),
start_time = VALUES(start_time), start_time = VALUES(start_time),
finish_time = VALUES(finish_time), finish_time = VALUES(finish_time),
create_by = VALUES(create_by), create_by = VALUES(create_by),
@@ -294,6 +305,9 @@
<if test="experimentIns.globalParam != null and experimentIns.globalParam != ''"> <if test="experimentIns.globalParam != null and experimentIns.globalParam != ''">
global_param = #{experimentIns.globalParam}, global_param = #{experimentIns.globalParam},
</if> </if>
<if test="experimentIns.metricRecord != null and experimentIns.metricRecord != ''">
and metric_record = #{experimentIns.metricRecord}
</if>
<if test="experimentIns.startTime != null"> <if test="experimentIns.startTime != null">
start_time = #{experimentIns.startTime}, start_time = #{experimentIns.startTime},
</if> </if>


Loading…
Cancel
Save