YARN-2780. Log aggregated resource allocation in rm-appsummary.log. Contributed by Eric Payne
(cherry picked from commit f8aefa5e9c
)
This commit is contained in:
parent
d863f54f57
commit
6984d899e3
|
@ -41,6 +41,9 @@ Release 2.7.0 - UNRELEASED
|
|||
YARN-570. Time strings are formated in different timezone.
|
||||
(Akira Ajisaka and Peng Zhang via kasha)
|
||||
|
||||
YARN-2780. Log aggregated resource allocation in rm-appsummary.log (Eric
|
||||
Payne via jlowe)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
|
|
@ -47,6 +47,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
|||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEventType;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppMetrics;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRecoverEvent;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||
|
@ -155,6 +156,7 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
|
|||
trackingUrl = attempt.getTrackingUrl();
|
||||
host = attempt.getHost();
|
||||
}
|
||||
RMAppMetrics metrics = app.getRMAppMetrics();
|
||||
SummaryBuilder summary = new SummaryBuilder()
|
||||
.add("appId", app.getApplicationId())
|
||||
.add("name", app.getName())
|
||||
|
@ -165,7 +167,12 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
|
|||
.add("appMasterHost", host)
|
||||
.add("startTime", app.getStartTime())
|
||||
.add("finishTime", app.getFinishTime())
|
||||
.add("finalStatus", app.getFinalApplicationStatus());
|
||||
.add("finalStatus", app.getFinalApplicationStatus())
|
||||
.add("memorySeconds", metrics.getMemorySeconds())
|
||||
.add("vcoreSeconds", metrics.getVcoreSeconds())
|
||||
.add("preemptedAMContainers", metrics.getNumAMContainersPreempted())
|
||||
.add("preemptedNonAMContainers", metrics.getNumNonAMContainersPreempted())
|
||||
.add("preemptedResources", metrics.getResourcePreempted());
|
||||
return summary;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.MockRMApp;
|
|||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEventType;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppMetrics;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.ContainerAllocationExpirer;
|
||||
|
@ -572,6 +573,10 @@ public class TestAppManager{
|
|||
when(app.getQueue()).thenReturn("Multiline\n\n\r\rQueueName");
|
||||
when(app.getState()).thenReturn(RMAppState.RUNNING);
|
||||
|
||||
RMAppMetrics metrics =
|
||||
new RMAppMetrics(Resource.newInstance(1234, 56), 10, 1, 16384, 64);
|
||||
when(app.getRMAppMetrics()).thenReturn(metrics);
|
||||
|
||||
RMAppManager.ApplicationSummary.SummaryBuilder summary =
|
||||
new RMAppManager.ApplicationSummary().createAppSummary(app);
|
||||
String msg = summary.toString();
|
||||
|
@ -583,6 +588,11 @@ public class TestAppManager{
|
|||
Assert.assertTrue(msg.contains("Multiline" + escaped +"AppName"));
|
||||
Assert.assertTrue(msg.contains("Multiline" + escaped +"UserName"));
|
||||
Assert.assertTrue(msg.contains("Multiline" + escaped +"QueueName"));
|
||||
Assert.assertTrue(msg.contains("memorySeconds=16384"));
|
||||
Assert.assertTrue(msg.contains("vcoreSeconds=64"));
|
||||
Assert.assertTrue(msg.contains("preemptedAMContainers=1"));
|
||||
Assert.assertTrue(msg.contains("preemptedNonAMContainers=10"));
|
||||
Assert.assertTrue(msg.contains("preemptedResources=<memory:1234\\, vCores:56>"));
|
||||
}
|
||||
|
||||
private static ResourceScheduler mockResourceScheduler() {
|
||||
|
|
Loading…
Reference in New Issue