Browse Source

自动超参数寻优实验功能开发

dev-ray
chenzhihang 11 months ago
parent
commit
a80a13e0d9
3 changed files with 13 additions and 4 deletions
  1. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/ray/RayInsController.java
  2. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/RayInsService.java
  3. +11
    -2
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/RayInsServiceImpl.java

+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/ray/RayInsController.java View File

@@ -54,7 +54,7 @@ public class RayInsController extends BaseController {

@GetMapping("{id}")
@ApiOperation("查看实验实例详情")
public GenericsAjaxResult<RayIns> getDetailById(@PathVariable("id") Long id) throws IOException {
public GenericsAjaxResult<RayIns> getDetailById(@PathVariable("id") Long id) throws Exception {
return genericsSuccess(this.rayInsService.getDetailById(id));
}
}

+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/RayInsService.java View File

@@ -15,7 +15,7 @@ public interface RayInsService {

boolean terminateRayIns(Long id) throws Exception;

RayIns getDetailById(Long id) throws IOException;
RayIns getDetailById(Long id) throws Exception;

void updateRayStatus(Long rayId);



+ 11
- 2
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/RayInsServiceImpl.java View File

@@ -9,6 +9,7 @@ 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 org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
@@ -39,6 +40,9 @@ public class RayInsServiceImpl implements RayInsService {
@Resource
private RayDao rayDao;

@Resource
private MinioUtil minioUtil;

@Override
public Page<RayIns> queryByPage(Long rayId, PageRequest pageRequest) throws IOException {
long total = this.rayInsDao.count(rayId);
@@ -161,7 +165,7 @@ public class RayInsServiceImpl implements RayInsService {
}

@Override
public RayIns getDetailById(Long id) throws IOException {
public RayIns getDetailById(Long id) throws Exception {
RayIns rayIns = rayInsDao.queryById(id);
if (Constant.Running.equals(rayIns.getStatus()) || Constant.Pending.equals(rayIns.getStatus())) {
rayIns = queryStatusFromArgo(rayIns);
@@ -260,8 +264,13 @@ public class RayInsServiceImpl implements RayInsService {
return rayInsDao.queryByRayInsIsNotTerminated();
}

public ArrayList<Map<String, Object>> getTrialList(String directoryPath) throws IOException {
public ArrayList<Map<String, Object>> getTrialList(String directoryPath) throws Exception {
// 获取指定路径下的所有文件
String bucketName = directoryPath.substring(0, directoryPath.indexOf("/"));
String prefix = directoryPath.substring(directoryPath.indexOf("/") + 1, directoryPath.length()) + "/";

List<Map> maps = minioUtil.listFilesInDirectory(bucketName, prefix);

Path dirPath = Paths.get(directoryPath);
Path experimentState = Files.list(dirPath).filter(path -> Files.isRegularFile(path) && path.getFileName().toString().startsWith("experiment_state")).collect(Collectors.toList()).get(0);
String content = new String(Files.readAllBytes(experimentState));


Loading…
Cancel
Save