Пример #1
0
        /// <summary>Validate killing an application when it is at accepted state.</summary>
        /// <exception cref="System.Exception">exception</exception>
        public virtual void TestApplicationKillAtAcceptedState()
        {
            Dispatcher dispatcher = new _AsyncDispatcher_573();
            MockRM     rm         = new _MockRM_596(dispatcher, conf);
            // test metrics
            QueueMetrics metrics       = rm.GetResourceScheduler().GetRootQueueMetrics();
            int          appsKilled    = metrics.GetAppsKilled();
            int          appsSubmitted = metrics.GetAppsSubmitted();

            rm.Start();
            MockNM nm1 = new MockNM("127.0.0.1:1234", 15120, rm.GetResourceTrackerService());

            nm1.RegisterNode();
            // a failed app
            RMApp  application = rm.SubmitApp(200);
            MockAM am          = MockRM.LaunchAM(application, rm, nm1);

            am.WaitForState(RMAppAttemptState.Launched);
            nm1.NodeHeartbeat(am.GetApplicationAttemptId(), 1, ContainerState.Running);
            rm.WaitForState(application.GetApplicationId(), RMAppState.Accepted);
            // Now kill the application before new attempt is launched, the app report
            // returns the invalid AM host and port.
            KillApplicationRequest request = KillApplicationRequest.NewInstance(application.GetApplicationId
                                                                                    ());

            rm.GetClientRMService().ForceKillApplication(request);
            // Specific test for YARN-1689 follows
            // Now let's say a race causes AM to register now. This should not crash RM.
            am.RegisterAppAttempt(false);
            // We explicitly intercepted the kill-event to RMAppAttempt, so app should
            // still be in KILLING state.
            rm.WaitForState(application.GetApplicationId(), RMAppState.Killing);
            // AM should now be in running
            rm.WaitForState(am.GetApplicationAttemptId(), RMAppAttemptState.Running);
            // Simulate that appAttempt is killed.
            rm.GetRMContext().GetDispatcher().GetEventHandler().Handle(new RMAppEvent(application
                                                                                      .GetApplicationId(), RMAppEventType.AttemptKilled));
            rm.WaitForState(application.GetApplicationId(), RMAppState.Killed);
            // test metrics
            metrics = rm.GetResourceScheduler().GetRootQueueMetrics();
            NUnit.Framework.Assert.AreEqual(appsKilled + 1, metrics.GetAppsKilled());
            NUnit.Framework.Assert.AreEqual(appsSubmitted + 1, metrics.GetAppsSubmitted());
        }
Пример #2
0
 internal _T946821583(_AsyncDispatcher_573 _enclosing)
 {
     this._enclosing = _enclosing;
 }