public AMAttemptInfo(AMInfo amInfo, string jobId, string user) { this.nodeHttpAddress = string.Empty; this.nodeId = string.Empty; string nmHost = amInfo.GetNodeManagerHost(); int nmHttpPort = amInfo.GetNodeManagerHttpPort(); int nmPort = amInfo.GetNodeManagerPort(); if (nmHost != null) { this.nodeHttpAddress = nmHost + ":" + nmHttpPort; NodeId nodeId = NodeId.NewInstance(nmHost, nmPort); this.nodeId = nodeId.ToString(); } this.id = amInfo.GetAppAttemptId().GetAttemptId(); this.startTime = amInfo.GetStartTime(); this.containerId = string.Empty; this.logsLink = string.Empty; ContainerId containerId = amInfo.GetContainerId(); if (containerId != null) { this.containerId = containerId.ToString(); this.logsLink = StringHelper.Join(MRWebAppUtil.GetYARNWebappScheme() + nodeHttpAddress , StringHelper.Ujoin("node", "containerlogs", this.containerId, user)); } }
public AMAttemptInfo(AMInfo amInfo, string jobId, string user, string host, string pathPrefix) { this.nodeHttpAddress = string.Empty; this.nodeId = string.Empty; string nmHost = amInfo.GetNodeManagerHost(); int nmHttpPort = amInfo.GetNodeManagerHttpPort(); int nmPort = amInfo.GetNodeManagerPort(); if (nmHost != null) { this.nodeHttpAddress = nmHost + ":" + nmHttpPort; NodeId nodeId = NodeId.NewInstance(nmHost, nmPort); this.nodeId = nodeId.ToString(); } this.id = amInfo.GetAppAttemptId().GetAttemptId(); this.startTime = amInfo.GetStartTime(); this.containerId = string.Empty; this.logsLink = string.Empty; this.shortLogsLink = string.Empty; ContainerId containerId = amInfo.GetContainerId(); if (containerId != null) { this.containerId = containerId.ToString(); this.logsLink = StringHelper.Join(host, pathPrefix, StringHelper.Ujoin("logs", this .nodeId, this.containerId, jobId, user)); this.shortLogsLink = StringHelper.Ujoin("logs", this.nodeId, this.containerId, jobId , user); } }
/// <exception cref="System.IO.IOException"/> public virtual LogParams GetLogFilePath(JobID oldJobID, TaskAttemptID oldTaskAttemptID ) { JobId jobId = TypeConverter.ToYarn(oldJobID); GetJobReportRequest request = recordFactory.NewRecordInstance <GetJobReportRequest >(); request.SetJobId(jobId); JobReport report = ((GetJobReportResponse)Invoke("getJobReport", typeof(GetJobReportRequest ), request)).GetJobReport(); if (EnumSet.Of(JobState.Succeeded, JobState.Failed, JobState.Killed, JobState.Error ).Contains(report.GetJobState())) { if (oldTaskAttemptID != null) { GetTaskAttemptReportRequest taRequest = recordFactory.NewRecordInstance <GetTaskAttemptReportRequest >(); taRequest.SetTaskAttemptId(TypeConverter.ToYarn(oldTaskAttemptID)); TaskAttemptReport taReport = ((GetTaskAttemptReportResponse)Invoke("getTaskAttemptReport" , typeof(GetTaskAttemptReportRequest), taRequest)).GetTaskAttemptReport(); if (taReport.GetContainerId() == null || taReport.GetNodeManagerHost() == null) { throw new IOException("Unable to get log information for task: " + oldTaskAttemptID ); } return(new LogParams(taReport.GetContainerId().ToString(), taReport.GetContainerId ().GetApplicationAttemptId().GetApplicationId().ToString(), NodeId.NewInstance(taReport .GetNodeManagerHost(), taReport.GetNodeManagerPort()).ToString(), report.GetUser ())); } else { if (report.GetAMInfos() == null || report.GetAMInfos().Count == 0) { throw new IOException("Unable to get log information for job: " + oldJobID); } AMInfo amInfo = report.GetAMInfos()[report.GetAMInfos().Count - 1]; return(new LogParams(amInfo.GetContainerId().ToString(), amInfo.GetAppAttemptId() .GetApplicationId().ToString(), NodeId.NewInstance(amInfo.GetNodeManagerHost(), amInfo.GetNodeManagerPort()).ToString(), report.GetUser())); } } else { throw new IOException("Cannot get log path for a in-progress job"); } }
private void VerifyJobReport(JobReport jobReport, JobId jobId) { IList <AMInfo> amInfos = jobReport.GetAMInfos(); NUnit.Framework.Assert.AreEqual(1, amInfos.Count); AMInfo amInfo = amInfos[0]; ApplicationAttemptId appAttemptId = ApplicationAttemptId.NewInstance(jobId.GetAppId (), 1); ContainerId amContainerId = ContainerId.NewContainerId(appAttemptId, 1); NUnit.Framework.Assert.AreEqual(appAttemptId, amInfo.GetAppAttemptId()); NUnit.Framework.Assert.AreEqual(amContainerId, amInfo.GetContainerId()); NUnit.Framework.Assert.IsTrue(jobReport.GetSubmitTime() > 0); NUnit.Framework.Assert.IsTrue(jobReport.GetStartTime() > 0 && jobReport.GetStartTime () >= jobReport.GetSubmitTime()); NUnit.Framework.Assert.IsTrue(jobReport.GetFinishTime() > 0 && jobReport.GetFinishTime () >= jobReport.GetStartTime()); }
// pass private void VerifyJobReport(JobReport jr) { NUnit.Framework.Assert.IsNotNull("JobReport is null", jr); IList <AMInfo> amInfos = jr.GetAMInfos(); NUnit.Framework.Assert.AreEqual(1, amInfos.Count); NUnit.Framework.Assert.AreEqual(JobState.Running, jr.GetJobState()); AMInfo amInfo = amInfos[0]; NUnit.Framework.Assert.AreEqual(MRApp.NmHost, amInfo.GetNodeManagerHost()); NUnit.Framework.Assert.AreEqual(MRApp.NmPort, amInfo.GetNodeManagerPort()); NUnit.Framework.Assert.AreEqual(MRApp.NmHttpPort, amInfo.GetNodeManagerHttpPort() ); NUnit.Framework.Assert.AreEqual(1, amInfo.GetAppAttemptId().GetAttemptId()); NUnit.Framework.Assert.AreEqual(1, amInfo.GetContainerId().GetApplicationAttemptId ().GetAttemptId()); NUnit.Framework.Assert.IsTrue(amInfo.GetStartTime() > 0); NUnit.Framework.Assert.AreEqual(false, jr.IsUber()); }