diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java index fb72bc65..55ed5a45 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java @@ -46,7 +46,6 @@ public class ExperimentInstanceStatusTask { experimentIns.setStatus("Failed"); } //运行成功的实验实例记录指标数值 -// if (Constant.Succeeded.equals(experimentIns.getStatus())) { Map metricRecord = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricRecord()); List> trainMetricRecords = (List>) metricRecord.get("train"); List> evaluateMetricRecords = (List>) metricRecord.get("evaluate"); @@ -92,10 +91,17 @@ public class ExperimentInstanceStatusTask { } } } - metricValue.put("train", trainMetricValues); - metricValue.put("evaluate", evaluateMetricValues); + if (trainMetricValues.size() > 0) { + metricValue.put("train", trainMetricValues); + } else { + metricValue.put("train", null); + } + if (evaluateMetricValues.size() > 0) { + metricValue.put("evaluate", evaluateMetricValues); + } else { + metricValue.put("evaluate", null); + } experimentIns.setMetricValue(JsonUtils.mapToJson(metricValue)); -// } experimentIns.setUpdateTime(new Date()); // 线程安全的添加操作 synchronized (experimentIds) { diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml index 9930093d..e46da649 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml @@ -256,10 +256,10 @@ where state = 1 and experiment_id = #{experimentId} - and not JSON_CONTAINS(metric_record, 'null', '$.train') + and not JSON_CONTAINS(metric_value, 'null', '$.train') - and not JSON_CONTAINS(metric_record, 'null', '$.evaluate') + and not JSON_CONTAINS(metric_value, 'null', '$.evaluate') @@ -272,10 +272,10 @@ where state = 1 and experiment_id = #{experimentId} - and not JSON_CONTAINS(metric_record, 'null', '$.train') + and not JSON_CONTAINS(metric_value, 'null', '$.train') - and not JSON_CONTAINS(metric_record, 'null', '$.evaluate') + and not JSON_CONTAINS(metric_value, 'null', '$.evaluate')