[AGENT][Executor] 修复机器重启的Bug
This commit is contained in:
@@ -40,7 +40,8 @@ public class ExecutionController {
|
||||
@RequestParam(value = "commandList", required = false) @Nullable List<String> commandList,
|
||||
@RequestParam(value = "completeCommandList", required = false)
|
||||
@ApiParam(name = "completeCommandList", value = "完整命令行,优先,可为空") @Nullable List<List<String>> completeCommandList,
|
||||
@RequestParam(value = "type", required = false) @Nullable String type
|
||||
@RequestParam(value = "type", required = false) @Nullable String type,
|
||||
@ApiParam(name = "isDurationTask", value = "是否是持久化任务") @RequestParam(value = "isDurationTask", defaultValue = "false", required = false) boolean isDurationTask
|
||||
) {
|
||||
|
||||
String streamKey = asyncExecutionService
|
||||
@@ -51,7 +52,7 @@ public class ExecutionController {
|
||||
completeCommandList,
|
||||
false,
|
||||
null,
|
||||
false
|
||||
isDurationTask
|
||||
);
|
||||
|
||||
return R.ok(streamKey);
|
||||
@@ -66,14 +67,16 @@ public class ExecutionController {
|
||||
@ApiParam(name = "commandList", value = "命令行") @Nullable List<String> commandList,
|
||||
@RequestParam(value = "completeCommandList", required = false)
|
||||
@ApiParam(name = "completeCommandList", value = "完整命令行,优先,可为空") @Nullable List<List<String>> completeCommandList,
|
||||
@RequestParam(value = "type", required = false) @Nullable String type
|
||||
@RequestParam(value = "type", required = false) @Nullable String type,
|
||||
@ApiParam(name = "isDurationTask", value = "是否是持久化任务") @RequestParam(value = "isDurationTask", defaultValue = "false", required = false) boolean isDurationTask
|
||||
) {
|
||||
|
||||
return R.ok(asyncExecutionService.SendCommandToAgentComplete(
|
||||
topicNameList,
|
||||
type,
|
||||
commandList,
|
||||
completeCommandList
|
||||
completeCommandList,
|
||||
isDurationTask
|
||||
));
|
||||
}
|
||||
|
||||
@@ -85,14 +88,16 @@ public class ExecutionController {
|
||||
@ApiParam(name = "commandList", value = "命令行") @Nullable List<String> commandList,
|
||||
@RequestParam(value = "completeCommandList", required = false)
|
||||
@ApiParam(name = "completeCommandList", value = "完整命令行,优先,可为空") @Nullable List<List<String>> completeCommandList,
|
||||
@RequestParam(value = "type", required = false) @Nullable String type
|
||||
@RequestParam(value = "type", required = false) @Nullable String type,
|
||||
@ApiParam(name = "isDurationTask", value = "是否是持久化任务") @RequestParam(value = "isDurationTask", defaultValue = "false", required = false) boolean isDurationTask
|
||||
) {
|
||||
|
||||
return R.ok(asyncExecutionService.SendCommandToAgentComplete(
|
||||
ALL_AGENT_TOPIC_NAME_LIST,
|
||||
type,
|
||||
commandList,
|
||||
completeCommandList
|
||||
completeCommandList,
|
||||
isDurationTask
|
||||
));
|
||||
}
|
||||
|
||||
@@ -103,14 +108,16 @@ public class ExecutionController {
|
||||
@ApiParam(name = "commandList", value = "命令行") @Nullable List<String> commandList,
|
||||
@RequestParam(value = "completeCommandList", required = false)
|
||||
@ApiParam(name = "completeCommandList", value = "完整命令行,优先,可为空") @Nullable List<List<String>> completeCommandList,
|
||||
@RequestParam(value = "type", required = false) @Nullable String type
|
||||
@RequestParam(value = "type", required = false) @Nullable String type,
|
||||
@ApiParam(name = "isDurationTask", value = "是否是持久化任务") @RequestParam(value = "isDurationTask", defaultValue = "false", required = false) boolean isDurationTask
|
||||
) {
|
||||
|
||||
return R.ok(asyncExecutionService.SendCommandToAgentComplete(
|
||||
ALL_HEALTHY_AGENT_TOPIC_NAME_LIST,
|
||||
type,
|
||||
commandList,
|
||||
completeCommandList
|
||||
completeCommandList,
|
||||
isDurationTask
|
||||
));
|
||||
}
|
||||
|
||||
@@ -144,7 +151,8 @@ public class ExecutionController {
|
||||
@ApiParam(name = "commandList", value = "命令行") @Nullable List<String> commandList,
|
||||
@RequestParam(value = "completeCommandList", required = false)
|
||||
@ApiParam(name = "completeCommandList", value = "完整命令行,优先,可为空") @Nullable List<List<String>> completeCommandList,
|
||||
@RequestParam(value = "type", required = false) @ApiParam(name = "type", value = "执行命令类型") @Nullable String type
|
||||
@RequestParam(value = "type", required = false) @ApiParam(name = "type", value = "执行命令类型") @Nullable String type,
|
||||
@ApiParam(name = "isDurationTask", value = "是否是持久化任务") @RequestParam(value = "isDurationTask", defaultValue = "false", required = false) boolean isDurationTask
|
||||
) {
|
||||
|
||||
return R.ok(
|
||||
@@ -152,7 +160,8 @@ public class ExecutionController {
|
||||
topicNameList,
|
||||
type,
|
||||
commandList,
|
||||
completeCommandList
|
||||
completeCommandList,
|
||||
isDurationTask
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -164,7 +173,8 @@ public class ExecutionController {
|
||||
@ApiParam(name = "commandList", value = "命令行") @Nullable List<String> commandList,
|
||||
@RequestParam(value = "completeCommandList", required = false)
|
||||
@ApiParam(name = "completeCommandList", value = "完整命令行,优先,可为空") @Nullable List<List<String>> completeCommandList,
|
||||
@RequestParam(value = "type", required = false) @ApiParam(name = "type", value = "执行命令类型") @Nullable String type
|
||||
@RequestParam(value = "type", required = false) @ApiParam(name = "type", value = "执行命令类型") @Nullable String type,
|
||||
@ApiParam(name = "isDurationTask", value = "是否是持久化任务") @RequestParam(value = "isDurationTask", defaultValue = "false", required = false) boolean isDurationTask
|
||||
) {
|
||||
|
||||
return R.ok(
|
||||
@@ -172,7 +182,8 @@ public class ExecutionController {
|
||||
ALL_AGENT_TOPIC_NAME_LIST,
|
||||
type,
|
||||
commandList,
|
||||
completeCommandList
|
||||
completeCommandList,
|
||||
isDurationTask
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -207,7 +218,10 @@ public class ExecutionController {
|
||||
.SendCommandToAgent(
|
||||
topicNameList,
|
||||
"AgentUpdate",
|
||||
null
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
true
|
||||
));
|
||||
}
|
||||
|
||||
@@ -223,7 +237,10 @@ public class ExecutionController {
|
||||
.SendCommandToAgent(
|
||||
topicNameList,
|
||||
"AgentReboot",
|
||||
null
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
true
|
||||
));
|
||||
}
|
||||
|
||||
@@ -239,7 +256,10 @@ public class ExecutionController {
|
||||
.SendCommandToAgent(
|
||||
topicNameList,
|
||||
"AgentShutdown",
|
||||
null
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
true
|
||||
));
|
||||
}
|
||||
|
||||
@@ -255,7 +275,10 @@ public class ExecutionController {
|
||||
.SendCommandToAgent(
|
||||
topicNameList,
|
||||
"AgentBootUp",
|
||||
null
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
true
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public interface AsyncExecutionService {
|
||||
|
||||
String SendCommandToAgent(String agentTopicName, String type, List<String> commandList);
|
||||
|
||||
List<String> SendCommandToAgent(List<String> agentTopicNameList, String type, List<String> command);
|
||||
List<String> SendCommandToAgent(List<String> agentTopicNameList, String type, List<String> commandList, boolean needResultReplay, String futureKey, boolean durationTask);
|
||||
|
||||
/**
|
||||
* 调用 单行命令脚本的 最底层函数
|
||||
@@ -43,19 +43,12 @@ public interface AsyncExecutionService {
|
||||
|
||||
String SendCommandToAgentComplete(String agentTopicName, String type, List<String> commandList, List<List<String>> commandListComplete);
|
||||
|
||||
List<String> SendCommandToAgentComplete(List<String> agentTopicNameList, String type, List<String> commandList, List<List<String>> commandListComplete);
|
||||
|
||||
/**
|
||||
* 通常为 页面定时脚本任务调用
|
||||
*
|
||||
* @param agentTopicNameList 目标Agent的TopicName列表
|
||||
* @param type 任务类型
|
||||
* @param completeCommandList 完整的类型
|
||||
* @return 每个Agent只返回一个 ResultKey(Script脚本的结果全部拼接到一起),全部的resultKey
|
||||
*/
|
||||
List<String> SendCommandToAgentComplete(List<String> agentTopicNameList, String type, List<String> commandList, List<List<String>> commandListComplete, boolean isDurationTask);
|
||||
|
||||
|
||||
List<String> SendCommandToAgentComplete(List<String> agentTopicNameList, String type, List<List<String>> completeCommandList);
|
||||
|
||||
|
||||
/**
|
||||
* 通常为 页面定时脚本任务调用
|
||||
*
|
||||
|
||||
@@ -93,7 +93,7 @@ public class AsyncExecutionServiceImpl implements AsyncExecutionService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> SendCommandToAgentComplete(List<String> agentTopicNameList, String type, List<String> commandList, List<List<String>> commandListComplete) {
|
||||
public List<String> SendCommandToAgentComplete(List<String> agentTopicNameList, String type, List<String> commandList, List<List<String>> commandListComplete, boolean isDurationTask) {
|
||||
return agentTopicNameList
|
||||
.stream()
|
||||
.map(
|
||||
@@ -104,7 +104,7 @@ public class AsyncExecutionServiceImpl implements AsyncExecutionService {
|
||||
commandListComplete,
|
||||
false,
|
||||
null,
|
||||
false
|
||||
isDurationTask
|
||||
)
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
@@ -257,7 +257,7 @@ public class AsyncExecutionServiceImpl implements AsyncExecutionService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> SendCommandToAgent(List<String> agentagentTopicNameList, String type, List<String> command) {
|
||||
public List<String> SendCommandToAgent(List<String> agentagentTopicNameList, String type, List<String> commandList, boolean needResultReplay, String futureKey, boolean durationTask) {
|
||||
|
||||
return agentagentTopicNameList
|
||||
.stream()
|
||||
@@ -267,7 +267,11 @@ public class AsyncExecutionServiceImpl implements AsyncExecutionService {
|
||||
(
|
||||
agentTopicName,
|
||||
type,
|
||||
command
|
||||
commandList,
|
||||
null,
|
||||
needResultReplay,
|
||||
futureKey,
|
||||
durationTask
|
||||
)
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -46,7 +46,7 @@ public interface SyncExecutionService {
|
||||
|
||||
ArrayList<String> SyncSendCommandToAgent(String agentTopicName, String type, List<String> commandList, List<List<String>> completeCommandList);
|
||||
|
||||
List<ArrayList<String>> SyncSendCommandToAgentComplete(List<String> agentTopicNameList, String type, List<String> commandList, List<List<String>> completeCommandList);
|
||||
List<ArrayList<String>> SyncSendCommandToAgentComplete(List<String> agentTopicNameList, String type, List<String> commandList, List<List<String>> completeCommandList, boolean isDurationTask);
|
||||
|
||||
/**
|
||||
* 通常为 页面定时脚本任务调用
|
||||
|
||||
@@ -109,7 +109,7 @@ public class SyncExecutionServiceImpl implements SyncExecutionService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArrayList<String>> SyncSendCommandToAgentComplete(List<String> agentTopicNameList, String type, List<String> commandList, List<List<String>> completeCommandList) {
|
||||
public List<ArrayList<String>> SyncSendCommandToAgentComplete(List<String> agentTopicNameList, String type, List<String> commandList, List<List<String>> completeCommandList, boolean isDurationTask) {
|
||||
return agentTopicNameList
|
||||
.stream()
|
||||
.map(
|
||||
@@ -120,7 +120,7 @@ public class SyncExecutionServiceImpl implements SyncExecutionService {
|
||||
completeCommandList,
|
||||
COMMAND_EXEC_NEED_REPLAY,
|
||||
null,
|
||||
false
|
||||
isDurationTask
|
||||
)
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Reference in New Issue
Block a user