You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "ruanwenjun (via GitHub)" <gi...@apache.org> on 2024/05/25 06:54:01 UTC

[PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

ruanwenjun opened a new pull request, #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069

   
   
   ## Purpose of the pull request
   
    Fix GlobalTaskDispatchWaitingQueueLooper might be busy when worker is unavaliable
   
   close https://github.com/apache/dolphinscheduler/issues/16065
   
   ## Brief change
   
   
   ## Verify this pull request
   
   <!--*(Please pick either of the following options)*-->
   
   This pull request is code cleanup without any test coverage.
   
   *(or)*
   
   This pull request is already covered by existing tests, such as *(please describe tests)*.
   
   (or)
   
   This change added tests and can be verified as follows:
   
   <!--*(example:)*
   - *Added dolphinscheduler-dao tests for end-to-end.*
   - *Added CronUtilsTest to verify the change.*
   - *Manually verified the change by testing locally.* -->
   
   (or)
   
   If your pull request contain incompatible change, you should also add it to `docs/docs/en/guide/upgrede/incompatible.md`
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614543317


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.java:
##########
@@ -52,4 +52,30 @@ public TaskExecutionContext getTaskExecutionContext() {
         return taskExecutionContext;
     }
 
+    @Override
+    public int compareTo(TaskExecuteRunnable other) {
+        if (other == null) {
+            return 1;
+        }
+        int workflowInstancePriorityCompareResult = workflowInstance.getProcessInstancePriority().getCode() -
+                other.getWorkflowInstance().getProcessInstancePriority().getCode();
+        if (workflowInstancePriorityCompareResult != 0) {
+            return workflowInstancePriorityCompareResult;
+        }
+
+        int taskInstancePriorityCompareResult = taskInstance.getTaskInstancePriority().getCode()
+                - other.getTaskInstance().getTaskInstancePriority().getCode();
+        if (taskInstancePriorityCompareResult != 0) {
+            return taskInstancePriorityCompareResult;
+        }
+        // larger number, higher priority
+        int taskGroupPriorityCompareResult =
+                taskInstance.getTaskGroupPriority() - other.getTaskInstance().getTaskGroupPriority();
+        if (taskGroupPriorityCompareResult != 0) {
+            return -taskGroupPriorityCompareResult;

Review Comment:
   Yes, Priority.HIGH have small number



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#issuecomment-2131150981

   ## [Codecov](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `55.40541%` with `33 lines` in your changes are missing coverage. Please review.
   > Project coverage is 40.66%. Comparing base [(`fb9172c`)](https://app.codecov.io/gh/apache/dolphinscheduler/commit/fb9172cce89df3b89b2aeab4d48c404625aa19f6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`1371fff`)](https://app.codecov.io/gh/apache/dolphinscheduler/commit/1371fffe90853961399bea2b83034fe61464f2d0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   > :exclamation: **Current head 1371fff differs from pull request most recent head 2269b21**
   > 
   > Please [upload](https://docs.codecov.com/docs/codecov-uploader) reports for the commit 2269b21 to get more accurate results.
   
   | [Files](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...heduler/server/master/runner/queue/DelayEntry.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?src=pr&el=tree&filepath=dolphinscheduler-master%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdolphinscheduler%2Fserver%2Fmaster%2Frunner%2Fqueue%2FDelayEntry.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1tYXN0ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL21hc3Rlci9ydW5uZXIvcXVldWUvRGVsYXlFbnRyeS5qYXZh) | 54.54% | [8 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...r/runner/GlobalTaskDispatchWaitingQueueLooper.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?src=pr&el=tree&filepath=dolphinscheduler-master%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdolphinscheduler%2Fserver%2Fmaster%2Frunner%2FGlobalTaskDispatchWaitingQueueLooper.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1tYXN0ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL21hc3Rlci9ydW5uZXIvR2xvYmFsVGFza0Rpc3BhdGNoV2FpdGluZ1F1ZXVlTG9vcGVyLmphdmE=) | 47.05% | [7 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [.../server/master/runner/BaseTaskExecuteRunnable.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?src=pr&el=tree&filepath=dolphinscheduler-master%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdolphinscheduler%2Fserver%2Fmaster%2Frunner%2FBaseTaskExecuteRunnable.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1tYXN0ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL21hc3Rlci9ydW5uZXIvQmFzZVRhc2tFeGVjdXRlUnVubmFibGUuamF2YQ==) | 60.00% | [3 Missing and 3 partials :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...rator/BaseTaskExecuteRunnableDispatchOperator.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?src=pr&el=tree&filepath=dolphinscheduler-master%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdolphinscheduler%2Fserver%2Fmaster%2Frunner%2Foperator%2FBaseTaskExecuteRunnableDispatchOperator.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1tYXN0ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL21hc3Rlci9ydW5uZXIvb3BlcmF0b3IvQmFzZVRhc2tFeGVjdXRlUnVubmFibGVEaXNwYXRjaE9wZXJhdG9yLmphdmE=) | 0.00% | [6 Missing :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...server/master/runner/queue/PriorityDelayQueue.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?src=pr&el=tree&filepath=dolphinscheduler-master%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdolphinscheduler%2Fserver%2Fmaster%2Frunner%2Fqueue%2FPriorityDelayQueue.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1tYXN0ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL21hc3Rlci9ydW5uZXIvcXVldWUvUHJpb3JpdHlEZWxheVF1ZXVlLmphdmE=) | 85.71% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...cheduler/plugin/task/api/TaskExecutionContext.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?src=pr&el=tree&filepath=dolphinscheduler-task-plugin%2Fdolphinscheduler-task-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdolphinscheduler%2Fplugin%2Ftask%2Fapi%2FTaskExecutionContext.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci10YXNrLXBsdWdpbi9kb2xwaGluc2NoZWR1bGVyLXRhc2stYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kb2xwaGluc2NoZWR1bGVyL3BsdWdpbi90YXNrL2FwaS9UYXNrRXhlY3V0aW9uQ29udGV4dC5qYXZh) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@            Coverage Diff            @@
   ##                dev   #16069   +/-   ##
   =========================================
     Coverage     40.66%   40.66%           
   - Complexity     5225     5233    +8     
   =========================================
     Files          1380     1381    +1     
     Lines         46009    45988   -21     
     Branches       4919     4897   -22     
   =========================================
   - Hits          18709    18701    -8     
   + Misses        25376    25360   -16     
   - Partials       1924     1927    +3     
   ```
   
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/dolphinscheduler/pull/16069?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614457121


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/queue/DelayEntry.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.server.master.runner.queue;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+import java.util.concurrent.Delayed;
+import java.util.concurrent.TimeUnit;
+
+import lombok.Getter;
+
+import org.jetbrains.annotations.NotNull;
+
+public class DelayEntry<V extends Comparable<V>> implements Delayed {

Review Comment:
   ## Inconsistent equals and hashCode
   
   Class DelayEntry overrides [equals](1) but not hashCode.
   
   [Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/4159)



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "Radeity (via GitHub)" <gi...@apache.org>.
Radeity commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614499816


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.java:
##########
@@ -52,4 +52,30 @@ public TaskExecutionContext getTaskExecutionContext() {
         return taskExecutionContext;
     }
 
+    @Override
+    public int compareTo(TaskExecuteRunnable other) {
+        if (other == null) {
+            return 1;
+        }
+        int workflowInstancePriorityCompareResult = workflowInstance.getProcessInstancePriority().getCode() -
+                other.getWorkflowInstance().getProcessInstancePriority().getCode();
+        if (workflowInstancePriorityCompareResult != 0) {
+            return workflowInstancePriorityCompareResult;
+        }
+
+        int taskInstancePriorityCompareResult = taskInstance.getTaskInstancePriority().getCode()
+                - other.getTaskInstance().getTaskInstancePriority().getCode();
+        if (taskInstancePriorityCompareResult != 0) {
+            return taskInstancePriorityCompareResult;
+        }
+        // larger number, higher priority
+        int taskGroupPriorityCompareResult =
+                taskInstance.getTaskGroupPriority() - other.getTaskInstance().getTaskGroupPriority();
+        if (taskGroupPriorityCompareResult != 0) {
+            return -taskGroupPriorityCompareResult;

Review Comment:
   Ohh, so the comment should be `smaller number, higher priority`?



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614427643


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/TaskExecuteRunnable.java:
##########
@@ -40,4 +40,6 @@
     TaskInstance getTaskInstance();
 
     TaskExecutionContext getTaskExecutionContext();
+
+    int compareTo(TaskExecuteRunnable taskExecuteRunnable);

Review Comment:
   ## Missing Override annotation
   
   This method overrides [Comparable<TaskExecuteRunnable>.compareTo](1); it is advisable to add an Override annotation.
   
   [Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/4156)



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/queue/DelayEntry.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.server.master.runner.queue;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.concurrent.Delayed;
+import java.util.concurrent.TimeUnit;
+
+import lombok.Getter;
+
+import org.jetbrains.annotations.NotNull;
+
+public class DelayEntry<V extends Comparable<V>> implements Delayed {

Review Comment:
   ## Inconsistent compareTo
   
   This class declares [compareTo](1) but inherits equals; the two could be inconsistent.
   
   [Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/4158)



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614496043


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.java:
##########
@@ -52,4 +52,30 @@ public TaskExecutionContext getTaskExecutionContext() {
         return taskExecutionContext;
     }
 
+    @Override
+    public int compareTo(TaskExecuteRunnable other) {
+        if (other == null) {
+            return 1;
+        }
+        int workflowInstancePriorityCompareResult = workflowInstance.getProcessInstancePriority().getCode() -
+                other.getWorkflowInstance().getProcessInstancePriority().getCode();
+        if (workflowInstancePriorityCompareResult != 0) {
+            return workflowInstancePriorityCompareResult;
+        }
+
+        int taskInstancePriorityCompareResult = taskInstance.getTaskInstancePriority().getCode()
+                - other.getTaskInstance().getTaskInstancePriority().getCode();
+        if (taskInstancePriorityCompareResult != 0) {
+            return taskInstancePriorityCompareResult;
+        }
+        // larger number, higher priority
+        int taskGroupPriorityCompareResult =
+                taskInstance.getTaskGroupPriority() - other.getTaskInstance().getTaskGroupPriority();
+        if (taskGroupPriorityCompareResult != 0) {
+            return -taskGroupPriorityCompareResult;

Review Comment:
   This is a history problem, the higher task group priority the small number.



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.java:
##########
@@ -52,4 +52,30 @@ public TaskExecutionContext getTaskExecutionContext() {
         return taskExecutionContext;
     }
 
+    @Override
+    public int compareTo(TaskExecuteRunnable other) {
+        if (other == null) {
+            return 1;
+        }
+        int workflowInstancePriorityCompareResult = workflowInstance.getProcessInstancePriority().getCode() -
+                other.getWorkflowInstance().getProcessInstancePriority().getCode();
+        if (workflowInstancePriorityCompareResult != 0) {
+            return workflowInstancePriorityCompareResult;
+        }
+
+        int taskInstancePriorityCompareResult = taskInstance.getTaskInstancePriority().getCode()
+                - other.getTaskInstance().getTaskInstancePriority().getCode();
+        if (taskInstancePriorityCompareResult != 0) {
+            return taskInstancePriorityCompareResult;
+        }
+        // larger number, higher priority
+        int taskGroupPriorityCompareResult =
+                taskInstance.getTaskGroupPriority() - other.getTaskInstance().getTaskGroupPriority();
+        if (taskGroupPriorityCompareResult != 0) {
+            return -taskGroupPriorityCompareResult;
+        }
+        // The task instance shouldn't be equals
+        return taskInstance.getFirstSubmitTime().compareTo(other.getTaskInstance().getFirstSubmitTime());

Review Comment:
   Yes, the earlier submit time will have higher priority, I add ut for this case



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614495695


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/GlobalTaskDispatchWaitingQueueLooper.java:
##########
@@ -64,29 +58,34 @@ public synchronized void start() {
 
     @Override
     public void run() {
-        DefaultTaskExecuteRunnable defaultTaskExecuteRunnable;
         while (RUNNING_FLAG.get()) {
-            defaultTaskExecuteRunnable = globalTaskDispatchWaitingQueue.takeTaskExecuteRunnable();
-            try {
-                TaskExecutionStatus status = defaultTaskExecuteRunnable.getTaskInstance().getState();
-                if (status != TaskExecutionStatus.SUBMITTED_SUCCESS && status != TaskExecutionStatus.DELAY_EXECUTION) {
-                    log.warn("The TaskInstance {} state is : {}, will not dispatch",
-                            defaultTaskExecuteRunnable.getTaskInstance().getName(), status);
-                    continue;
-                }
+            doDispatch();
+        }
+    }
 
-                TaskDispatcher taskDispatcher =
-                        taskDispatchFactory.getTaskDispatcher(defaultTaskExecuteRunnable.getTaskInstance());
-                taskDispatcher.dispatchTask(defaultTaskExecuteRunnable);
-                DISPATCHED_CONSECUTIVE_FAILURE_TIMES.set(0);
-            } catch (Exception e) {
-                defaultTaskExecuteRunnable.getTaskExecutionContext().increaseDispatchFailTimes();
-                globalTaskDispatchWaitingQueue.submitTaskExecuteRunnable(defaultTaskExecuteRunnable);
-                if (DISPATCHED_CONSECUTIVE_FAILURE_TIMES.incrementAndGet() > MAX_DISPATCHED_FAILED_TIMES) {
-                    ThreadUtils.sleep(10 * 1000L);
-                }
-                log.error("Dispatch Task: {} failed", defaultTaskExecuteRunnable.getTaskInstance().getName(), e);
+    void doDispatch() {
+        final TaskExecuteRunnable taskExecuteRunnable = globalTaskDispatchWaitingQueue.takeTaskExecuteRunnable();
+        TaskInstance taskInstance = taskExecuteRunnable.getTaskInstance();
+        if (taskInstance == null) {
+            // This case shouldn't happen, but if it does, log an error and continue
+            log.error("The TaskInstance is null, drop it(This case shouldn't happen)");
+            return;
+        }
+        try {
+            TaskExecutionStatus status = taskInstance.getState();
+            if (status != TaskExecutionStatus.SUBMITTED_SUCCESS && status != TaskExecutionStatus.DELAY_EXECUTION) {
+                log.warn("The TaskInstance {} state is : {}, will not dispatch", taskInstance.getName(), status);
+                return;
             }
+            taskDispatchFactory.getTaskDispatcher(taskInstance).dispatchTask(taskExecuteRunnable);
+        } catch (Exception e) {
+            // If dispatch failed, will put the task back to the queue
+            // The task will be dispatched after waiting time.
+            // the waiting time will increase exponentially, but will not exceed 60 seconds
+            long waitingTimeMills = Math.max(
+                    taskExecuteRunnable.getTaskExecutionContext().increaseDispatchFailTimes() * 1_000L, 60_000L);

Review Comment:
   The wait time will be `1,2,3,4,5...60`. I updated the comment



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "Radeity (via GitHub)" <gi...@apache.org>.
Radeity commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614499816


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.java:
##########
@@ -52,4 +52,30 @@ public TaskExecutionContext getTaskExecutionContext() {
         return taskExecutionContext;
     }
 
+    @Override
+    public int compareTo(TaskExecuteRunnable other) {
+        if (other == null) {
+            return 1;
+        }
+        int workflowInstancePriorityCompareResult = workflowInstance.getProcessInstancePriority().getCode() -
+                other.getWorkflowInstance().getProcessInstancePriority().getCode();
+        if (workflowInstancePriorityCompareResult != 0) {
+            return workflowInstancePriorityCompareResult;
+        }
+
+        int taskInstancePriorityCompareResult = taskInstance.getTaskInstancePriority().getCode()
+                - other.getTaskInstance().getTaskInstancePriority().getCode();
+        if (taskInstancePriorityCompareResult != 0) {
+            return taskInstancePriorityCompareResult;
+        }
+        // larger number, higher priority
+        int taskGroupPriorityCompareResult =
+                taskInstance.getTaskGroupPriority() - other.getTaskInstance().getTaskGroupPriority();
+        if (taskGroupPriorityCompareResult != 0) {
+            return -taskGroupPriorityCompareResult;

Review Comment:
   Ohh, so the comment here should be `smaller number, higher priority`?



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#issuecomment-2131176296

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [58.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16069&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#issuecomment-2132268990

   No new change, just rebase commit.


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#issuecomment-2131154270

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [56.9% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16069&metric=new_coverage&view=list) (required ≥ 60%)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [B Reliability Rating on New Code](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069) (required ≥ A)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069)
   
   ##   
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png '') Catch issues before they fail your Quality Gate with our IDE extension ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png '') [SonarLint](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#issuecomment-2131154214

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [56.9% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16069&metric=new_coverage&view=list) (required ≥ 60%)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [B Reliability Rating on New Code](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069) (required ≥ A)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069)
   
   ##   
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png '') Catch issues before they fail your Quality Gate with our IDE extension ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png '') [SonarLint](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "Radeity (via GitHub)" <gi...@apache.org>.
Radeity commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614468030


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.java:
##########
@@ -52,4 +52,30 @@ public TaskExecutionContext getTaskExecutionContext() {
         return taskExecutionContext;
     }
 
+    @Override
+    public int compareTo(TaskExecuteRunnable other) {
+        if (other == null) {
+            return 1;
+        }
+        int workflowInstancePriorityCompareResult = workflowInstance.getProcessInstancePriority().getCode() -
+                other.getWorkflowInstance().getProcessInstancePriority().getCode();
+        if (workflowInstancePriorityCompareResult != 0) {
+            return workflowInstancePriorityCompareResult;
+        }
+
+        int taskInstancePriorityCompareResult = taskInstance.getTaskInstancePriority().getCode()
+                - other.getTaskInstance().getTaskInstancePriority().getCode();
+        if (taskInstancePriorityCompareResult != 0) {
+            return taskInstancePriorityCompareResult;
+        }
+        // larger number, higher priority
+        int taskGroupPriorityCompareResult =
+                taskInstance.getTaskGroupPriority() - other.getTaskInstance().getTaskGroupPriority();
+        if (taskGroupPriorityCompareResult != 0) {
+            return -taskGroupPriorityCompareResult;
+        }
+        // The task instance shouldn't be equals
+        return taskInstance.getFirstSubmitTime().compareTo(other.getTaskInstance().getFirstSubmitTime());

Review Comment:
   Maybe earlier submit time should have higher priority?



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.java:
##########
@@ -52,4 +52,30 @@ public TaskExecutionContext getTaskExecutionContext() {
         return taskExecutionContext;
     }
 
+    @Override
+    public int compareTo(TaskExecuteRunnable other) {
+        if (other == null) {
+            return 1;
+        }
+        int workflowInstancePriorityCompareResult = workflowInstance.getProcessInstancePriority().getCode() -
+                other.getWorkflowInstance().getProcessInstancePriority().getCode();
+        if (workflowInstancePriorityCompareResult != 0) {
+            return workflowInstancePriorityCompareResult;
+        }
+
+        int taskInstancePriorityCompareResult = taskInstance.getTaskInstancePriority().getCode()
+                - other.getTaskInstance().getTaskInstancePriority().getCode();
+        if (taskInstancePriorityCompareResult != 0) {
+            return taskInstancePriorityCompareResult;
+        }
+        // larger number, higher priority
+        int taskGroupPriorityCompareResult =
+                taskInstance.getTaskGroupPriority() - other.getTaskInstance().getTaskGroupPriority();
+        if (taskGroupPriorityCompareResult != 0) {
+            return -taskGroupPriorityCompareResult;

Review Comment:
   If larger number has higher priority, this place should return `taskGroupPriorityCompareResult `, and return value in line 63&69 should return opposite value.



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/GlobalTaskDispatchWaitingQueueLooper.java:
##########
@@ -64,29 +58,34 @@ public synchronized void start() {
 
     @Override
     public void run() {
-        DefaultTaskExecuteRunnable defaultTaskExecuteRunnable;
         while (RUNNING_FLAG.get()) {
-            defaultTaskExecuteRunnable = globalTaskDispatchWaitingQueue.takeTaskExecuteRunnable();
-            try {
-                TaskExecutionStatus status = defaultTaskExecuteRunnable.getTaskInstance().getState();
-                if (status != TaskExecutionStatus.SUBMITTED_SUCCESS && status != TaskExecutionStatus.DELAY_EXECUTION) {
-                    log.warn("The TaskInstance {} state is : {}, will not dispatch",
-                            defaultTaskExecuteRunnable.getTaskInstance().getName(), status);
-                    continue;
-                }
+            doDispatch();
+        }
+    }
 
-                TaskDispatcher taskDispatcher =
-                        taskDispatchFactory.getTaskDispatcher(defaultTaskExecuteRunnable.getTaskInstance());
-                taskDispatcher.dispatchTask(defaultTaskExecuteRunnable);
-                DISPATCHED_CONSECUTIVE_FAILURE_TIMES.set(0);
-            } catch (Exception e) {
-                defaultTaskExecuteRunnable.getTaskExecutionContext().increaseDispatchFailTimes();
-                globalTaskDispatchWaitingQueue.submitTaskExecuteRunnable(defaultTaskExecuteRunnable);
-                if (DISPATCHED_CONSECUTIVE_FAILURE_TIMES.incrementAndGet() > MAX_DISPATCHED_FAILED_TIMES) {
-                    ThreadUtils.sleep(10 * 1000L);
-                }
-                log.error("Dispatch Task: {} failed", defaultTaskExecuteRunnable.getTaskInstance().getName(), e);
+    void doDispatch() {
+        final TaskExecuteRunnable taskExecuteRunnable = globalTaskDispatchWaitingQueue.takeTaskExecuteRunnable();
+        TaskInstance taskInstance = taskExecuteRunnable.getTaskInstance();
+        if (taskInstance == null) {
+            // This case shouldn't happen, but if it does, log an error and continue
+            log.error("The TaskInstance is null, drop it(This case shouldn't happen)");
+            return;
+        }
+        try {
+            TaskExecutionStatus status = taskInstance.getState();
+            if (status != TaskExecutionStatus.SUBMITTED_SUCCESS && status != TaskExecutionStatus.DELAY_EXECUTION) {
+                log.warn("The TaskInstance {} state is : {}, will not dispatch", taskInstance.getName(), status);
+                return;
             }
+            taskDispatchFactory.getTaskDispatcher(taskInstance).dispatchTask(taskExecuteRunnable);
+        } catch (Exception e) {
+            // If dispatch failed, will put the task back to the queue
+            // The task will be dispatched after waiting time.
+            // the waiting time will increase exponentially, but will not exceed 60 seconds
+            long waitingTimeMills = Math.max(
+                    taskExecuteRunnable.getTaskExecutionContext().increaseDispatchFailTimes() * 1_000L, 60_000L);

Review Comment:
   It seems add 1s for each time, but not increase exponentially.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "Radeity (via GitHub)" <gi...@apache.org>.
Radeity commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614473832


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/GlobalTaskDispatchWaitingQueueLooper.java:
##########
@@ -64,29 +58,34 @@ public synchronized void start() {
 
     @Override
     public void run() {
-        DefaultTaskExecuteRunnable defaultTaskExecuteRunnable;
         while (RUNNING_FLAG.get()) {
-            defaultTaskExecuteRunnable = globalTaskDispatchWaitingQueue.takeTaskExecuteRunnable();
-            try {
-                TaskExecutionStatus status = defaultTaskExecuteRunnable.getTaskInstance().getState();
-                if (status != TaskExecutionStatus.SUBMITTED_SUCCESS && status != TaskExecutionStatus.DELAY_EXECUTION) {
-                    log.warn("The TaskInstance {} state is : {}, will not dispatch",
-                            defaultTaskExecuteRunnable.getTaskInstance().getName(), status);
-                    continue;
-                }
+            doDispatch();
+        }
+    }
 
-                TaskDispatcher taskDispatcher =
-                        taskDispatchFactory.getTaskDispatcher(defaultTaskExecuteRunnable.getTaskInstance());
-                taskDispatcher.dispatchTask(defaultTaskExecuteRunnable);
-                DISPATCHED_CONSECUTIVE_FAILURE_TIMES.set(0);
-            } catch (Exception e) {
-                defaultTaskExecuteRunnable.getTaskExecutionContext().increaseDispatchFailTimes();
-                globalTaskDispatchWaitingQueue.submitTaskExecuteRunnable(defaultTaskExecuteRunnable);
-                if (DISPATCHED_CONSECUTIVE_FAILURE_TIMES.incrementAndGet() > MAX_DISPATCHED_FAILED_TIMES) {
-                    ThreadUtils.sleep(10 * 1000L);
-                }
-                log.error("Dispatch Task: {} failed", defaultTaskExecuteRunnable.getTaskInstance().getName(), e);
+    void doDispatch() {
+        final TaskExecuteRunnable taskExecuteRunnable = globalTaskDispatchWaitingQueue.takeTaskExecuteRunnable();
+        TaskInstance taskInstance = taskExecuteRunnable.getTaskInstance();
+        if (taskInstance == null) {
+            // This case shouldn't happen, but if it does, log an error and continue
+            log.error("The TaskInstance is null, drop it(This case shouldn't happen)");
+            return;
+        }
+        try {
+            TaskExecutionStatus status = taskInstance.getState();
+            if (status != TaskExecutionStatus.SUBMITTED_SUCCESS && status != TaskExecutionStatus.DELAY_EXECUTION) {
+                log.warn("The TaskInstance {} state is : {}, will not dispatch", taskInstance.getName(), status);
+                return;
             }
+            taskDispatchFactory.getTaskDispatcher(taskInstance).dispatchTask(taskExecuteRunnable);
+        } catch (Exception e) {
+            // If dispatch failed, will put the task back to the queue
+            // The task will be dispatched after waiting time.
+            // the waiting time will increase exponentially, but will not exceed 60 seconds
+            long waitingTimeMills = Math.max(
+                    taskExecuteRunnable.getTaskExecutionContext().increaseDispatchFailTimes() * 1_000L, 60_000L);

Review Comment:
   It seems add 1s for each time, not exponentially.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614504010


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.java:
##########
@@ -52,4 +52,30 @@ public TaskExecutionContext getTaskExecutionContext() {
         return taskExecutionContext;
     }
 
+    @Override
+    public int compareTo(TaskExecuteRunnable other) {
+        if (other == null) {
+            return 1;
+        }
+        int workflowInstancePriorityCompareResult = workflowInstance.getProcessInstancePriority().getCode() -
+                other.getWorkflowInstance().getProcessInstancePriority().getCode();
+        if (workflowInstancePriorityCompareResult != 0) {
+            return workflowInstancePriorityCompareResult;
+        }
+
+        int taskInstancePriorityCompareResult = taskInstance.getTaskInstancePriority().getCode()
+                - other.getTaskInstance().getTaskInstancePriority().getCode();
+        if (taskInstancePriorityCompareResult != 0) {
+            return taskInstancePriorityCompareResult;
+        }
+        // larger number, higher priority
+        int taskGroupPriorityCompareResult =
+                taskInstance.getTaskGroupPriority() - other.getTaskInstance().getTaskGroupPriority();
+        if (taskGroupPriorityCompareResult != 0) {
+            return -taskGroupPriorityCompareResult;

Review Comment:
   Updated the comment, for task instance priority // smaller number, higher priority, for task group priority // larger number, higher priority



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#issuecomment-2133292702

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [58.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16069&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#issuecomment-2132277738

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [58.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16069&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#issuecomment-2132277827

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [58.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16069&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#issuecomment-2133292349

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [58.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16069&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614533773


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.java:
##########
@@ -52,4 +52,30 @@ public TaskExecutionContext getTaskExecutionContext() {
         return taskExecutionContext;
     }
 
+    @Override
+    public int compareTo(TaskExecuteRunnable other) {
+        if (other == null) {
+            return 1;
+        }
+        int workflowInstancePriorityCompareResult = workflowInstance.getProcessInstancePriority().getCode() -
+                other.getWorkflowInstance().getProcessInstancePriority().getCode();
+        if (workflowInstancePriorityCompareResult != 0) {
+            return workflowInstancePriorityCompareResult;
+        }
+
+        int taskInstancePriorityCompareResult = taskInstance.getTaskInstancePriority().getCode()
+                - other.getTaskInstance().getTaskInstancePriority().getCode();
+        if (taskInstancePriorityCompareResult != 0) {
+            return taskInstancePriorityCompareResult;
+        }
+        // larger number, higher priority
+        int taskGroupPriorityCompareResult =
+                taskInstance.getTaskGroupPriority() - other.getTaskInstance().getTaskGroupPriority();
+        if (taskGroupPriorityCompareResult != 0) {
+            return -taskGroupPriorityCompareResult;

Review Comment:
   No, for task instance/workflow instance smaller number, higher priority.
   <img width="480" alt="image" src="https://github.com/apache/dolphinscheduler/assets/22415594/639291c5-8f27-43df-8d71-51f26c37586d">
   



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "Radeity (via GitHub)" <gi...@apache.org>.
Radeity commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614510521


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.java:
##########
@@ -52,4 +52,30 @@ public TaskExecutionContext getTaskExecutionContext() {
         return taskExecutionContext;
     }
 
+    @Override
+    public int compareTo(TaskExecuteRunnable other) {
+        if (other == null) {
+            return 1;
+        }
+        int workflowInstancePriorityCompareResult = workflowInstance.getProcessInstancePriority().getCode() -
+                other.getWorkflowInstance().getProcessInstancePriority().getCode();
+        if (workflowInstancePriorityCompareResult != 0) {
+            return workflowInstancePriorityCompareResult;
+        }
+
+        int taskInstancePriorityCompareResult = taskInstance.getTaskInstancePriority().getCode()
+                - other.getTaskInstance().getTaskInstancePriority().getCode();
+        if (taskInstancePriorityCompareResult != 0) {
+            return taskInstancePriorityCompareResult;
+        }
+        // larger number, higher priority
+        int taskGroupPriorityCompareResult =
+                taskInstance.getTaskGroupPriority() - other.getTaskInstance().getTaskGroupPriority();
+        if (taskGroupPriorityCompareResult != 0) {
+            return -taskGroupPriorityCompareResult;

Review Comment:
   Wait, two comments seem reversed, for task group priority, `smaller number, higher priority`, for workerflow/taskInstance, `larger number, higher priority`.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "Radeity (via GitHub)" <gi...@apache.org>.
Radeity commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614537271


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.java:
##########
@@ -52,4 +52,30 @@ public TaskExecutionContext getTaskExecutionContext() {
         return taskExecutionContext;
     }
 
+    @Override
+    public int compareTo(TaskExecuteRunnable other) {
+        if (other == null) {
+            return 1;
+        }
+        int workflowInstancePriorityCompareResult = workflowInstance.getProcessInstancePriority().getCode() -
+                other.getWorkflowInstance().getProcessInstancePriority().getCode();
+        if (workflowInstancePriorityCompareResult != 0) {
+            return workflowInstancePriorityCompareResult;
+        }
+
+        int taskInstancePriorityCompareResult = taskInstance.getTaskInstancePriority().getCode()
+                - other.getTaskInstance().getTaskInstancePriority().getCode();
+        if (taskInstancePriorityCompareResult != 0) {
+            return taskInstancePriorityCompareResult;
+        }
+        // larger number, higher priority
+        int taskGroupPriorityCompareResult =
+                taskInstance.getTaskGroupPriority() - other.getTaskInstance().getTaskGroupPriority();
+        if (taskGroupPriorityCompareResult != 0) {
+            return -taskGroupPriorityCompareResult;

Review Comment:
   I see, but according to UT and code logic, task instance of `Priority.HIGH` has higher priority than `Priority.LOW`



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#discussion_r1614533773


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.java:
##########
@@ -52,4 +52,30 @@ public TaskExecutionContext getTaskExecutionContext() {
         return taskExecutionContext;
     }
 
+    @Override
+    public int compareTo(TaskExecuteRunnable other) {
+        if (other == null) {
+            return 1;
+        }
+        int workflowInstancePriorityCompareResult = workflowInstance.getProcessInstancePriority().getCode() -
+                other.getWorkflowInstance().getProcessInstancePriority().getCode();
+        if (workflowInstancePriorityCompareResult != 0) {
+            return workflowInstancePriorityCompareResult;
+        }
+
+        int taskInstancePriorityCompareResult = taskInstance.getTaskInstancePriority().getCode()
+                - other.getTaskInstance().getTaskInstancePriority().getCode();
+        if (taskInstancePriorityCompareResult != 0) {
+            return taskInstancePriorityCompareResult;
+        }
+        // larger number, higher priority
+        int taskGroupPriorityCompareResult =
+                taskInstance.getTaskGroupPriority() - other.getTaskInstance().getTaskGroupPriority();
+        if (taskGroupPriorityCompareResult != 0) {
+            return -taskGroupPriorityCompareResult;

Review Comment:
   No, for task instance/workflow instance smaller number, higher priority.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069#issuecomment-2131175106

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [58.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16069&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16069)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [DSIP-44] Set a delay time to TaskExecuteRunnable if it dispatched failed [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun merged PR #16069:
URL: https://github.com/apache/dolphinscheduler/pull/16069


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org