You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-dev@hadoop.apache.org by "Benjamin Teke (Jira)" <ji...@apache.org> on 2021/10/29 16:08:00 UTC

[jira] [Created] (YARN-10994) Remove the clusterResource param from RMNodeLabelsManager.getResourceByLabel

Benjamin Teke created YARN-10994:
------------------------------------

             Summary: Remove the clusterResource param from RMNodeLabelsManager.getResourceByLabel
                 Key: YARN-10994
                 URL: https://issues.apache.org/jira/browse/YARN-10994
             Project: Hadoop YARN
          Issue Type: Sub-task
            Reporter: Benjamin Teke


RMNodeLabelsManager.getResourceByLabel has currently two parameters: String label and Resource clusterResource. The latter however is only used by tests during mocking: the parameter supplied in the production code by the callers are returned in tests. See ReservationSystemTestUtil.createRMContext:

{code:java}
...
 when(nlm.getResourceByLabel(any(), any(Resource.class)))
        .thenAnswer(new Answer<Resource>() {
          @Override
          public Resource answer(InvocationOnMock invocation) throws Throwable {
            Object[] args = invocation.getArguments();
            return (Resource) args[1];
          }
        });
...
{code}

This is misleading and hard to understand (no way of knowing with what values are the clusterResources mocked by looking at the tests) and generates unnecessary production code so it should be removed and the tests should be properly mocked.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-dev-help@hadoop.apache.org