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

Vasudevan Skm commented on YARN-7330:
-------------------------------------

[~wangda]

1) There are a lot of console.logs in the code. Ideally any prod code should 
not have debugger/ console statements. 
2) /converter.js has a lot of constants. 

```

if (unit === "Ki") {
normalizedValue = normalizedValue * 1024;
} else if (unit === "Mi") {
normalizedValue = normalizedValue * 1024 * 1024;
} else if (unit === "Gi") {
normalizedValue = normalizedValue * 1024 * 1024 * 1024;
} else if (unit === "Ti") {
normalizedValue = normalizedValue * 1024 * 1024 * 1024 * 1024;
} else if (unit === "Pi") {
normalizedValue = normalizedValue * 1024 * 1024 * 1024 * 1024 * 1024;
}

```

can be refactored to 

```
const exponents = {
        
        ki:  1024;
 Mi: 1024 ^ 2,
 Gi: 1024 ^ 3
}

normalizedValue = normalizedValue * exponents[]

``

Also, all the if blocks here have the same condition
```
      var finalUnit = "";
      if (normalizedValue / 1024 >= 0.9) {
        normalizedValue = normalizedValue / 1024;
        finalUnit = "Ki";
      }
      if (normalizedValue / 1024 >= 0.9) {
        normalizedValue = normalizedValue / 1024;
        finalUnit = "Mi";
      }
      if (normalizedValue / 1024 >= 0.9) {
        normalizedValue = normalizedValue / 1024;
        finalUnit = "Gi";
      }
      if (normalizedValue / 1024 >= 0.9) {
        normalizedValue = normalizedValue / 1024;
        finalUnit = "Ti";
     
      if (normalizedValue / 1024 >= 0.9) {
        normalizedValue = normalizedValue / 1024;
        finalUnit = "Pi";
      }
```

Am I missing something here?

3. In donut-chart.js can the strings like "resource","memory" be added to a 
constant called ResourceType and used? 




> Add support to show GPU on UI/metrics
> -------------------------------------
>
>                 Key: YARN-7330
>                 URL: https://issues.apache.org/jira/browse/YARN-7330
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>            Reporter: Wangda Tan
>            Assignee: Wangda Tan
>            Priority: Blocker
>         Attachments: YARN-7330.0-wip.patch, YARN-7330.003.patch, 
> YARN-7330.004.patch, YARN-7330.006.patch, YARN-7330.1-wip.patch, 
> YARN-7330.2-wip.patch, screencapture-0-wip.png
>
>
> We should be able to view GPU metrics from UI/REST API.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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