private static void MergeApplicationAttemptHistoryData(ApplicationAttemptHistoryData historyData, ApplicationAttemptStartData startData) { historyData.SetHost(startData.GetHost()); historyData.SetRPCPort(startData.GetRPCPort()); historyData.SetMasterContainerId(startData.GetMasterContainerId()); }
public WritingApplicationAttemptStartEvent(ApplicationAttemptId appAttemptId, ApplicationAttemptStartData appAttemptStart) : base(WritingHistoryEventType.AppAttemptStart) { this.appAttemptId = appAttemptId; this.appAttemptStart = appAttemptStart; }
/// <exception cref="System.IO.IOException"/> public virtual void ApplicationAttemptStarted(ApplicationAttemptStartData appAttemptStart ) { ConcurrentMap <ApplicationAttemptId, ApplicationAttemptHistoryData> subMap = GetSubMap (appAttemptStart.GetApplicationAttemptId().GetApplicationId()); ApplicationAttemptHistoryData oldData = subMap.PutIfAbsent(appAttemptStart.GetApplicationAttemptId (), ApplicationAttemptHistoryData.NewInstance(appAttemptStart.GetApplicationAttemptId (), appAttemptStart.GetHost(), appAttemptStart.GetRPCPort(), appAttemptStart.GetMasterContainerId (), null, null, null, null)); if (oldData != null) { throw new IOException("The start information of application attempt " + appAttemptStart .GetApplicationAttemptId() + " is already stored."); } }
/// <exception cref="System.IO.IOException"/> public virtual void ApplicationAttemptStarted(ApplicationAttemptStartData appAttemptStart ) { FileSystemApplicationHistoryStore.HistoryFileWriter hfWriter = GetHistoryFileWriter (appAttemptStart.GetApplicationAttemptId().GetApplicationId()); System.Diagnostics.Debug.Assert(appAttemptStart is ApplicationAttemptStartDataPBImpl ); try { hfWriter.WriteHistoryData(new FileSystemApplicationHistoryStore.HistoryDataKey(appAttemptStart .GetApplicationAttemptId().ToString(), StartDataSuffix), ((ApplicationAttemptStartDataPBImpl )appAttemptStart).GetProto().ToByteArray()); Log.Info("Start information of application attempt " + appAttemptStart.GetApplicationAttemptId () + " is written"); } catch (IOException e) { Log.Error("Error when writing start information of application attempt " + appAttemptStart .GetApplicationAttemptId(), e); throw; } }
/// <exception cref="System.IO.IOException"/> public virtual ApplicationAttemptHistoryData GetApplicationAttempt(ApplicationAttemptId appAttemptId) { FileSystemApplicationHistoryStore.HistoryFileReader hfReader = GetHistoryFileReader (appAttemptId.GetApplicationId()); try { bool readStartData = false; bool readFinishData = false; ApplicationAttemptHistoryData historyData = ApplicationAttemptHistoryData.NewInstance (appAttemptId, null, -1, null, null, null, FinalApplicationStatus.Undefined, null ); while ((!readStartData || !readFinishData) && hfReader.HasNext()) { FileSystemApplicationHistoryStore.HistoryFileReader.Entry entry = hfReader.Next(); if (entry.key.id.Equals(appAttemptId.ToString())) { if (entry.key.suffix.Equals(StartDataSuffix)) { ApplicationAttemptStartData startData = ParseApplicationAttemptStartData(entry.value ); MergeApplicationAttemptHistoryData(historyData, startData); readStartData = true; } else { if (entry.key.suffix.Equals(FinishDataSuffix)) { ApplicationAttemptFinishData finishData = ParseApplicationAttemptFinishData(entry .value); MergeApplicationAttemptHistoryData(historyData, finishData); readFinishData = true; } } } } if (!readStartData && !readFinishData) { return(null); } if (!readStartData) { Log.Warn("Start information is missing for application attempt " + appAttemptId); } if (!readFinishData) { Log.Warn("Finish information is missing for application attempt " + appAttemptId); } Log.Info("Completed reading history information of application attempt " + appAttemptId ); return(historyData); } catch (IOException e) { Log.Error("Error when reading history file of application attempt" + appAttemptId , e); throw; } finally { hfReader.Close(); } }
/// <exception cref="System.IO.IOException"/> public virtual void ApplicationAttemptStarted(ApplicationAttemptStartData appAttemptStart ) { }
public virtual void ApplicationAttemptStarted(RMAppAttempt appAttempt) { if (historyServiceEnabled) { dispatcher.GetEventHandler().Handle(new WritingApplicationAttemptStartEvent(appAttempt .GetAppAttemptId(), ApplicationAttemptStartData.NewInstance(appAttempt.GetAppAttemptId (), appAttempt.GetHost(), appAttempt.GetRpcPort(), appAttempt.GetMasterContainer ().GetId()))); } }
/// <exception cref="System.IO.IOException"/> protected internal virtual void WriteApplicationAttemptStartData(ApplicationAttemptId appAttemptId) { store.ApplicationAttemptStarted(ApplicationAttemptStartData.NewInstance(appAttemptId , appAttemptId.ToString(), 0, ContainerId.NewContainerId(appAttemptId, 1))); }