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

Daniel Templeton commented on YARN-4807:
----------------------------------------

[~yufeigu], thanks for the patch.  I have a few comments:

*MockRM*

{code}
108:  static final int timeoutMsecsForApp = 80000;
109:  static final int timeoutMsecs = 40000;
110:  static final int minWaitMsecs = 1000;
111:  static final int waitMsPerLoop = 10;
{code}

Those should all be snake case, e.g. {{TIMEOUT_MSECS}} and probably protected 
so that subclasses can use them.  More importantly, I don't think the first 
three are helping anything.  {{timeoutMsecsForApp}} and {{minWaitMsecs}} are 
only used once, so moving them out to a constant just makes the code harder to 
follow.  The additional clarity gained from giving the number a name is pretty 
minimal since that information is already provided by context.  Making them 
constants means I have to go look up the value of the constant, though, so the 
net result is that the code is a tiny bit harder to read.

Using {{timeoutMsecs}} instead of the timeout parameter of the 
{{waitForState()}} method is a bad idea.  You've replaced a configurable 
timeout that was 10s, 30s, or 40s in practice with a fixed 40s timeout.  That 
seems against the goals of the JIRA.

I'm a little suspicious of dropping the {{waitForContainer...()}} methods in 
favor of {{waitForState()}}, but if the unit tests still pass, who am I to 
complain?

*MockAM*

{code}
80:    final int timeoutMsecs = MockRM.timeoutMsecs;
81:    final int minWaitMsecs = MockRM.minWaitMsecs;
82:    final int waitMsPerLoop = MockRM.waitMsPerLoop;
{code}

You should just use the constants directly instead of assigning their values to 
intermediate variables.

> MockAM#waitForState sleep duration is too long
> ----------------------------------------------
>
>                 Key: YARN-4807
>                 URL: https://issues.apache.org/jira/browse/YARN-4807
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>    Affects Versions: 2.8.0
>            Reporter: Karthik Kambatla
>            Assignee: Yufei Gu
>              Labels: newbie
>         Attachments: YARN-4807.001.patch
>
>
> MockAM#waitForState sleep duration (500 ms) is too long. Also, there is 
> significant duplication with MockRM#waitForState.



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

Reply via email to