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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]