YARN-2543. Made resource usage be published to the timeline server too. Contributed by Naganarasimha G R.
This commit is contained in:
parent
b73e776abc
commit
e5b56e2af6
@ -470,6 +470,9 @@ Release 2.7.0 - UNRELEASED
|
|||||||
YARN-3056. Add verification for containerLaunchDuration
|
YARN-3056. Add verification for containerLaunchDuration
|
||||||
in TestNodeManagerMetrics. (zhihai xu via xgong)
|
in TestNodeManagerMetrics. (zhihai xu via xgong)
|
||||||
|
|
||||||
|
YARN-2543. Made resource usage be published to the timeline server too.
|
||||||
|
(Naganarasimha G R via zjshen)
|
||||||
|
|
||||||
Release 2.6.0 - 2014-11-18
|
Release 2.6.0 - 2014-11-18
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
|
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
||||||
|
import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerExitStatus;
|
import org.apache.hadoop.yarn.api.records.ContainerExitStatus;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerReport;
|
import org.apache.hadoop.yarn.api.records.ContainerReport;
|
||||||
@ -222,6 +223,7 @@ private static ApplicationReportExt convertToApplicationReport(
|
|||||||
String diagnosticsInfo = null;
|
String diagnosticsInfo = null;
|
||||||
FinalApplicationStatus finalStatus = FinalApplicationStatus.UNDEFINED;
|
FinalApplicationStatus finalStatus = FinalApplicationStatus.UNDEFINED;
|
||||||
YarnApplicationState state = null;
|
YarnApplicationState state = null;
|
||||||
|
ApplicationResourceUsageReport appResources = null;
|
||||||
Map<ApplicationAccessType, String> appViewACLs =
|
Map<ApplicationAccessType, String> appViewACLs =
|
||||||
new HashMap<ApplicationAccessType, String>();
|
new HashMap<ApplicationAccessType, String>();
|
||||||
Map<String, Object> entityInfo = entity.getOtherInfo();
|
Map<String, Object> entityInfo = entity.getOtherInfo();
|
||||||
@ -260,6 +262,14 @@ private static ApplicationReportExt convertToApplicationReport(
|
|||||||
entityInfo.get(ApplicationMetricsConstants.TYPE_ENTITY_INFO)
|
entityInfo.get(ApplicationMetricsConstants.TYPE_ENTITY_INFO)
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
if (entityInfo.containsKey(ApplicationMetricsConstants.APP_CPU_METRICS)) {
|
||||||
|
long vcoreSeconds=Long.parseLong(entityInfo.get(
|
||||||
|
ApplicationMetricsConstants.APP_CPU_METRICS).toString());
|
||||||
|
long memorySeconds=Long.parseLong(entityInfo.get(
|
||||||
|
ApplicationMetricsConstants.APP_MEM_METRICS).toString());
|
||||||
|
appResources=ApplicationResourceUsageReport
|
||||||
|
.newInstance(0, 0, null, null, null, memorySeconds, vcoreSeconds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
List<TimelineEvent> events = entity.getEvents();
|
List<TimelineEvent> events = entity.getEvents();
|
||||||
if (events != null) {
|
if (events != null) {
|
||||||
@ -310,7 +320,7 @@ private static ApplicationReportExt convertToApplicationReport(
|
|||||||
return new ApplicationReportExt(ApplicationReport.newInstance(
|
return new ApplicationReportExt(ApplicationReport.newInstance(
|
||||||
ConverterUtils.toApplicationId(entity.getEntityId()),
|
ConverterUtils.toApplicationId(entity.getEntityId()),
|
||||||
latestApplicationAttemptId, user, queue, name, null, -1, null, state,
|
latestApplicationAttemptId, user, queue, name, null, -1, null, state,
|
||||||
diagnosticsInfo, null, createdTime, finishedTime, finalStatus, null,
|
diagnosticsInfo, null, createdTime, finishedTime, finalStatus, appResources,
|
||||||
null, 1.0F, type, null), appViewACLs);
|
null, 1.0F, type, null), appViewACLs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,10 @@ public void testApplicationReport() throws IOException, YarnException {
|
|||||||
clientService.getClientHandler().getApplicationReport(request);
|
clientService.getClientHandler().getApplicationReport(request);
|
||||||
ApplicationReport appReport = response.getApplicationReport();
|
ApplicationReport appReport = response.getApplicationReport();
|
||||||
Assert.assertNotNull(appReport);
|
Assert.assertNotNull(appReport);
|
||||||
|
Assert.assertEquals(123, appReport.getApplicationResourceUsageReport()
|
||||||
|
.getMemorySeconds());
|
||||||
|
Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
|
||||||
|
.getVcoreSeconds());
|
||||||
Assert.assertEquals("application_0_0001", appReport.getApplicationId()
|
Assert.assertEquals("application_0_0001", appReport.getApplicationId()
|
||||||
.toString());
|
.toString());
|
||||||
Assert.assertEquals("test app type",
|
Assert.assertEquals("test app type",
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
|
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
||||||
|
import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerReport;
|
import org.apache.hadoop.yarn.api.records.ContainerReport;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerState;
|
import org.apache.hadoop.yarn.api.records.ContainerState;
|
||||||
@ -201,6 +202,12 @@ public ApplicationReport run() throws Exception {
|
|||||||
app.getOriginalTrackingUrl());
|
app.getOriginalTrackingUrl());
|
||||||
Assert.assertEquals("test diagnostics info", app.getDiagnostics());
|
Assert.assertEquals("test diagnostics info", app.getDiagnostics());
|
||||||
}
|
}
|
||||||
|
ApplicationResourceUsageReport applicationResourceUsageReport =
|
||||||
|
app.getApplicationResourceUsageReport();
|
||||||
|
Assert.assertEquals(123,
|
||||||
|
applicationResourceUsageReport.getMemorySeconds());
|
||||||
|
Assert
|
||||||
|
.assertEquals(345, applicationResourceUsageReport.getVcoreSeconds());
|
||||||
Assert.assertEquals(FinalApplicationStatus.UNDEFINED,
|
Assert.assertEquals(FinalApplicationStatus.UNDEFINED,
|
||||||
app.getFinalApplicationStatus());
|
app.getFinalApplicationStatus());
|
||||||
Assert.assertEquals(YarnApplicationState.FINISHED,
|
Assert.assertEquals(YarnApplicationState.FINISHED,
|
||||||
@ -416,6 +423,8 @@ private static TimelineEntity createApplicationTimelineEntity(
|
|||||||
entityInfo.put(ApplicationMetricsConstants.QUEUE_ENTITY_INFO, "test queue");
|
entityInfo.put(ApplicationMetricsConstants.QUEUE_ENTITY_INFO, "test queue");
|
||||||
entityInfo.put(ApplicationMetricsConstants.SUBMITTED_TIME_ENTITY_INFO,
|
entityInfo.put(ApplicationMetricsConstants.SUBMITTED_TIME_ENTITY_INFO,
|
||||||
Integer.MAX_VALUE + 1L);
|
Integer.MAX_VALUE + 1L);
|
||||||
|
entityInfo.put(ApplicationMetricsConstants.APP_MEM_METRICS,123);
|
||||||
|
entityInfo.put(ApplicationMetricsConstants.APP_CPU_METRICS,345);
|
||||||
if (emptyACLs) {
|
if (emptyACLs) {
|
||||||
entityInfo.put(ApplicationMetricsConstants.APP_VIEW_ACLS_ENTITY_INFO, "");
|
entityInfo.put(ApplicationMetricsConstants.APP_VIEW_ACLS_ENTITY_INFO, "");
|
||||||
} else {
|
} else {
|
||||||
|
@ -64,6 +64,12 @@ public class ApplicationMetricsConstants {
|
|||||||
public static final String STATE_EVENT_INFO =
|
public static final String STATE_EVENT_INFO =
|
||||||
"YARN_APPLICATION_STATE";
|
"YARN_APPLICATION_STATE";
|
||||||
|
|
||||||
|
public static final String APP_CPU_METRICS =
|
||||||
|
"YARN_APPLICATION_CPU_METRIC";
|
||||||
|
|
||||||
|
public static final String APP_MEM_METRICS =
|
||||||
|
"YARN_APPLICATION_MEM_METRIC";
|
||||||
|
|
||||||
public static final String LATEST_APP_ATTEMPT_EVENT_INFO =
|
public static final String LATEST_APP_ATTEMPT_EVENT_INFO =
|
||||||
"YARN_APPLICATION_LATEST_APP_ATTEMPT";
|
"YARN_APPLICATION_LATEST_APP_ATTEMPT";
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
|
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
|
||||||
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppMetrics;
|
||||||
|
|
||||||
public class ApplicationFinishedEvent extends
|
public class ApplicationFinishedEvent extends
|
||||||
SystemMetricsEvent {
|
SystemMetricsEvent {
|
||||||
@ -31,6 +32,7 @@ public class ApplicationFinishedEvent extends
|
|||||||
private FinalApplicationStatus appStatus;
|
private FinalApplicationStatus appStatus;
|
||||||
private YarnApplicationState state;
|
private YarnApplicationState state;
|
||||||
private ApplicationAttemptId latestAppAttemptId;
|
private ApplicationAttemptId latestAppAttemptId;
|
||||||
|
private RMAppMetrics appMetrics;
|
||||||
|
|
||||||
public ApplicationFinishedEvent(
|
public ApplicationFinishedEvent(
|
||||||
ApplicationId appId,
|
ApplicationId appId,
|
||||||
@ -38,13 +40,15 @@ public ApplicationFinishedEvent(
|
|||||||
FinalApplicationStatus appStatus,
|
FinalApplicationStatus appStatus,
|
||||||
YarnApplicationState state,
|
YarnApplicationState state,
|
||||||
ApplicationAttemptId latestAppAttemptId,
|
ApplicationAttemptId latestAppAttemptId,
|
||||||
long finishedTime) {
|
long finishedTime,
|
||||||
|
RMAppMetrics appMetrics) {
|
||||||
super(SystemMetricsEventType.APP_FINISHED, finishedTime);
|
super(SystemMetricsEventType.APP_FINISHED, finishedTime);
|
||||||
this.appId = appId;
|
this.appId = appId;
|
||||||
this.diagnosticsInfo = diagnosticsInfo;
|
this.diagnosticsInfo = diagnosticsInfo;
|
||||||
this.appStatus = appStatus;
|
this.appStatus = appStatus;
|
||||||
this.latestAppAttemptId = latestAppAttemptId;
|
this.latestAppAttemptId = latestAppAttemptId;
|
||||||
this.state = state;
|
this.state = state;
|
||||||
|
this.appMetrics=appMetrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -72,4 +76,7 @@ public ApplicationAttemptId getLatestApplicationAttemptId() {
|
|||||||
return latestAppAttemptId;
|
return latestAppAttemptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RMAppMetrics getAppMetrics() {
|
||||||
|
return appMetrics;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.metrics.ContainerMetricsConstants;
|
import org.apache.hadoop.yarn.server.metrics.ContainerMetricsConstants;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.RMServerUtils;
|
import org.apache.hadoop.yarn.server.resourcemanager.RMServerUtils;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
||||||
|
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.RMAppState;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
|
||||||
@ -120,7 +121,8 @@ public void appFinished(RMApp app, RMAppState state, long finishedTime) {
|
|||||||
RMServerUtils.createApplicationState(state),
|
RMServerUtils.createApplicationState(state),
|
||||||
app.getCurrentAppAttempt() == null ?
|
app.getCurrentAppAttempt() == null ?
|
||||||
null : app.getCurrentAppAttempt().getAppAttemptId(),
|
null : app.getCurrentAppAttempt().getAppAttemptId(),
|
||||||
finishedTime));
|
finishedTime,
|
||||||
|
app.getRMAppMetrics()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,6 +278,12 @@ private void publishApplicationFinishedEvent(ApplicationFinishedEvent event) {
|
|||||||
eventInfo.put(ApplicationMetricsConstants.LATEST_APP_ATTEMPT_EVENT_INFO,
|
eventInfo.put(ApplicationMetricsConstants.LATEST_APP_ATTEMPT_EVENT_INFO,
|
||||||
event.getLatestApplicationAttemptId().toString());
|
event.getLatestApplicationAttemptId().toString());
|
||||||
}
|
}
|
||||||
|
RMAppMetrics appMetrics = event.getAppMetrics();
|
||||||
|
entity.addOtherInfo(ApplicationMetricsConstants.APP_CPU_METRICS,
|
||||||
|
appMetrics.getVcoreSeconds());
|
||||||
|
entity.addOtherInfo(ApplicationMetricsConstants.APP_MEM_METRICS,
|
||||||
|
appMetrics.getMemorySeconds());
|
||||||
|
|
||||||
tEvent.setEventInfo(eventInfo);
|
tEvent.setEventInfo(eventInfo);
|
||||||
entity.addEvent(tEvent);
|
entity.addEvent(tEvent);
|
||||||
putEntity(entity);
|
putEntity(entity);
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.metrics.ApplicationMetricsConstants;
|
import org.apache.hadoop.yarn.server.metrics.ApplicationMetricsConstants;
|
||||||
import org.apache.hadoop.yarn.server.metrics.ContainerMetricsConstants;
|
import org.apache.hadoop.yarn.server.metrics.ContainerMetricsConstants;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
||||||
|
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.RMAppState;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
|
||||||
@ -148,8 +149,18 @@ public void testPublishApplicationMetrics() throws Exception {
|
|||||||
entity.getOtherInfo().get(
|
entity.getOtherInfo().get(
|
||||||
ApplicationMetricsConstants.APP_VIEW_ACLS_ENTITY_INFO));
|
ApplicationMetricsConstants.APP_VIEW_ACLS_ENTITY_INFO));
|
||||||
} else {
|
} else {
|
||||||
Assert.assertEquals("", entity.getOtherInfo().get(
|
Assert.assertEquals(
|
||||||
ApplicationMetricsConstants.APP_VIEW_ACLS_ENTITY_INFO));
|
"",
|
||||||
|
entity.getOtherInfo().get(
|
||||||
|
ApplicationMetricsConstants.APP_VIEW_ACLS_ENTITY_INFO));
|
||||||
|
Assert.assertEquals(
|
||||||
|
app.getRMAppMetrics().getMemorySeconds(),
|
||||||
|
Long.parseLong(entity.getOtherInfo()
|
||||||
|
.get(ApplicationMetricsConstants.APP_MEM_METRICS).toString()));
|
||||||
|
Assert.assertEquals(
|
||||||
|
app.getRMAppMetrics().getVcoreSeconds(),
|
||||||
|
Long.parseLong(entity.getOtherInfo()
|
||||||
|
.get(ApplicationMetricsConstants.APP_CPU_METRICS).toString()));
|
||||||
}
|
}
|
||||||
boolean hasCreatedEvent = false;
|
boolean hasCreatedEvent = false;
|
||||||
boolean hasFinishedEvent = false;
|
boolean hasFinishedEvent = false;
|
||||||
@ -340,6 +351,8 @@ private static RMApp createRMApp(ApplicationId appId) {
|
|||||||
when(app.getCurrentAppAttempt()).thenReturn(appAttempt);
|
when(app.getCurrentAppAttempt()).thenReturn(appAttempt);
|
||||||
when(app.getFinalApplicationStatus()).thenReturn(
|
when(app.getFinalApplicationStatus()).thenReturn(
|
||||||
FinalApplicationStatus.UNDEFINED);
|
FinalApplicationStatus.UNDEFINED);
|
||||||
|
when(app.getRMAppMetrics()).thenReturn(
|
||||||
|
new RMAppMetrics(null, 0, 0, Integer.MAX_VALUE, Long.MAX_VALUE));
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user