use of org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest in project hadoop by apache.
the class TestApplicationHistoryClientService method testApplicationNotFound.
@Test
public void testApplicationNotFound() throws IOException, YarnException {
ApplicationId appId = null;
appId = ApplicationId.newInstance(0, MAX_APPS + 1);
GetApplicationReportRequest request = GetApplicationReportRequest.newInstance(appId);
try {
@SuppressWarnings("unused") GetApplicationReportResponse response = clientService.getApplicationReport(request);
Assert.fail("Exception should have been thrown before we reach here.");
} catch (ApplicationNotFoundException e) {
//This exception is expected.
Assert.assertTrue(e.getMessage().contains("doesn't exist in the timeline store"));
} catch (Exception e) {
Assert.fail("Undesired exception caught");
}
}
use of org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest in project hadoop by apache.
the class AHSClientImpl method getApplicationReport.
@Override
public ApplicationReport getApplicationReport(ApplicationId appId) throws YarnException, IOException {
GetApplicationReportRequest request = GetApplicationReportRequest.newInstance(appId);
GetApplicationReportResponse response = ahsClient.getApplicationReport(request);
return response.getApplicationReport();
}
use of org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest in project hadoop by apache.
the class TestRMRestart method verifyAppReportAfterRMRestart.
private ApplicationReport verifyAppReportAfterRMRestart(RMApp app, MockRM rm) throws Exception {
GetApplicationReportRequest reportRequest = GetApplicationReportRequest.newInstance(app.getApplicationId());
GetApplicationReportResponse response = rm.getClientRMService().getApplicationReport(reportRequest);
ApplicationReport report = response.getApplicationReport();
Assert.assertEquals(app.getStartTime(), report.getStartTime());
Assert.assertEquals(app.getFinishTime(), report.getFinishTime());
Assert.assertEquals(app.createApplicationState(), report.getYarnApplicationState());
Assert.assertTrue(1 == report.getProgress());
return response.getApplicationReport();
}
use of org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest in project hadoop by apache.
the class TestRM method testInvalidatedAMHostPortOnAMRestart.
@Test(timeout = 60000)
public void testInvalidatedAMHostPortOnAMRestart() throws Exception {
MockRM rm1 = new MockRM(conf);
rm1.start();
MockNM nm1 = new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
nm1.registerNode();
// a failed app
RMApp app2 = rm1.submitApp(200);
MockAM am2 = MockRM.launchAndRegisterAM(app2, rm1, nm1);
nm1.nodeHeartbeat(am2.getApplicationAttemptId(), 1, ContainerState.COMPLETE);
rm1.waitForState(am2.getApplicationAttemptId(), RMAppAttemptState.FAILED);
rm1.waitForState(app2.getApplicationId(), RMAppState.ACCEPTED);
// before new attempt is launched, the app report returns the invalid AM
// host and port.
GetApplicationReportRequest request1 = GetApplicationReportRequest.newInstance(app2.getApplicationId());
ApplicationReport report1 = rm1.getClientRMService().getApplicationReport(request1).getApplicationReport();
Assert.assertEquals("N/A", report1.getHost());
Assert.assertEquals(-1, report1.getRpcPort());
}
use of org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest in project tez by apache.
the class TestShuffleHandlerJobs method testOrderedWordCount.
@Test(timeout = 300000)
public void testOrderedWordCount() throws Exception {
String inputDirStr = "/tmp/owc-input/";
Path inputDir = new Path(inputDirStr);
Path stagingDirPath = new Path("/tmp/owc-staging-dir");
remoteFs.mkdirs(inputDir);
remoteFs.mkdirs(stagingDirPath);
generateOrderedWordCountInput(inputDir, remoteFs);
String outputDirStr = "/tmp/owc-output/";
Path outputDir = new Path(outputDirStr);
TezConfiguration tezConf = new TezConfiguration(tezCluster.getConfig());
tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, stagingDirPath.toString());
tezConf.set(TezConfiguration.TEZ_AM_SHUFFLE_AUXILIARY_SERVICE_ID, ShuffleHandler.TEZ_SHUFFLE_SERVICEID);
tezConf.setBoolean(TezConfiguration.TEZ_AM_DAG_CLEANUP_ON_COMPLETION, true);
tezConf.setBoolean(TezConfiguration.TEZ_AM_SESSION_MODE, true);
tezConf.setBoolean(TezRuntimeConfiguration.TEZ_RUNTIME_OPTIMIZE_LOCAL_FETCH, false);
tezConf.setBoolean(TezConfiguration.TEZ_AM_CONTAINER_REUSE_ENABLED, false);
TezClient tezSession = TezClient.create("WordCountTest", tezConf);
tezSession.start();
try {
final OrderedWordCount job = new OrderedWordCount();
Assert.assertTrue("OrderedWordCount failed", job.run(tezConf, new String[] { "-counter", inputDirStr, outputDirStr, "10" }, tezSession) == 0);
verifyOutput(outputDir, remoteFs);
tezSession.stop();
ClientRMService rmService = tezCluster.getResourceManager().getClientRMService();
boolean isAppComplete = false;
while (!isAppComplete) {
GetApplicationReportResponse resp = rmService.getApplicationReport(new GetApplicationReportRequest() {
@Override
public ApplicationId getApplicationId() {
return job.getAppId();
}
@Override
public void setApplicationId(ApplicationId applicationId) {
}
});
if (resp.getApplicationReport().getYarnApplicationState() == YarnApplicationState.FINISHED) {
isAppComplete = true;
}
Thread.sleep(100);
}
for (int i = 0; i < NUM_NMS; i++) {
String appPath = tezCluster.getTestWorkDir() + "/" + this.getClass().getName() + "-localDir-nm-" + i + "_0/usercache/" + UserGroupInformation.getCurrentUser().getUserName() + "/appcache/" + job.getAppId();
String dagPathStr = appPath + "/dag_1";
File fs = new File(dagPathStr);
Assert.assertFalse(fs.exists());
fs = new File(appPath);
Assert.assertTrue(fs.exists());
}
} finally {
remoteFs.delete(stagingDirPath, true);
}
}
Aggregations