use of org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptMetrics in project hadoop by apache.
the class FairSchedulerTestBase method createMockRMApp.
protected RMApp createMockRMApp(ApplicationAttemptId attemptId) {
RMApp app = mock(RMAppImpl.class);
when(app.getApplicationId()).thenReturn(attemptId.getApplicationId());
RMAppAttemptImpl attempt = mock(RMAppAttemptImpl.class);
when(attempt.getAppAttemptId()).thenReturn(attemptId);
RMAppAttemptMetrics attemptMetric = mock(RMAppAttemptMetrics.class);
when(attempt.getRMAppAttemptMetrics()).thenReturn(attemptMetric);
when(app.getCurrentAppAttempt()).thenReturn(attempt);
ApplicationSubmissionContext submissionContext = mock(ApplicationSubmissionContext.class);
when(submissionContext.getUnmanagedAM()).thenReturn(false);
when(attempt.getSubmissionContext()).thenReturn(submissionContext);
resourceManager.getRMContext().getRMApps().put(attemptId.getApplicationId(), app);
return app;
}
use of org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptMetrics in project hadoop by apache.
the class RMStateStore method storeNewApplicationAttempt.
@SuppressWarnings("unchecked")
public /**
* Non-blocking API
* ResourceManager services call this to store state on an application attempt
* This does not block the dispatcher threads
* RMAppAttemptStoredEvent will be sent on completion to notify the RMAppAttempt
*/
void storeNewApplicationAttempt(RMAppAttempt appAttempt) {
Credentials credentials = getCredentialsFromAppAttempt(appAttempt);
RMAppAttemptMetrics attempMetrics = appAttempt.getRMAppAttemptMetrics();
AggregateAppResourceUsage resUsage = attempMetrics.getAggregateAppResourceUsage();
ApplicationAttemptStateData attemptState = ApplicationAttemptStateData.newInstance(appAttempt.getAppAttemptId(), appAttempt.getMasterContainer(), credentials, appAttempt.getStartTime(), resUsage.getMemorySeconds(), resUsage.getVcoreSeconds(), attempMetrics.getPreemptedMemory(), attempMetrics.getPreemptedVcore());
getRMStateStoreEventHandler().handle(new RMStateStoreAppAttemptEvent(attemptState));
}
Aggregations