| @@ -6,6 +6,7 @@ import com.ruoyi.platform.domain.ActiveLearnIns; | |||||
| import com.ruoyi.platform.service.ActiveLearnInsService; | import com.ruoyi.platform.service.ActiveLearnInsService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import io.swagger.v3.oas.annotations.responses.ApiResponse; | |||||
| import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
| @@ -57,4 +58,11 @@ public class ActiveLearnInsController extends BaseController { | |||||
| public GenericsAjaxResult<ActiveLearnIns> getDetailById(@PathVariable("id") Long id) throws Exception { | public GenericsAjaxResult<ActiveLearnIns> getDetailById(@PathVariable("id") Long id) throws Exception { | ||||
| return genericsSuccess(this.activeLearnInsService.getDetailById(id)); | return genericsSuccess(this.activeLearnInsService.getDetailById(id)); | ||||
| } | } | ||||
| @PostMapping("/getExpMetrics") | |||||
| @ApiOperation("获取当前实验的指标对比地址") | |||||
| @ApiResponse | |||||
| public GenericsAjaxResult<String> getExpMetrics(@RequestBody String experimentInsId) throws Exception { | |||||
| return genericsSuccess(activeLearnInsService.getExpMetrics(experimentInsId)); | |||||
| } | |||||
| } | } | ||||
| @@ -5,6 +5,7 @@ import org.springframework.data.domain.Page; | |||||
| import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.UnsupportedEncodingException; | |||||
| import java.util.List; | import java.util.List; | ||||
| public interface ActiveLearnInsService { | public interface ActiveLearnInsService { | ||||
| @@ -25,4 +26,6 @@ public interface ActiveLearnInsService { | |||||
| ActiveLearnIns queryStatusFromArgo(ActiveLearnIns ins); | ActiveLearnIns queryStatusFromArgo(ActiveLearnIns ins); | ||||
| List<ActiveLearnIns> queryActiveLearnInsIsNotTerminated(); | List<ActiveLearnIns> queryActiveLearnInsIsNotTerminated(); | ||||
| String getExpMetrics(String experimentInsId) throws Exception; | |||||
| } | } | ||||
| @@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional; | |||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.net.URLEncoder; | |||||
| import java.util.*; | import java.util.*; | ||||
| @Service | @Service | ||||
| @@ -34,6 +35,10 @@ public class ActiveLearnInsServiceImpl implements ActiveLearnInsService { | |||||
| private String argoWorkflowTermination; | private String argoWorkflowTermination; | ||||
| @Value("${minio.endpointIp}") | @Value("${minio.endpointIp}") | ||||
| String endpoint; | String endpoint; | ||||
| @Value("${aim.url}") | |||||
| private String aimUrl; | |||||
| @Value("${aim.proxyUrl}") | |||||
| private String aimProxyUrl; | |||||
| @Resource | @Resource | ||||
| private ActiveLearnInsDao activeLearnInsDao; | private ActiveLearnInsDao activeLearnInsDao; | ||||
| @@ -269,6 +274,22 @@ public class ActiveLearnInsServiceImpl implements ActiveLearnInsService { | |||||
| return activeLearnInsDao.queryActiveLearnInsIsNotTerminated(); | return activeLearnInsDao.queryActiveLearnInsIsNotTerminated(); | ||||
| } | } | ||||
| @Override | |||||
| public String getExpMetrics(String experimentInsId) throws Exception { | |||||
| String encodedUrlString = URLEncoder.encode("run.id in " + experimentInsId, "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(ActiveLearnIns ins) { | public void getTrialList(ActiveLearnIns ins) { | ||||
| String directoryPath = ins.getResultPath(); | String directoryPath = ins.getResultPath(); | ||||
| ins.setResultPath(endpoint + "/" + directoryPath + "/final_checkpoint/final_model_weights.pth"); | ins.setResultPath(endpoint + "/" + directoryPath + "/final_checkpoint/final_model_weights.pth"); | ||||