[ 
https://issues.apache.org/jira/browse/YARN-3689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14694661#comment-14694661
 ] 

Ajith S commented on YARN-3689:
-------------------------------

I think it follows the contract of compare, but as Collections.sort is 
processed, in case of priority its suppose to negate. just flipping the s1 and 
s2 may serve the purpose, but violate compare contract

> FifoComparator logic is wrong. In method "compare" in "FifoPolicy.java" file, 
> the "s1" and "s2" should change position when compare priority 
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: YARN-3689
>                 URL: https://issues.apache.org/jira/browse/YARN-3689
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: fairscheduler, scheduler
>    Affects Versions: 2.5.0
>            Reporter: zhoulinlin
>            Assignee: Ajith S
>
> In method "compare" in "FifoPolicy.java" file, the "s1" and "s2" should 
> change position when compare priority.
> I did a test. Configured the schedulerpolicy "fifo",  submitted 2 jobs to the 
> same queue.
> The result is below:
> 2015-05-20 11:57:41,449 DEBUG 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue: 
> before sort ------------------  
> 2015-05-20 11:57:41,449 DEBUG 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue: 
> appName:application_1432094103221_0001 appPririty:4  
> appStartTime:1432094170038
> 2015-05-20 11:57:41,449 DEBUG 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue: 
> appName:application_1432094103221_0002 appPririty:2  
> appStartTime:1432094173131
> 2015-05-20 11:57:41,449 DEBUG 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue: 
> after sort %%%%%%%%%%%%% 
> 2015-05-20 11:57:41,449 DEBUG 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue: 
> appName:application_1432094103221_0001 appPririty:4  
> appStartTime:1432094170038  
> 2015-05-20 11:57:41,449 DEBUG 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue: 
> appName:application_1432094103221_0002 appPririty:2  
> appStartTime:1432094173131  
> But when change the "s1" and "s2" position like below:
> public int compare(Schedulable s1, Schedulable s2) {
>       int res = s2.getPriority().compareTo(s1.getPriority());
> .........}
> The result:
> 2015-05-20 11:36:37,119 DEBUG 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue: 
> before sort ------------------ 
> 2015-05-20 11:36:37,119 DEBUG 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue: 
> appName:application_1432090734333_0009 appPririty:4  
> appStartTime:1432092992503
> 2015-05-20 11:36:37,119 DEBUG 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue: 
> appName:application_1432090734333_0010 appPririty:2  
> appStartTime:1432092996437
> 2015-05-20 11:36:37,119 DEBUG 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue: 
> after sort %%%%%%%%%%%%% 
> 2015-05-20 11:36:37,119 DEBUG 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue: 
> appName:application_1432090734333_0010 appPririty:2  
> appStartTime:1432092996437
> 2015-05-20 11:36:37,119 DEBUG 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue: 
> appName:application_1432090734333_0009 appPririty:4  
> appStartTime:1432092992503 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to