|
|
@@ -1,6 +1,5 @@ |
|
|
package com.ruoyi.platform.scheduling; |
|
|
package com.ruoyi.platform.scheduling; |
|
|
|
|
|
|
|
|
import com.ruoyi.platform.constant.Constant; |
|
|
|
|
|
import com.ruoyi.platform.domain.Experiment; |
|
|
import com.ruoyi.platform.domain.Experiment; |
|
|
import com.ruoyi.platform.domain.ExperimentIns; |
|
|
import com.ruoyi.platform.domain.ExperimentIns; |
|
|
import com.ruoyi.platform.mapper.ExperimentDao; |
|
|
import com.ruoyi.platform.mapper.ExperimentDao; |
|
|
@@ -48,50 +47,54 @@ public class ExperimentInstanceStatusTask { |
|
|
} |
|
|
} |
|
|
//运行成功的实验实例记录指标数值 |
|
|
//运行成功的实验实例记录指标数值 |
|
|
// if (Constant.Succeeded.equals(experimentIns.getStatus())) { |
|
|
// if (Constant.Succeeded.equals(experimentIns.getStatus())) { |
|
|
Map<String, Object> metricRecord = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricRecord()); |
|
|
|
|
|
List<Map<String, Object>> trainMetricRecords = (List<Map<String, Object>>) metricRecord.get("train"); |
|
|
|
|
|
List<Map<String, Object>> evaluateMetricRecords = (List<Map<String, Object>>) metricRecord.get("evaluate"); |
|
|
|
|
|
|
|
|
Map<String, Object> metricRecord = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricRecord()); |
|
|
|
|
|
List<Map<String, Object>> trainMetricRecords = (List<Map<String, Object>>) metricRecord.get("train"); |
|
|
|
|
|
List<Map<String, Object>> evaluateMetricRecords = (List<Map<String, Object>>) metricRecord.get("evaluate"); |
|
|
|
|
|
|
|
|
HashMap<String, Object> metricValue = new HashMap<>(); |
|
|
|
|
|
HashMap<String, Object> trainMetricValues = new HashMap<>(); |
|
|
|
|
|
HashMap<String, Object> evaluateMetricValues = new HashMap<>(); |
|
|
|
|
|
|
|
|
HashMap<String, Object> metricValue = new HashMap<>(); |
|
|
|
|
|
HashMap<String, Object> trainMetricValues = new HashMap<>(); |
|
|
|
|
|
HashMap<String, Object> evaluateMetricValues = new HashMap<>(); |
|
|
|
|
|
|
|
|
if (trainMetricRecords != null && !trainMetricRecords.isEmpty()) { |
|
|
|
|
|
for (Map<String, Object> trainMetricRecord : trainMetricRecords) { |
|
|
|
|
|
HashMap<String, Object> trainMetricValue = new HashMap<>(); |
|
|
|
|
|
String taskId = (String) trainMetricRecord.get("task_id"); |
|
|
|
|
|
if (taskId.startsWith("model-train")) { |
|
|
|
|
|
String runId = (String) trainMetricRecord.get("run_id"); |
|
|
|
|
|
List<InsMetricInfoVo> expTrainInfos = aimService.getExpInfos1(true, experimentIns.getExperimentId(), runId); |
|
|
|
|
|
for (InsMetricInfoVo expTrainInfo : expTrainInfos) { |
|
|
|
|
|
Map metrics = expTrainInfo.getMetrics(); |
|
|
|
|
|
trainMetricValue.putAll(metrics); |
|
|
|
|
|
trainMetricValue.put("run_hash", expTrainInfo.getRunId()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (trainMetricRecords != null && !trainMetricRecords.isEmpty()) { |
|
|
|
|
|
for (Map<String, Object> trainMetricRecord : trainMetricRecords) { |
|
|
|
|
|
HashMap<String, Object> trainMetricValue = new HashMap<>(); |
|
|
|
|
|
String taskId = (String) trainMetricRecord.get("task_id"); |
|
|
|
|
|
if (taskId.startsWith("model-train")) { |
|
|
|
|
|
String runId = (String) trainMetricRecord.get("run_id"); |
|
|
|
|
|
List<InsMetricInfoVo> expTrainInfos = aimService.getExpInfos1(true, experimentIns.getExperimentId(), runId); |
|
|
|
|
|
for (InsMetricInfoVo expTrainInfo : expTrainInfos) { |
|
|
|
|
|
Map metrics = expTrainInfo.getMetrics(); |
|
|
|
|
|
trainMetricValue.putAll(metrics); |
|
|
|
|
|
trainMetricValue.put("run_hash", expTrainInfo.getRunId()); |
|
|
|
|
|
} |
|
|
|
|
|
if (trainMetricValue.size() > 0) { |
|
|
|
|
|
trainMetricValues.put(taskId, trainMetricValue); |
|
|
} |
|
|
} |
|
|
trainMetricValues.put(taskId, trainMetricValue); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (evaluateMetricRecords != null && !evaluateMetricRecords.isEmpty()) { |
|
|
|
|
|
for (Map<String, Object> evaluateMetricRecord : evaluateMetricRecords) { |
|
|
|
|
|
HashMap<String, Object> evaluateMetricValue = new HashMap<>(); |
|
|
|
|
|
String taskId = (String) evaluateMetricRecord.get("task_id"); |
|
|
|
|
|
if (taskId.startsWith("model-evaluate")) { |
|
|
|
|
|
String runId = (String) evaluateMetricRecord.get("run_id"); |
|
|
|
|
|
List<InsMetricInfoVo> expTrainInfos = aimService.getExpInfos1(false, experimentIns.getExperimentId(), runId); |
|
|
|
|
|
for (InsMetricInfoVo expTrainInfo : expTrainInfos) { |
|
|
|
|
|
Map metrics = expTrainInfo.getMetrics(); |
|
|
|
|
|
evaluateMetricValue.putAll(metrics); |
|
|
|
|
|
evaluateMetricValue.put("run_hash", expTrainInfo.getRunId()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (evaluateMetricRecords != null && !evaluateMetricRecords.isEmpty()) { |
|
|
|
|
|
for (Map<String, Object> evaluateMetricRecord : evaluateMetricRecords) { |
|
|
|
|
|
HashMap<String, Object> evaluateMetricValue = new HashMap<>(); |
|
|
|
|
|
String taskId = (String) evaluateMetricRecord.get("task_id"); |
|
|
|
|
|
if (taskId.startsWith("model-evaluate")) { |
|
|
|
|
|
String runId = (String) evaluateMetricRecord.get("run_id"); |
|
|
|
|
|
List<InsMetricInfoVo> expTrainInfos = aimService.getExpInfos1(false, experimentIns.getExperimentId(), runId); |
|
|
|
|
|
for (InsMetricInfoVo expTrainInfo : expTrainInfos) { |
|
|
|
|
|
Map metrics = expTrainInfo.getMetrics(); |
|
|
|
|
|
evaluateMetricValue.putAll(metrics); |
|
|
|
|
|
evaluateMetricValue.put("run_hash", expTrainInfo.getRunId()); |
|
|
|
|
|
} |
|
|
|
|
|
if (evaluateMetricValue.size() > 0) { |
|
|
|
|
|
evaluateMetricValues.put(taskId, evaluateMetricValue); |
|
|
} |
|
|
} |
|
|
evaluateMetricValues.put(taskId, evaluateMetricValue); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
metricValue.put("train", trainMetricValues); |
|
|
|
|
|
metricValue.put("evaluate", evaluateMetricValues); |
|
|
|
|
|
experimentIns.setMetricValue(JsonUtils.mapToJson(metricValue)); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
metricValue.put("train", trainMetricValues); |
|
|
|
|
|
metricValue.put("evaluate", evaluateMetricValues); |
|
|
|
|
|
experimentIns.setMetricValue(JsonUtils.mapToJson(metricValue)); |
|
|
// } |
|
|
// } |
|
|
experimentIns.setUpdateTime(new Date()); |
|
|
experimentIns.setUpdateTime(new Date()); |
|
|
// 线程安全的添加操作 |
|
|
// 线程安全的添加操作 |
|
|
|