[agent][executor]- bug - 13

This commit is contained in:
zeaslity
2023-02-26 15:48:50 +08:00
parent 87b0239d58
commit 540ade5c93

View File

@@ -122,15 +122,8 @@ public class CommandExecutor {
octopusMessage octopusMessage
)); ));
// 缓存 命令处理日志
// 如果是特别简单的命令,必须要放在此处才可以,否则会导致 无法收集
commandExecLogCache.cacheLog(
streamKey,
process
);
// 等待1秒钟, 使得有时间进行后端任务的完成 // 等待1秒钟, 使得有时间进行后端任务的完成
//TimeUnit.SECONDS.sleep(1); TimeUnit.SECONDS.sleep(1);
// get the command result must also be a timeout smaller than the process // get the command result must also be a timeout smaller than the process
// 此处会把主线程卡死, forever终结 // 此处会把主线程卡死, forever终结
@@ -139,15 +132,6 @@ public class CommandExecutor {
// 命令执行完成, countDownLatch计数 // 命令执行完成, countDownLatch计数
countDownLatch.countDown(); countDownLatch.countDown();
// 打印一下 debug
commandExecLogCache.PrintCommandCachedLog(streamKey);
// 关停任务执行的缓存日志收集 BufferedReader 否则无法终止
commandExecLogCache.StopExecLogBufferedReader(
streamKey,
process
);
log.debug( log.debug(
"current shell command {} result is {}", "current shell command {} result is {}",
processBuilder.command(), processBuilder.command(),
@@ -191,6 +175,13 @@ public class CommandExecutor {
System.out.println("process isAlive = " + process.isAlive()); System.out.println("process isAlive = " + process.isAlive());
// 缓存 命令处理日志
// 如果是特别简单的命令,必须要放在此处才可以,否则会导致 无法收集
commandExecLogCache.cacheLog(
streamKey,
process
);
// 任务提前执行结束,或者超过了最长等待时间 // 任务提前执行结束,或者超过了最长等待时间
// 判断命令是否正确处理完成 // 判断命令是否正确处理完成
if (!commandExecComplete) { if (!commandExecComplete) {
@@ -219,6 +210,12 @@ public class CommandExecutor {
// 打印一下 debug // 打印一下 debug
commandExecLogCache.PrintCommandCachedLog(streamKey); commandExecLogCache.PrintCommandCachedLog(streamKey);
// 关停任务执行的缓存日志收集 BufferedReader 否则无法终止
commandExecLogCache.StopExecLogBufferedReader(
streamKey,
process
);
// 异步执行日志的发送工作 // 异步执行日志的发送工作
//commandExecLogCache.CollectAndSendExecLog(streamKey, needResultReplay, octopusMessage); //commandExecLogCache.CollectAndSendExecLog(streamKey, needResultReplay, octopusMessage);