|
@@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -161,15 +162,20 @@ public class TaskService {
|
|
// String command = "python3 " + pyPath + " " + runResultLinux + " " + task2.getSceneType(); // 默认使用场景名称找打分脚本
|
|
// String command = "python3 " + pyPath + " " + runResultLinux + " " + task2.getSceneType(); // 默认使用场景名称找打分脚本
|
|
String command = "python3 " + pyPath + "main.py " + runResultLinux + " " + task2.getSceneType() + " " + ruleName; // 指定打分脚本
|
|
String command = "python3 " + pyPath + "main.py " + runResultLinux + " " + task2.getSceneType() + " " + ruleName; // 指定打分脚本
|
|
try {
|
|
try {
|
|
- log.info("------- /state 下载 minio 上的结果文件 " + runResultMinio + " 到本地:" + runResultLinux);
|
|
|
|
- MinioUtil.downloadToFile(minioClient, bucketName, runResultMinio, runResultLinux);
|
|
|
|
- log.info("------- /state 开始执行打分命令:" + command);
|
|
|
|
-
|
|
|
|
- score = JsonUtil.jsonToBean(SshUtil.execute(session, command), ScoreTO.class);
|
|
|
|
-
|
|
|
|
- log.info("------- /state 打分结束,结果为:" + score);
|
|
|
|
|
|
+ try {
|
|
|
|
+ log.info("------- /state 下载 minio 上的结果文件 " + runResultMinio + " 到本地:" + runResultLinux);
|
|
|
|
+ MinioUtil.downloadToFile(minioClient, bucketName, runResultMinio, runResultLinux);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new RuntimeException("------- /state 下载 minio 上的结果文件出错:" + e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ log.info("------- /state 开始执行打分命令:" + command);
|
|
|
|
+ score = JsonUtil.jsonToBean(SshUtil.execute(session, command), ScoreTO.class);
|
|
|
|
+ log.info("------- /state 打分结束,结果为:" + score);
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ throw new RuntimeException("------- /state 任务 " + task2Id + " 打分出错,命令为:" + command + " 修改状态为:" + DictConstants.TASK_ABORTED + "\n" + e.getMessage());
|
|
|
|
+ }
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- log.error("------- /state 任务 " + task2Id + " 打分出错,命令为:" + command + " 修改状态为:" + DictConstants.TASK_ABORTED);
|
|
|
|
taskMapper.updateState(task2Id, DictConstants.TASK_ABORTED);
|
|
taskMapper.updateState(task2Id, DictConstants.TASK_ABORTED);
|
|
throw new RuntimeException(e.getMessage());
|
|
throw new RuntimeException(e.getMessage());
|
|
}
|
|
}
|