You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2020/12/01 03:34:01 UTC

[GitHub] [incubator-dolphinscheduler] GitFireMan opened a new issue #4137: [Improvement][master] TaskPriorityQueueConsumer No need to sleep for one second

GitFireMan opened a new issue #4137:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4137


   **Describe the question**
   TaskPriorityQueueConsumer.run() call taskPriorityQueue.size() and if size is 0,then thread will b sleep for 1 second.
   I think there is no need to do this, code is show here:
   ` @Override
       public void run() {
           List<String> failedDispatchTasks = new ArrayList<>();
           while (Stopper.isRunning()) {
               try {
                   int fetchTaskNum = masterConfig.getMasterDispatchTaskNumber();
                   failedDispatchTasks.clear();
                   for (int i = 0; i < fetchTaskNum; i++) {
                       if (taskPriorityQueue.size() <= 0) {
                           Thread.sleep(Constants.SLEEP_TIME_MILLIS);
                           continue;
                       }
                       // if not task , blocking here
                       String taskPriorityInfo = taskPriorityQueue.take();
                       TaskPriority taskPriority = TaskPriority.of(taskPriorityInfo);
                       boolean dispatchResult = dispatch(taskPriority.getTaskId());
                       if (!dispatchResult) {
                           failedDispatchTasks.add(taskPriorityInfo);
                       }
                   }
                   for (String dispatchFailedTask : failedDispatchTasks) {
                       taskPriorityQueue.put(dispatchFailedTask);
                   }
               } catch (Exception e) {
                   logger.error("dispatcher task error", e);
               }
           }
       }`
   
   I think these three lines removed will be better.
   
   `  if (taskPriorityQueue.size() <= 0) {
                           Thread.sleep(Constants.SLEEP_TIME_MILLIS);
                           continue;
      }`
   


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

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



[GitHub] [incubator-dolphinscheduler] dailidong edited a comment on issue #4137: [Improvement][master] TaskPriorityQueueConsumer No need to sleep for one second

Posted by GitBox <gi...@apache.org>.
dailidong edited a comment on issue #4137:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4137#issuecomment-778753396


   > I can solve this problem, assign it to me!
   
   good, happy new year,  I have assigned this issue to you, looking forward to your PR


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

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



[GitHub] [incubator-dolphinscheduler] dailidong commented on issue #4137: [Improvement][master] TaskPriorityQueueConsumer No need to sleep for one second

Posted by GitBox <gi...@apache.org>.
dailidong commented on issue #4137:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4137#issuecomment-782866139


   > I can try it, assign it to me!
   
   done


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

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



[GitHub] [incubator-dolphinscheduler] dailidong commented on issue #4137: [Improvement][master] TaskPriorityQueueConsumer No need to sleep for one second

Posted by GitBox <gi...@apache.org>.
dailidong commented on issue #4137:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4137#issuecomment-778753396


   > I can solve this problem, assign it to me!
   
   good, happy new year,  I have assigned to you, looking forward to your PR


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

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



[GitHub] [incubator-dolphinscheduler] dailidong commented on issue #4137: [Improvement][master] TaskPriorityQueueConsumer No need to sleep for one second

Posted by GitBox <gi...@apache.org>.
dailidong commented on issue #4137:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4137#issuecomment-773146924


   > See for specific reasons #4140
   
   anybody who want to do this feature please refer the PR #4140, then re-submit a new PR 


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

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



[GitHub] [incubator-dolphinscheduler] dailidong commented on issue #4137: [Improvement][master] TaskPriorityQueueConsumer No need to sleep for one second

Posted by GitBox <gi...@apache.org>.
dailidong commented on issue #4137:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4137#issuecomment-773146924


   > See for specific reasons #4140
   
   anybody who want to do this feature please refer the PR #4140, then re-submit a new PR 


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

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



[GitHub] [incubator-dolphinscheduler] GitFireMan commented on issue #4137: [Improvement][master] TaskPriorityQueueConsumer No need to sleep for one second

Posted by GitBox <gi...@apache.org>.
GitFireMan commented on issue #4137:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4137#issuecomment-736952753


   TaskPriorityQueueConsumer's logic is very easy. just cosume the task waiting to run in  priority queue. I think that there is no need a determine statement `if(queue.size() <= 0) Thread.sleep(1 second)`. because code below is `queue.take()` which is a blocking method if queue is empty.


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

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



[GitHub] [incubator-dolphinscheduler] CalvinKirs commented on issue #4137: [Improvement][master] TaskPriorityQueueConsumer No need to sleep for one second

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on issue #4137:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4137#issuecomment-736998534


   See for specific reasons #4140 


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

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



[GitHub] [incubator-dolphinscheduler] dailidong closed issue #4137: [Improvement][master] TaskPriorityQueueConsumer No need to sleep for one second

Posted by GitBox <gi...@apache.org>.
dailidong closed issue #4137:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4137


   


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

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



[GitHub] [incubator-dolphinscheduler] AlleriaWindrunner commented on issue #4137: [Improvement][master] TaskPriorityQueueConsumer No need to sleep for one second

Posted by GitBox <gi...@apache.org>.
AlleriaWindrunner commented on issue #4137:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4137#issuecomment-774832498


   I can solve this problem, assign it to me!


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

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



[GitHub] [incubator-dolphinscheduler] woshiwuxiaofei commented on issue #4137: [Improvement][master] TaskPriorityQueueConsumer No need to sleep for one second

Posted by GitBox <gi...@apache.org>.
woshiwuxiaofei commented on issue #4137:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4137#issuecomment-782865974


   I can try it, assign it to me!


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

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