public virtual void TestWriteApplication() { RMApp app = CreateRMApp(ApplicationId.NewInstance(0, 1)); writer.ApplicationStarted(app); ApplicationHistoryData appHD = null; for (int i = 0; i < MaxRetries; ++i) { appHD = store.GetApplication(ApplicationId.NewInstance(0, 1)); if (appHD != null) { break; } else { Sharpen.Thread.Sleep(100); } } NUnit.Framework.Assert.IsNotNull(appHD); NUnit.Framework.Assert.AreEqual("test app", appHD.GetApplicationName()); NUnit.Framework.Assert.AreEqual("test app type", appHD.GetApplicationType()); NUnit.Framework.Assert.AreEqual("test user", appHD.GetUser()); NUnit.Framework.Assert.AreEqual("test queue", appHD.GetQueue()); NUnit.Framework.Assert.AreEqual(0L, appHD.GetSubmitTime()); NUnit.Framework.Assert.AreEqual(1L, appHD.GetStartTime()); writer.ApplicationFinished(app, RMAppState.Finished); for (int i_1 = 0; i_1 < MaxRetries; ++i_1) { appHD = store.GetApplication(ApplicationId.NewInstance(0, 1)); if (appHD.GetYarnApplicationState() != null) { break; } else { Sharpen.Thread.Sleep(100); } } NUnit.Framework.Assert.AreEqual(2L, appHD.GetFinishTime()); NUnit.Framework.Assert.AreEqual("test diagnostics info", appHD.GetDiagnosticsInfo ()); NUnit.Framework.Assert.AreEqual(FinalApplicationStatus.Undefined, appHD.GetFinalApplicationStatus ()); NUnit.Framework.Assert.AreEqual(YarnApplicationState.Finished, appHD.GetYarnApplicationState ()); }
/// <exception cref="System.IO.IOException"/> public virtual void ApplicationFinished(ApplicationFinishData appFinish) { ApplicationHistoryData data = applicationData[appFinish.GetApplicationId()]; if (data == null) { throw new IOException("The finish information of application " + appFinish.GetApplicationId () + " is stored before the start" + " information."); } // Make the assumption that YarnApplicationState should not be null if // the finish information is already recorded if (data.GetYarnApplicationState() != null) { throw new IOException("The finish information of application " + appFinish.GetApplicationId () + " is already stored."); } data.SetFinishTime(appFinish.GetFinishTime()); data.SetDiagnosticsInfo(appFinish.GetDiagnosticsInfo()); data.SetFinalApplicationStatus(appFinish.GetFinalApplicationStatus()); data.SetYarnApplicationState(appFinish.GetYarnApplicationState()); }
/// <exception cref="System.IO.IOException"/> private ApplicationReport ConvertToApplicationReport(ApplicationHistoryData appHistory ) { ApplicationAttemptId currentApplicationAttemptId = null; string trackingUrl = Unavailable; string host = Unavailable; int rpcPort = -1; ApplicationAttemptHistoryData lastAttempt = GetLastAttempt(appHistory.GetApplicationId ()); if (lastAttempt != null) { currentApplicationAttemptId = lastAttempt.GetApplicationAttemptId(); trackingUrl = lastAttempt.GetTrackingURL(); host = lastAttempt.GetHost(); rpcPort = lastAttempt.GetRPCPort(); } return(ApplicationReport.NewInstance(appHistory.GetApplicationId(), currentApplicationAttemptId , appHistory.GetUser(), appHistory.GetQueue(), appHistory.GetApplicationName(), host, rpcPort, null, appHistory.GetYarnApplicationState(), appHistory.GetDiagnosticsInfo (), trackingUrl, appHistory.GetStartTime(), appHistory.GetFinishTime(), appHistory .GetFinalApplicationStatus(), null, string.Empty, 100, appHistory.GetApplicationType (), null)); }