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

Ahmed Hussein commented on YARN-9563:
-------------------------------------

Thanks [~jeagles] for the feedback on the test case.

I checked the FiCaSchedulerApp. The following piece of code protects against 
Inf/NaN, but a test case is missing.

 
{code:java}
if (!effCap.equals(Resources.none())) {
 queueUsagePerc = calc.divide(totalPartitionRes,
 report.getUsedResources(), effCap) * 100;
}{code}
 

 

A test case could be as follows:
{noformat}
// test that queueUsagePercentage returns neither NaN nor Infinite
AbstractCSQueue zeroQueue = createQueue("test2.2", null, Float.MIN_VALUE, 
Float.MIN_VALUE,
    Resources.multiply(res, Float.MIN_VALUE));
app = new FiCaSchedulerApp(appAttId, user, zeroQueue,
    qChild.getAbstractUsersManager(), rmContext);
app.getAppAttemptResourceUsage().incUsed(requestedResource);
assertEquals(0.0f, app.getResourceUsageReport().getQueueUsagePercentage(),
    0.01f);{noformat}
 

> Resource report REST API could return NaN or Inf
> ------------------------------------------------
>
>                 Key: YARN-9563
>                 URL: https://issues.apache.org/jira/browse/YARN-9563
>             Project: Hadoop YARN
>          Issue Type: Improvement
>            Reporter: Ahmed Hussein
>            Assignee: Ahmed Hussein
>            Priority: Minor
>         Attachments: YARN-9563.001.patch, YARN-9563.002.patch
>
>
> The Resource Manager's Cluster Applications and Cluster Application REST APIs 
> are sometimes returning invalid JSON. This was addressed in YARN-6082.
> However, the fix only fixes the calculation in one site and does not 
> guarantee to avoid the problem.Likewise, generating NaN/Inf can break the web 
> GUI if the columns cannot render non-numeric values.
> The suggested fix is to check for NaN/Inf in the protob. The protob replaces 
> NaN/Inf by 0.0f.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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