fuchanghai commented on code in PR #15486:
URL: 
https://github.com/apache/dolphinscheduler/pull/15486#discussion_r1452882974


##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/StandByTaskInstancePriorityQueue.java:
##########
@@ -162,25 +161,24 @@ private String getTaskInstanceIdentify(TaskInstance 
taskInstance) {
                 String.valueOf(taskInstance.getTaskDefinitionVersion()), "-");
     }
 
-    /**
-     * TaskInfoComparator
-     */
     private static class TaskInfoComparator implements 
Comparator<TaskInstance> {
 
-        /**
-         * compare o1 o2
-         *
-         * @param o1 o1
-         * @param o2 o2
-         * @return compare result
-         */
+        // a negative integer, zero, or a positive integer as the first 
argument is less than, equal to, or greater than
+        // the second.
+        // The smaller Element will be at the head of the queue.
         @Override
         public int compare(TaskInstance o1, TaskInstance o2) {
-            if 
(o1.getTaskInstancePriority().equals(o2.getTaskInstancePriority())) {
-                // larger number, higher priority
-                return Constants.OPPOSITE_VALUE * 
Integer.compare(o1.getTaskGroupPriority(), o2.getTaskGroupPriority());
+            int taskPriorityInTaskGroup = -1 * 
Integer.compare(o1.getTaskGroupPriority(), o2.getTaskGroupPriority());
+            int taskInstancePriorityInWorkflow =
+                    Long.compare(o1.getTaskInstancePriority().getCode(), 
o2.getTaskInstancePriority().getCode());
+
+            if (o1.getTaskGroupId() == o2.getTaskGroupId()) {
+                // Is at the same taskGroup

Review Comment:
   others LGTM



##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/StandByTaskInstancePriorityQueue.java:
##########
@@ -162,25 +161,24 @@ private String getTaskInstanceIdentify(TaskInstance 
taskInstance) {
                 String.valueOf(taskInstance.getTaskDefinitionVersion()), "-");
     }
 
-    /**
-     * TaskInfoComparator
-     */
     private static class TaskInfoComparator implements 
Comparator<TaskInstance> {
 
-        /**
-         * compare o1 o2
-         *
-         * @param o1 o1
-         * @param o2 o2
-         * @return compare result
-         */
+        // a negative integer, zero, or a positive integer as the first 
argument is less than, equal to, or greater than
+        // the second.
+        // The smaller Element will be at the head of the queue.
         @Override
         public int compare(TaskInstance o1, TaskInstance o2) {
-            if 
(o1.getTaskInstancePriority().equals(o2.getTaskInstancePriority())) {
-                // larger number, higher priority
-                return Constants.OPPOSITE_VALUE * 
Integer.compare(o1.getTaskGroupPriority(), o2.getTaskGroupPriority());
+            int taskPriorityInTaskGroup = -1 * 
Integer.compare(o1.getTaskGroupPriority(), o2.getTaskGroupPriority());
+            int taskInstancePriorityInWorkflow =
+                    Long.compare(o1.getTaskInstancePriority().getCode(), 
o2.getTaskInstancePriority().getCode());
+
+            if (o1.getTaskGroupId() == o2.getTaskGroupId()) {
+                // Is at the same taskGroup

Review Comment:
   hi @ruanwenjun  Do we change it to ```If at the same taskGroup``` 



-- 
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