|
@@ -62,8 +62,6 @@ public class TaskService {
|
|
|
String pyPath;
|
|
|
@Value("${scheduler.linux-temp-path}")
|
|
|
String linuxTempPath;
|
|
|
- @Autowired
|
|
|
- ProjectMapper projectMapper;
|
|
|
|
|
|
public void taskTick(String taskId) {
|
|
|
log.info("------- /tick 接收到任务 " + taskId + "的心跳!");
|
|
@@ -74,9 +72,15 @@ public class TaskService {
|
|
|
}
|
|
|
|
|
|
@SneakyThrows
|
|
|
- public void taskState(String taskId, String state) {
|
|
|
+ public void taskState(String taskId, String state, String podName) {
|
|
|
log.info("------- /state 修改任务 " + taskId + "的状态:" + state);
|
|
|
taskMapper.updateState(taskId, state);
|
|
|
+ if ("Aborted".equals(state)
|
|
|
+ || "PendingAnalysis".equals(state)
|
|
|
+ || "Terminated".equals(state)
|
|
|
+ ) {
|
|
|
+ LinuxUtil.execute("kubectl delete pod " + podName);
|
|
|
+ }
|
|
|
ProjectPO projectPO = projectMapper.selectById(taskId);
|
|
|
String projectId = projectPO.getId();
|
|
|
String scenePackageId = projectPO.getScenePackageId(); // 场景测试包 id,指标根 id
|
|
@@ -206,13 +210,6 @@ public class TaskService {
|
|
|
return DictConstants.TASK_PENDING.equals(state);
|
|
|
}
|
|
|
|
|
|
- @SneakyThrows
|
|
|
- public Boolean taskShutdown(String taskId, String podName) {
|
|
|
- // 查询 task 如果不是 pending 则不执行
|
|
|
- LinuxUtil.execute("kubectl delete pod " + podName);
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
public double compute(List<IndexTemplatePO> leaf) {
|
|
|
double result = 0.0;
|