This is an automated email from the ASF dual-hosted git repository.
aloyszhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new 8ec51cb2fe [INLONG-11389][Manager] Installation log display operation
time (#11390)
8ec51cb2fe is described below
commit 8ec51cb2fe8c98024d0b5dc80f72cdd2ceacdd0d
Author: fuweng11 <[email protected]>
AuthorDate: Wed Oct 23 09:32:15 2024 +0800
[INLONG-11389][Manager] Installation log display operation time (#11390)
---
.../node/AgentClusterNodeInstallOperator.java | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/node/AgentClusterNodeInstallOperator.java
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/node/AgentClusterNodeInstallOperator.java
index abf8a895cd..26dffa8bd4 100644
---
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/node/AgentClusterNodeInstallOperator.java
+++
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/node/AgentClusterNodeInstallOperator.java
@@ -17,6 +17,7 @@
package org.apache.inlong.manager.service.cluster.node;
+import org.apache.inlong.manager.common.consts.InlongConstants;
import org.apache.inlong.manager.common.enums.ClusterType;
import org.apache.inlong.manager.common.enums.ModuleType;
import org.apache.inlong.manager.common.enums.NodeStatus;
@@ -47,6 +48,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@@ -96,18 +99,21 @@ public class AgentClusterNodeInstallOperator implements
InlongClusterNodeInstall
@Override
public boolean install(ClusterNodeRequest clusterNodeRequest, String
operator) {
LOGGER.info("begin to insert agent cluster node={}",
clusterNodeRequest);
+ Date now = new Date();
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss");
+ String currentTime = dateFormat.format(now);
try {
clusterNodeEntityMapper.updateOperateLogById(clusterNodeRequest.getId(),
NodeStatus.INSTALLING.getStatus(),
- "begin to install");
+ currentTime + InlongConstants.BLANK + "begin to install");
AgentClusterNodeRequest request = (AgentClusterNodeRequest)
clusterNodeRequest;
deployInstaller(request, operator);
String startCmd = agentInstallPath + INSTALLER_START_CMD;
commandExecutor.execRemote(request, startCmd);
clusterNodeEntityMapper.updateOperateLogById(clusterNodeRequest.getId(),
- NodeStatus.INSTALL_SUCCESS.getStatus(), "success to
install");
+ NodeStatus.INSTALL_SUCCESS.getStatus(), currentTime +
InlongConstants.BLANK + "success to install");
} catch (Exception e) {
clusterNodeEntityMapper.updateOperateLogById(clusterNodeRequest.getId(),
- NodeStatus.INSTALL_FAILED.getStatus(), e.getMessage());
+ NodeStatus.INSTALL_FAILED.getStatus(), currentTime +
InlongConstants.BLANK + e.getMessage());
String errMsg = String.format("install agent cluster node failed
for ip=%s", clusterNodeRequest.getIp());
LOGGER.error(errMsg, e);
throw new BusinessException(errMsg);
@@ -119,19 +125,22 @@ public class AgentClusterNodeInstallOperator implements
InlongClusterNodeInstall
@Override
public boolean reInstall(ClusterNodeRequest clusterNodeRequest, String
operator) {
LOGGER.info("begin to reInstall agent cluster node={}",
clusterNodeRequest);
+ Date now = new Date();
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss");
+ String currentTime = dateFormat.format(now);
try {
clusterNodeEntityMapper.updateOperateLogById(clusterNodeRequest.getId(),
NodeStatus.INSTALLING.getStatus(),
- "begin to reinstall");
+ currentTime + InlongConstants.BLANK + "begin to
reinstall");
AgentClusterNodeRequest request = (AgentClusterNodeRequest)
clusterNodeRequest;
commandExecutor.rmDir(request, agentInstallPath.substring(0,
agentInstallPath.lastIndexOf(File.separator)));
deployInstaller(request, operator);
String reStartCmd = agentInstallPath + INSTALLER_RESTART_CMD;
commandExecutor.execRemote(request, reStartCmd);
clusterNodeEntityMapper.updateOperateLogById(clusterNodeRequest.getId(),
NodeStatus.NORMAL.getStatus(),
- "success to reinstall");
+ currentTime + InlongConstants.BLANK + "success to
reinstall");
} catch (Exception e) {
clusterNodeEntityMapper.updateOperateLogById(clusterNodeRequest.getId(),
- NodeStatus.INSTALL_FAILED.getStatus(), e.getMessage());
+ NodeStatus.INSTALL_FAILED.getStatus(), currentTime +
InlongConstants.BLANK + e.getMessage());
String errMsg = String.format("reInstall agent cluster node failed
for ip=%s", clusterNodeRequest.getIp());
LOGGER.error(errMsg, e);
throw new BusinessException(errMsg);