| @@ -49,28 +49,38 @@ public class ExperimentInstanceStatusTask { | |||
| //运行成功的实验实例记录指标数值 | |||
| if (Constant.Succeeded.equals(experimentIns.getStatus())) { | |||
| Map<String, Object> metricRecord = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricRecord()); | |||
| List<Map<String, Object>> trainMetricRecord = (List<Map<String, Object>>) metricRecord.get("train"); | |||
| List<Map<String, Object>> evaluateMetricRecord = (List<Map<String, Object>>) metricRecord.get("evaluate"); | |||
| 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> trainMetricValue = new HashMap<>(); | |||
| HashMap<String, Object> evaluateMetricValue = new HashMap<>(); | |||
| if (trainMetricRecord != null && !trainMetricRecord.isEmpty()) { | |||
| String runId = (String) trainMetricRecord.get(0).get("run_id"); | |||
| List<InsMetricInfoVo> expTrainInfos = aimService.getExpTrainInfos1(true, experimentIns.getExperimentId(), runId); | |||
| for (InsMetricInfoVo expTrainInfo : expTrainInfos) { | |||
| Map metrics = expTrainInfo.getMetrics(); | |||
| trainMetricValue.putAll(metrics); | |||
| if (trainMetricRecords != null && !trainMetricRecords.isEmpty()) { | |||
| for (Map<String, Object> trainMetricRecord : trainMetricRecords) { | |||
| String taskId = (String) trainMetricRecord.get("task_id"); | |||
| if (taskId.startsWith("model-export")) { | |||
| String runId = (String) trainMetricRecord.get("run_id"); | |||
| List<InsMetricInfoVo> expTrainInfos = aimService.getExpTrainInfos1(true, experimentIns.getExperimentId(), runId); | |||
| for (InsMetricInfoVo expTrainInfo : expTrainInfos) { | |||
| Map metrics = expTrainInfo.getMetrics(); | |||
| trainMetricValue.putAll(metrics); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| if (evaluateMetricRecord != null && !evaluateMetricRecord.isEmpty()) { | |||
| String runId = (String) evaluateMetricRecord.get(0).get("run_id"); | |||
| List<InsMetricInfoVo> expTrainInfos = aimService.getExpTrainInfos1(false, experimentIns.getExperimentId(), runId); | |||
| for (InsMetricInfoVo expTrainInfo : expTrainInfos) { | |||
| Map metrics = expTrainInfo.getMetrics(); | |||
| evaluateMetricValue.putAll(metrics); | |||
| if (evaluateMetricRecords != null && !evaluateMetricRecords.isEmpty()) { | |||
| for (Map<String, Object> evaluateMetricRecord : evaluateMetricRecords) { | |||
| String taskId = (String) evaluateMetricRecord.get("task_id"); | |||
| if (taskId.startsWith("model-export")) { | |||
| String runId = (String) evaluateMetricRecord.get("run_id"); | |||
| List<InsMetricInfoVo> expTrainInfos = aimService.getExpTrainInfos1(false, experimentIns.getExperimentId(), runId); | |||
| for (InsMetricInfoVo expTrainInfo : expTrainInfos) { | |||
| Map metrics = expTrainInfo.getMetrics(); | |||
| evaluateMetricValue.putAll(metrics); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| metricValue.put("train", trainMetricValue); | |||