|
|
|
@@ -6,10 +6,7 @@ import com.ruoyi.platform.domain.RayIns; |
|
|
|
import com.ruoyi.platform.mapper.RayDao; |
|
|
|
import com.ruoyi.platform.mapper.RayInsDao; |
|
|
|
import com.ruoyi.platform.service.RayInsService; |
|
|
|
import com.ruoyi.platform.utils.DateUtils; |
|
|
|
import com.ruoyi.platform.utils.HttpUtils; |
|
|
|
import com.ruoyi.platform.utils.JsonUtils; |
|
|
|
import com.ruoyi.platform.utils.MinioUtil; |
|
|
|
import com.ruoyi.platform.utils.*; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
@@ -21,6 +18,7 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.io.IOException; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.nio.file.Paths; |
|
|
|
import java.util.*; |
|
|
|
@@ -39,6 +37,11 @@ public class RayInsServiceImpl implements RayInsService { |
|
|
|
@Value("${minio.endpointIp}") |
|
|
|
String endpoint; |
|
|
|
|
|
|
|
@Value("${aim.url}") |
|
|
|
private String aimUrl; |
|
|
|
@Value("${aim.proxyUrl}") |
|
|
|
private String aimProxyUrl; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private RayInsDao rayInsDao; |
|
|
|
|
|
|
|
@@ -269,6 +272,22 @@ public class RayInsServiceImpl implements RayInsService { |
|
|
|
return rayInsDao.queryByRayInsIsNotTerminated(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public String getExpMetrics(String trailIds) throws Exception { |
|
|
|
String encodedUrlString = URLEncoder.encode("run.trial_id in " + trailIds, "UTF-8"); |
|
|
|
String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; |
|
|
|
String s = HttpUtils.sendGet(url, null); |
|
|
|
List<Map<String, Object>> responses = JacksonUtil.parseJSONStr2MapList(s); |
|
|
|
|
|
|
|
List<String> runIds = new ArrayList<>(); |
|
|
|
for (Map response:responses) { |
|
|
|
runIds.add((String)response.get("run_hash")); |
|
|
|
} |
|
|
|
|
|
|
|
String decode = AIM64EncoderUtil.decode(runIds); |
|
|
|
return aimUrl + "/metrics?select=" + decode; |
|
|
|
} |
|
|
|
|
|
|
|
public void getTrialList(RayIns rayIns) throws Exception { |
|
|
|
// 获取指定路径下的所有文件 |
|
|
|
String directoryPath = rayIns.getResultPath(); |
|
|
|
|