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

Ayush Saxena commented on YARN-9624:
------------------------------------

For the test instead of having if-else checks and explicitly passing one elemt, 
it can be done in one line using streams, Something like this :
{code:java}
  @Test
  public void testConvertFromOrToProtoFormat() {
    // Check if utility has all enum values
    Stream.of(ContainerState.values())
        .forEach(a -> ProtoUtils.convertToProtoFormat(a));
    Stream.of(ContainerSubState.values())
        .forEach(a -> ProtoUtils.convertToProtoFormat(a));
    Stream.of(ContainerSubStateProto.values())
        .forEach(a -> ProtoUtils.convertFromProtoFormat(a));
    Stream.of(ContainerStateProto.values())
        .forEach(a -> ProtoUtils.convertFromProtoFormat(a));
  }
{code}
Give a check if it sounds better.

> Use switch case for ProtoUtils#convertFromProtoFormat containerState
> --------------------------------------------------------------------
>
>                 Key: YARN-9624
>                 URL: https://issues.apache.org/jira/browse/YARN-9624
>             Project: Hadoop YARN
>          Issue Type: Improvement
>            Reporter: Bibin Chundatt
>            Assignee: Bilwa S T
>            Priority: Major
>              Labels: performance
>         Attachments: YARN-9624.001.patch, YARN-9624.002.patch
>
>
> On large cluster with 100K+ containers on every heartbeat 
> {{ContainerState.valueOf(e.name().replace(CONTAINER_STATE_PREFIX, ""))}} will 
> be too costly. Update with switch case.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to