// This test tests new container requests are blocked when NM starts from // scratch until it register with RM AND while NM is resyncing with RM /// <exception cref="System.IO.IOException"/> /// <exception cref="System.Exception"/> /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> public virtual void TestBlockNewContainerRequestsOnStartAndResync() { NodeManager nm = new TestNodeManagerResync.TestNodeManager2(this); YarnConfiguration conf = CreateNMConfig(); conf.SetBoolean(YarnConfiguration.RmWorkPreservingRecoveryEnabled, false); nm.Init(conf); nm.Start(); // Start the container in running state ContainerId cId = TestNodeManagerShutdown.CreateContainerId(); TestNodeManagerShutdown.StartContainer(nm, cId, localFS, tmpDir, processStartFile ); nm.GetNMDispatcher().GetEventHandler().Handle(new NodeManagerEvent(NodeManagerEventType .Resync)); try { syncBarrier.Await(); } catch (BrokenBarrierException) { } NUnit.Framework.Assert.IsFalse(assertionFailedInThread.Get()); nm.Stop(); }
/// <exception cref="System.IO.IOException"/> /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> /// <exception cref="System.Exception"/> protected internal virtual void TestContainerPreservationOnResyncImpl(TestNodeManagerResync.TestNodeManager1 nm, bool isWorkPreservingRestartEnabled) { YarnConfiguration conf = CreateNMConfig(); conf.SetBoolean(YarnConfiguration.RmWorkPreservingRecoveryEnabled, isWorkPreservingRestartEnabled ); try { nm.Init(conf); nm.Start(); ContainerId cId = TestNodeManagerShutdown.CreateContainerId(); TestNodeManagerShutdown.StartContainer(nm, cId, localFS, tmpDir, processStartFile ); nm.SetExistingContainerId(cId); NUnit.Framework.Assert.AreEqual(1, ((TestNodeManagerResync.TestNodeManager1)nm).GetNMRegistrationCount ()); nm.GetNMDispatcher().GetEventHandler().Handle(resyncEvent); try { syncBarrier.Await(); } catch (BrokenBarrierException) { } NUnit.Framework.Assert.AreEqual(2, ((TestNodeManagerResync.TestNodeManager1)nm).GetNMRegistrationCount ()); // Only containers should be killed on resync, apps should lie around. // That way local resources for apps can be used beyond resync without // relocalization NUnit.Framework.Assert.IsTrue(nm.GetNMContext().GetApplications().Contains(cId.GetApplicationAttemptId ().GetApplicationId())); NUnit.Framework.Assert.IsFalse(assertionFailedInThread.Get()); } finally { nm.Stop(); } }
internal TestNodeManager(TestNodeManagerShutdown _enclosing) { this._enclosing = _enclosing; }