Ejemplo n.º 1
0
        /// <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();
            }
        }
Ejemplo n.º 2
0
 public virtual void TestPreserveContainersOnResyncKeepingContainers()
 {
     TestNodeManagerResync.TestNodeManager1 nm = new TestNodeManagerResync.TestNodeManager1
                                                     (this, true);
     TestContainerPreservationOnResyncImpl(nm, true);
 }
Ejemplo n.º 3
0
 public virtual void TestKillContainersOnResync()
 {
     TestNodeManagerResync.TestNodeManager1 nm = new TestNodeManagerResync.TestNodeManager1
                                                     (this, false);
     TestContainerPreservationOnResyncImpl(nm, false);
 }