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); } }
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 virtual void TestAMInfosWithoutRecoveryEnabled() { int runCount = 0; MRApp app = new TestRecovery.MRAppWithHistory(1, 0, false, this.GetType().FullName , true, ++runCount); Configuration conf = new Configuration(); conf.SetBoolean(MRJobConfig.JobUbertaskEnable, false); Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job = app.Submit(conf); app.WaitForState(job, JobState.Running); long am1StartTime = app.GetAllAMInfos()[0].GetStartTime(); NUnit.Framework.Assert.AreEqual("No of tasks not correct", 1, job.GetTasks().Count ); IEnumerator <Task> it = job.GetTasks().Values.GetEnumerator(); Task mapTask = it.Next(); app.WaitForState(mapTask, TaskState.Running); TaskAttempt taskAttempt = mapTask.GetAttempts().Values.GetEnumerator().Next(); app.WaitForState(taskAttempt, TaskAttemptState.Running); // stop the app app.Stop(); // rerun app = new TestRecovery.MRAppWithHistory(1, 0, false, this.GetType().FullName, false , ++runCount); conf = new Configuration(); // in rerun the AMInfo will be recovered from previous run even if recovery // is not enabled. conf.SetBoolean(MRJobConfig.MrAmJobRecoveryEnable, false); conf.SetBoolean(MRJobConfig.JobUbertaskEnable, false); job = app.Submit(conf); app.WaitForState(job, JobState.Running); NUnit.Framework.Assert.AreEqual("No of tasks not correct", 1, job.GetTasks().Count ); it = job.GetTasks().Values.GetEnumerator(); mapTask = it.Next(); // There should be two AMInfos IList <AMInfo> amInfos = app.GetAllAMInfos(); NUnit.Framework.Assert.AreEqual(2, amInfos.Count); AMInfo amInfoOne = amInfos[0]; NUnit.Framework.Assert.AreEqual(am1StartTime, amInfoOne.GetStartTime()); app.Stop(); }
// 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()); }