Explorar o código

No master don't create command #2571 (#2602)

* dispatch task fail will set task status failed

* 1,no worker condition , master will while ture wait for worker startup
2,worker response task status sync wait for result

* 1,no worker condition , master will while ture wait for worker startup
2,worker response task status sync wait for result

* 1,no worker condition , master will while ture wait for worker startup
2,worker response task status sync wait for result

* 1,no worker condition , master will while ture wait for worker startup
2,worker response task status sync wait for result

* 1,no worker condition , master will while ture wait for worker startup
2,worker response task status sync wait for result

* 1,no worker condition , master will while ture wait for worker startup
2,worker response task status sync wait for result

* 1,no worker condition , master will while ture wait for worker startup
2,worker response task status sync wait for result

* 1,no worker condition , master will while ture wait for worker startup
2,worker response task status sync wait for result

* 1,no worker condition , master will while ture wait for worker startup
2,worker response task status sync wait for result

* 1,no worker condition , master will while ture wait for worker startup
2,worker response task status sync wait for result

* 1,no worker condition , master will while ture wait for worker startup
2,worker response task status sync wait for result

* 1,task status statistics and process status statistics bug fix (#2357)
2,worker group bug fix

* 1,task status statistics and process status statistics bug fix (#2357)
2,worker group bug fix

* 1,task status statistics and process status statistics bug fix (#2357)
2,worker group bug fix

* 1,task status statistics and process status statistics bug fix (#2357)
2,worker group bug fix

* send mail error, #2466 bug fix

* send mail error, #2466 bug fix

* send mail error, #2466 bug fix

* send mail error, #2466 bug fix

* #2486 bug fix

* host and workergroup compatible

* EnterpriseWeChatUtils modify

* EnterpriseWeChatUtils modify

* EnterpriseWeChatUtils modify

* #2499 bug fix

* add comment

* revert comment

* revert comment

* #2499 buf fix

* #2499 bug fix

* #2499 bug fix

* #2499 bug fix

* #2499 bug fix

* #2499 bug fix

* #2499 bug fix

* no valid worker group,master can kill task directly

* no valid worker group,master can kill task directly

* no valid worker group,master can kill task directly

* no valid worker group,master can kill task directly

* no valid worker group,master can kill task directly

* no valid worker group,master can kill task directly

* no valid worker group,master can kill task directly

* no valid worker group,master can kill task directly

* no valid worker group,master can kill task directly

* No master don't create command #2571

* No master don't create command #2571

* No master don't create command #2571

Co-authored-by: qiaozhanwei <qiaozhanwei@analysys.com.cn>
qiaozhanwei %!s(int64=5) %!d(string=hai) anos
pai
achega
21bd3c1488

+ 26 - 6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java

@@ -124,14 +124,12 @@ public class ExecutorService extends BaseService{
             return result;
         }
 
-        // check master server exists
-        List<Server> masterServers = monitorService.getServerListFromZK(true);
-
-
-        if (masterServers.size() == 0) {
-            putMsg(result, Status.MASTER_NOT_EXISTS);
+        // check master exists
+        if (!checkMasterExists(result)) {
             return result;
         }
+
+
         /**
          * create command
          */
@@ -152,6 +150,22 @@ public class ExecutorService extends BaseService{
         return result;
     }
 
+    /**
+     * check whether master exists
+     * @param result result
+     * @return master exists return true , otherwise return false
+     */
+    private boolean checkMasterExists(Map<String, Object> result) {
+        // check master server exists
+        List<Server> masterServers = monitorService.getServerListFromZK(true);
+
+        // no master
+        if (masterServers.size() == 0) {
+            putMsg(result, Status.MASTER_NOT_EXISTS);
+            return false;
+        }
+        return true;
+    }
 
 
     /**
@@ -195,6 +209,12 @@ public class ExecutorService extends BaseService{
             return checkResult;
         }
 
+        // check master exists
+        if (!checkMasterExists(result)) {
+            return result;
+        }
+
+
         ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId);
         if (processInstance == null) {
             putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId);