aloyszhang commented on code in PR #9912:
URL: https://github.com/apache/inlong/pull/9912#discussion_r1546256487


##########
inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java:
##########
@@ -213,6 +214,44 @@ private void 
dealWithConfigQueue(BlockingQueue<ConfigResult> queue) {
         }
     }
 
+    private void checkModules() {
+        LOGGER.info("check modules start");
+        currentModules.values().forEach((module) -> {
+            LOGGER.info("check module current state {} {}", module.getName(), 
module.getState());
+            switch (module.getState()) {
+                case NEW:
+                    if (downloadModule(module)) {
+                        saveModuleState(module.getId(), 
ModuleStateEnum.DOWNLOADED);
+                    } else {
+                        LOGGER.error("download module {} failed, keep state in 
new", module.getName());
+                    }
+                    break;
+                case DOWNLOADED:
+                    if (isPackageDownloaded(module)) {
+                        installModule(module);
+                        saveModuleState(module.getId(), 
ModuleStateEnum.INSTALLED);
+                    } else {
+                        LOGGER.info("check module {} package failed, change 
stated to new, will download package again",
+                                module.getName());
+                        saveModuleState(module.getId(), ModuleStateEnum.NEW);
+                    }
+                    break;
+                case INSTALLED:
+                    if (!isProcessAllStarted(module)) {
+                        LOGGER.info("module {} process not all started try to 
start", module.getName());
+                        if (!startModule(module)) {
+                            LOGGER.info("start module {} failed, change state 
to downloaded", module.getState());
+                            saveModuleState(module.getId(), 
ModuleStateEnum.DOWNLOADED);
+                        }
+                    }
+                    break;

Review Comment:
   It is necessary to have at least three CORE_THREAD_SLEEP_TIME intervals 
before all processes of the module start. Is this acceptable?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to