-
Notifications
You must be signed in to change notification settings - Fork 9.2k
YARN-11122. Support getClusterNodes API in FederationClientInterceptor #4274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
7bd9675
2af73f5
87277d1
6630ce6
07f6090
1bf7332
b4867c0
aa49c3a
c6e404b
c7ccca5
407c039
7845199
f16651f
dde385a
72359e0
0887df5
dbd5cb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -346,6 +346,11 @@ public void getClusterMetrics() { | |
| LOG.info("Mocked: failed getClusterMetrics call"); | ||
| metrics.incrGetClusterMetricsFailedRetrieved(); | ||
| } | ||
|
|
||
| public void getClusterNodes() { | ||
| LOG.info("Mocked: failed getClusterNodes call"); | ||
| metrics.incrClusterNodesFailedRetrieved(); | ||
| } | ||
| } | ||
|
|
||
| // Records successes for all calls | ||
|
|
@@ -392,5 +397,33 @@ public void getClusterMetrics(long duration){ | |
| duration); | ||
| metrics.succeededGetClusterMetricsRetrieved(duration); | ||
| } | ||
|
|
||
| public void getClusterNodes(long duration) { | ||
| LOG.info("Mocked: successful getClusterNodes call with duration {}", duration); | ||
| metrics.succeededGetClusterNodesRetrieved(duration); | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void testSucceededGetClusterNodes() { | ||
| long totalGoodBefore = metrics.getNumSucceededGetClusterNodesRetrieved(); | ||
| goodSubCluster.getClusterNodes(150); | ||
| Assert.assertEquals(totalGoodBefore + 1, | ||
| metrics.getNumSucceededGetClusterNodesRetrieved()); | ||
| Assert.assertEquals(150, metrics.getLatencySucceededGetClusterNodesRetrieved(), | ||
goiri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 0); | ||
| goodSubCluster.getClusterNodes(300); | ||
| Assert.assertEquals(totalGoodBefore + 2, | ||
| metrics.getNumSucceededGetClusterNodesRetrieved()); | ||
| Assert.assertEquals(225, metrics.getLatencySucceededGetClusterNodesRetrieved(), | ||
| 0); | ||
| } | ||
|
|
||
| @Test | ||
| public void testGetClusterNodesFailed() { | ||
| long totalBadBefore = metrics.getClusterNodesFailedRetrieved(); | ||
| badSubCluster.getClusterNodes(); | ||
| Assert.assertEquals(totalBadBefore + 1, | ||
|
||
| metrics.getClusterNodesFailedRetrieved()); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,8 @@ | |
| import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationResponse; | ||
| import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest; | ||
| import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse; | ||
| import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; | ||
| import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesRequest; | ||
| import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; | ||
| import org.apache.hadoop.yarn.api.records.ApplicationId; | ||
| import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; | ||
|
|
@@ -641,4 +643,17 @@ public void testGetApplicationsApplicationStateNotExists() throws Exception{ | |
| Assert.assertNotNull(responseGet); | ||
| Assert.assertTrue(responseGet.getApplicationList().isEmpty()); | ||
| } | ||
|
|
||
| @Test | ||
| public void testGetClusterNodesRequest() throws Exception { | ||
| LOG.info("Test FederationClientInterceptor : Get Cluster Nodeds request"); | ||
| // null request | ||
| LambdaTestUtils.intercept(YarnException.class, "Missing getClusterNodes request.", | ||
| () -> interceptor.getClusterNodes(null)); | ||
| // normal request. | ||
| GetClusterNodesResponse response = | ||
| interceptor.getClusterNodes(GetClusterNodesRequest.newInstance()); | ||
| Assert.assertEquals(subClusters.size(), | ||
goiri marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| response.getNodeReports().size()); | ||
|
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.