martin 3 年之前
父節點
當前提交
2d9d3a2389

+ 3 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/service/TaskService.java

@@ -21,6 +21,7 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.client.config.RequestConfig;
 import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.sshd.client.session.ClientSession;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.StringRedisTemplate;
@@ -161,7 +162,8 @@ public class TaskService {
                             log.info("------- /state 下载 minio 上的结果文件 " + runResultMinio + " 到本地:" + runResultLinux);
                             MinioUtil.downloadToFile(minioClient, bucketName, runResultMinio, runResultLinux);
                             log.info("------- /state 开始执行打分命令:" + command);
-                            score = JsonUtil.jsonToBean(SshUtil.execute(hostname, username, password, command), ScoreTO.class);
+                            ClientSession session = SshUtil.getSession(hostname, username, password);
+                            score = JsonUtil.jsonToBean(SshUtil.execute(session, command), ScoreTO.class);
                             log.info("------- /state 打分结束,结果为:" + score);
                         } catch (Exception e) {
                             log.error("------- /state 任务 " + task2Id + " 打分出错,命令为:" + command + " 修改状态为:" + DictConstants.TASK_ABORTED);