Commit def4bcbe authored by linpeiqin's avatar linpeiqin

小bug

parent 11d98239
...@@ -165,7 +165,7 @@ public class ModelEstimateController { ...@@ -165,7 +165,7 @@ public class ModelEstimateController {
public ResponseEntity<Resource> getLog(@RequestParam Long taskId) throws IOException { public ResponseEntity<Resource> getLog(@RequestParam Long taskId) throws IOException {
ModelEstimate modelEstimate = this.modelEstimateService.getById(taskId); ModelEstimate modelEstimate = this.modelEstimateService.getById(taskId);
ModelVersion modelVersion = this.modelVersionService.getById(modelEstimate.getModelVersionId()); ModelVersion modelVersion = this.modelVersionService.getById(modelEstimate.getModelVersionId());
String url = this.pythonConfig.getModelEstimateFileBaseDir() + File.separator + modelVersion.getModelUrl() + File.separator + "evl_" + taskId + File.separator + "run_eval.log"; String url = this.pythonConfig.getModelEstimateFileBaseDir() + modelVersion.getVersionName() + File.separator + "evl_" + taskId + File.separator + "run_eval.log";
return FileUtil.getFileByUrl(url); return FileUtil.getFileByUrl(url);
} }
...@@ -179,7 +179,7 @@ public class ModelEstimateController { ...@@ -179,7 +179,7 @@ public class ModelEstimateController {
public ResponseResult<String> getStatus(@RequestParam Long taskId) throws IOException { public ResponseResult<String> getStatus(@RequestParam Long taskId) throws IOException {
ModelEstimate modelEstimate = this.modelEstimateService.getById(taskId); ModelEstimate modelEstimate = this.modelEstimateService.getById(taskId);
ModelVersion modelVersion = this.modelVersionService.getById(modelEstimate.getModelVersionId()); ModelVersion modelVersion = this.modelVersionService.getById(modelEstimate.getModelVersionId());
String url = this.pythonConfig.getModelEstimateFileBaseDir() + File.separator + modelVersion.getModelUrl() + File.separator + "evl_" + taskId + File.separator + "all_results.json"; String url = this.pythonConfig.getModelEstimateFileBaseDir() + modelVersion.getVersionName() + File.separator + "evl_" + taskId + File.separator + "all_results.json";
File file = new File(url); // 指定文件路径 File file = new File(url); // 指定文件路径
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
return ResponseResult.success(objectMapper.readTree(file).toString()); return ResponseResult.success(objectMapper.readTree(file).toString());
...@@ -194,7 +194,7 @@ public class ModelEstimateController { ...@@ -194,7 +194,7 @@ public class ModelEstimateController {
public ResponseResult<String> getStatusDetail(@RequestParam Long taskId) throws IOException { public ResponseResult<String> getStatusDetail(@RequestParam Long taskId) throws IOException {
ModelEstimate modelEstimate = this.modelEstimateService.getById(taskId); ModelEstimate modelEstimate = this.modelEstimateService.getById(taskId);
ModelVersion modelVersion = this.modelVersionService.getById(modelEstimate.getModelVersionId()); ModelVersion modelVersion = this.modelVersionService.getById(modelEstimate.getModelVersionId());
String url = this.pythonConfig.getModelEstimateFileBaseDir() + File.separator + modelVersion.getModelUrl() + File.separator + "evl_" + taskId + File.separator + "generated_predictions.jsonl"; String url = this.pythonConfig.getModelEstimateFileBaseDir() + modelVersion.getVersionName() + File.separator + "evl_" + taskId + File.separator +"generated_predictions.jsonl";
File file = new File(url); // 指定文件路径 File file = new File(url); // 指定文件路径
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
return ResponseResult.success(objectMapper.readTree(file).toString()); return ResponseResult.success(objectMapper.readTree(file).toString());
...@@ -229,6 +229,35 @@ public class ModelEstimateController { ...@@ -229,6 +229,35 @@ public class ModelEstimateController {
return ResponseResult.success(modelEstimate.getTaskId()); return ResponseResult.success(modelEstimate.getTaskId());
} }
/**
* 修改模型评估数据,及其关联的从表数据。
*
* @param modelEstimateDto 修改后的对象。
* @return 应答结果对象,包含新增对象主键Id。
*/
@ApiOperationSupport(ignoreParameters = {"modelEstimateDto.taskId", "modelEstimateDto.searchString"})
@OperationLog(type = SysOperationLogType.UPDATE)
@PostMapping("/updateById")
public ResponseResult<Void> updateById(
@MyRequestBody ModelEstimateDto modelEstimateDto) {
String errorMessage = MyCommonUtil.getModelValidationError(modelEstimateDto, true);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
ModelEstimate modelEstimate = MyModelUtil.copyTo(modelEstimateDto, ModelEstimate.class);
ModelEstimate originalModelEstimate = modelEstimateService.getById(modelEstimate.getTaskId());
if (originalModelEstimate == null) {
// NOTE: 修改下面方括号中的话述
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
}
originalModelEstimate.setTaskStatus(modelEstimate.getTaskStatus());
if (!modelEstimateService.updateById(originalModelEstimate)) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
}
return ResponseResult.success();
}
/** /**
* 删除模型评估数据。 * 删除模型评估数据。
* *
......
...@@ -125,12 +125,11 @@ public class TuningRunController { ...@@ -125,12 +125,11 @@ public class TuningRunController {
} }
TuningRun tuningRun = MyModelUtil.copyTo(tuningRunDto, TuningRun.class); TuningRun tuningRun = MyModelUtil.copyTo(tuningRunDto, TuningRun.class);
TuningRun originalTuningRun = tuningRunService.getById(tuningRun.getRunId()); TuningRun originalTuningRun = tuningRunService.getById(tuningRun.getRunId());
originalTuningRun.setRunStatus(tuningRun.getRunStatus());
if (originalTuningRun == null) { if (originalTuningRun == null) {
// NOTE: 修改下面方括号中的话述
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!"; errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
} }
originalTuningRun.setRunStatus(tuningRun.getRunStatus());
if (!tuningRunService.updateById(originalTuningRun)) { if (!tuningRunService.updateById(originalTuningRun)) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment