|
@@ -14,7 +14,6 @@ import com.css.simulation.resource.scheduler.pojo.po.TaskIndexPO;
|
|
import com.css.simulation.resource.scheduler.pojo.po.TaskPO;
|
|
import com.css.simulation.resource.scheduler.pojo.po.TaskPO;
|
|
import com.css.simulation.resource.scheduler.pojo.to.ScoreTO;
|
|
import com.css.simulation.resource.scheduler.pojo.to.ScoreTO;
|
|
import com.css.simulation.resource.scheduler.util.MinioUtil;
|
|
import com.css.simulation.resource.scheduler.util.MinioUtil;
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import io.minio.MinioClient;
|
|
import io.minio.MinioClient;
|
|
@@ -234,6 +233,7 @@ public class TaskService {
|
|
// String command = "python3 " + pyPath + " " + runResultLinux + " " + task2.getSceneType(); // 默认使用场景名称找打分脚本
|
|
// String command = "python3 " + pyPath + " " + runResultLinux + " " + task2.getSceneType(); // 默认使用场景名称找打分脚本
|
|
String scoreCommand = "python3 " + pyPath + "main.py " + runResultLinux + " " + task2.getSceneType() + " " + ruleName; // 指定打分脚本
|
|
String scoreCommand = "python3 " + pyPath + "main.py " + runResultLinux + " " + task2.getSceneType() + " " + ruleName; // 指定打分脚本
|
|
String scoreResult;
|
|
String scoreResult;
|
|
|
|
+ ScoreTO score;
|
|
try {
|
|
try {
|
|
try {
|
|
try {
|
|
log.info("TaskService--state 下载 minio 上的结果文件 " + runResultMinio + " 到本地:" + runResultLinux);
|
|
log.info("TaskService--state 下载 minio 上的结果文件 " + runResultMinio + " 到本地:" + runResultLinux);
|
|
@@ -246,6 +246,8 @@ public class TaskService {
|
|
// scoreResult = SshUtil.execute(sessionScore, command);
|
|
// scoreResult = SshUtil.execute(sessionScore, command);
|
|
scoreResult = SshUtil.execute(session, scoreCommand);
|
|
scoreResult = SshUtil.execute(session, scoreCommand);
|
|
log.info("TaskService--state 项目" + projectId + "的任务" + task2Id + "打分结束,结果为:" + scoreResult);
|
|
log.info("TaskService--state 项目" + projectId + "的任务" + task2Id + "打分结束,结果为:" + scoreResult);
|
|
|
|
+ String replace = StringUtil.replace(scoreResult, "'", "\"");
|
|
|
|
+ score = JsonUtil.jsonToBean(replace, ScoreTO.class);
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
throw new RuntimeException("------- TaskService--state 项目" + projectId + "的任务" + task2Id + " 打分出错,命令为:" + scoreCommand + " 修改状态为:" + DictConstants.TASK_ABORTED + "\n" + e.getMessage());
|
|
throw new RuntimeException("------- TaskService--state 项目" + projectId + "的任务" + task2Id + " 打分出错,命令为:" + scoreCommand + " 修改状态为:" + DictConstants.TASK_ABORTED + "\n" + e.getMessage());
|
|
}
|
|
}
|
|
@@ -254,13 +256,6 @@ public class TaskService {
|
|
taskMapper.updateFailStateWithStopTime(task2Id, DictConstants.TASK_ABORTED, TimeUtil.getNowForMysql(), DictConstants.TASK_ERROR_REASON_5);
|
|
taskMapper.updateFailStateWithStopTime(task2Id, DictConstants.TASK_ABORTED, TimeUtil.getNowForMysql(), DictConstants.TASK_ERROR_REASON_5);
|
|
throw new RuntimeException(e.getMessage());
|
|
throw new RuntimeException(e.getMessage());
|
|
}
|
|
}
|
|
- ScoreTO score = null;
|
|
|
|
- try {
|
|
|
|
- String replace = StringUtil.replace(scoreResult, "'", "\"");
|
|
|
|
- score = JsonUtil.jsonToBean(replace, ScoreTO.class);
|
|
|
|
- } catch (JsonProcessingException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
assert score != null;
|
|
assert score != null;
|
|
task2.setReturnSceneId(score.getUnit_scene_ID());
|
|
task2.setReturnSceneId(score.getUnit_scene_ID());
|
|
// task2.setScore(new Random().nextInt(10) * 10.0);
|
|
// task2.setScore(new Random().nextInt(10) * 10.0);
|