| @@ -5,9 +5,9 @@ import com.ruoyi.platform.domain.ExperimentIns; | |||||
| import com.ruoyi.platform.service.AimService; | import com.ruoyi.platform.service.AimService; | ||||
| import com.ruoyi.platform.service.ExperimentInsService; | import com.ruoyi.platform.service.ExperimentInsService; | ||||
| import com.ruoyi.platform.utils.AIM64EncoderUtil; | import com.ruoyi.platform.utils.AIM64EncoderUtil; | ||||
| import com.ruoyi.platform.utils.HttpUtils; | |||||
| import com.ruoyi.platform.utils.JacksonUtil; | import com.ruoyi.platform.utils.JacksonUtil; | ||||
| import com.ruoyi.platform.utils.JsonUtils; | import com.ruoyi.platform.utils.JsonUtils; | ||||
| import com.ruoyi.platform.utils.NewHttpUtils; | |||||
| import com.ruoyi.platform.vo.InsMetricInfoVo; | import com.ruoyi.platform.vo.InsMetricInfoVo; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.factory.annotation.Value; | import org.springframework.beans.factory.annotation.Value; | ||||
| @@ -28,8 +28,6 @@ public class AimServiceImpl implements AimService { | |||||
| private String aimUrl; | private String aimUrl; | ||||
| @Value("${aim.proxyUrl}") | @Value("${aim.proxyUrl}") | ||||
| private String aimProxyUrl; | private String aimProxyUrl; | ||||
| @Resource | |||||
| private NewHttpUtils httpUtils; | |||||
| @Override | @Override | ||||
| public List<InsMetricInfoVo> getExpTrainInfos(Integer experimentId) throws Exception { | public List<InsMetricInfoVo> getExpTrainInfos(Integer experimentId) throws Exception { | ||||
| @@ -54,7 +52,7 @@ public class AimServiceImpl implements AimService { | |||||
| } | } | ||||
| String encodedUrlString = URLEncoder.encode("run.experiment==\"" + experimentName + "\"", "UTF-8"); | String encodedUrlString = URLEncoder.encode("run.experiment==\"" + experimentName + "\"", "UTF-8"); | ||||
| String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; | String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; | ||||
| String s = httpUtils.sendGet(url, null); | |||||
| String s = HttpUtils.sendGet(url, null); | |||||
| List<Map<String, Object>> response = JacksonUtil.parseJSONStr2MapList(s); | List<Map<String, Object>> response = JacksonUtil.parseJSONStr2MapList(s); | ||||
| System.out.println("response: " + JacksonUtil.toJSONString(response)); | System.out.println("response: " + JacksonUtil.toJSONString(response)); | ||||
| if (response == null || response.size() == 0) { | if (response == null || response.size() == 0) { | ||||
| @@ -144,7 +142,7 @@ public class AimServiceImpl implements AimService { | |||||
| public List<InsMetricInfoVo> getExpTrainInfos1(boolean isTrain, Integer experimentId, String runId) throws Exception { | public List<InsMetricInfoVo> getExpTrainInfos1(boolean isTrain, Integer experimentId, String runId) throws Exception { | ||||
| String encodedUrlString = URLEncoder.encode("run.id==\"" + runId + "\"", "UTF-8"); | String encodedUrlString = URLEncoder.encode("run.id==\"" + runId + "\"", "UTF-8"); | ||||
| String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; | String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; | ||||
| String s = httpUtils.sendGet(url, null); | |||||
| String s = HttpUtils.sendGet(url, null); | |||||
| List<Map<String, Object>> response = JacksonUtil.parseJSONStr2MapList(s); | List<Map<String, Object>> response = JacksonUtil.parseJSONStr2MapList(s); | ||||
| System.out.println("response: " + JacksonUtil.toJSONString(response)); | System.out.println("response: " + JacksonUtil.toJSONString(response)); | ||||
| if (response == null || response.size() == 0) { | if (response == null || response.size() == 0) { | ||||
| @@ -252,7 +250,7 @@ public class AimServiceImpl implements AimService { | |||||
| public HashMap<String, Object> queryMetricsParams(String runId) throws UnsupportedEncodingException { | public HashMap<String, Object> queryMetricsParams(String runId) throws UnsupportedEncodingException { | ||||
| String encodedUrlString = URLEncoder.encode("run.id==\"" + runId + "\"", "UTF-8"); | String encodedUrlString = URLEncoder.encode("run.id==\"" + runId + "\"", "UTF-8"); | ||||
| String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; | String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; | ||||
| String s = httpUtils.sendGet(url, null); | |||||
| String s = HttpUtils.sendGet(url, null); | |||||
| List<Map<String, Object>> response = JacksonUtil.parseJSONStr2MapList(s); | List<Map<String, Object>> response = JacksonUtil.parseJSONStr2MapList(s); | ||||
| if (response == null || response.size() == 0) { | if (response == null || response.size() == 0) { | ||||
| return new HashMap<>(); | return new HashMap<>(); | ||||
| @@ -280,7 +278,7 @@ public class AimServiceImpl implements AimService { | |||||
| @Override | @Override | ||||
| public List<Map<String, Object>> getBatchMetric(String runHash, String params) { | public List<Map<String, Object>> getBatchMetric(String runHash, String params) { | ||||
| String url = aimUrl + "/api/runs/" + runHash + "/metric/get-batch"; | String url = aimUrl + "/api/runs/" + runHash + "/metric/get-batch"; | ||||
| String response = httpUtils.sendPost(url, null, params); | |||||
| String response = HttpUtils.sendPost(url, params); | |||||
| if (StringUtils.isNotEmpty(response)) { | if (StringUtils.isNotEmpty(response)) { | ||||
| return JacksonUtil.parseJSONStr2MapList(response); | return JacksonUtil.parseJSONStr2MapList(response); | ||||
| } | } | ||||