|
@@ -18,11 +18,13 @@ import com.css.simulation.resource.scheduler.pojo.po.TaskPO;
|
|
|
import com.css.simulation.resource.scheduler.pojo.to.ScoreTO;
|
|
|
import feign.Response;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.io.IOUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.io.BufferedInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.util.*;
|
|
@@ -90,8 +92,11 @@ public class TaskService {
|
|
|
// -------------------------------- 查询叶子指标 --------------------------------
|
|
|
List<IndexTemplatePO> leafIndexTemplateList = indexTemplateMapper.selectLeafIndexWithRuleDetailsByPackageId(scenePackageId);
|
|
|
List<TaskIndexPO> leafTaskIndexList = new ArrayList<>();
|
|
|
- for (IndexTemplatePO indexTemplatePO : leafIndexTemplateList) {
|
|
|
-// String ruleDetails = indexTemplatePO.getRuleDetails(); // 打分脚本路径
|
|
|
+ for (int i = 0; i < leafTaskIndexList.size(); i++) {
|
|
|
+ // -------------------------------- 将叶子节点对应的打分规则保存到临时目录 --------------------------------
|
|
|
+ String ruleDetails = indexTemplatePO.getRuleDetails(); // 打分脚本内容
|
|
|
+ String ruleDetailsPath = linuxTempPath + "rule-script/" + projectId + "_1";
|
|
|
+ FileUtil.writeInputStreamToLocalFile(IoUtil.stringToInputStream(ruleDetails), ruleDetailsPath);
|
|
|
// -------------------------------- 查询每个叶子指标包括的场景 --------------------------------
|
|
|
Set<String> sceneIdSet = new HashSet<>();
|
|
|
String naturalIds = indexTemplatePO.getSceneNaturalIds();
|
|
@@ -118,8 +123,8 @@ public class TaskService {
|
|
|
ScoreTO score;
|
|
|
String runResultMinio = task2.getRunResult();
|
|
|
String runResultLinux = linuxTempPath + runResultMinio;
|
|
|
- String command = "python3 " + pyPath + " " + runResultLinux + " " + task2.getSceneType(); // 默认使用场景名称找打分脚本
|
|
|
-// String command = "python3 " + pyPath + " " + runResultLinux + " " + task2.getSceneType() + " " + ruleDetails; // 指定打分脚本
|
|
|
+// String command = "python3 " + pyPath + " " + runResultLinux + " " + task2.getSceneType(); // 默认使用场景名称找打分脚本
|
|
|
+ String command = "python3 " + pyPath + " " + runResultLinux + " " + task2.getSceneType() + " " + ruleDetailsPath; // 指定打分脚本
|
|
|
try {
|
|
|
Response download = commonService.download(MinioParameter.builder().objectName(runResultMinio).build());
|
|
|
Response.Body body = download.body();
|