コード例 #1
0
 public virtual void Names()
 {
     for (int i = 0; i < 20; ++i)
     {
         RenderText(MockApps.NewAppName() + "\n");
     }
 }
コード例 #2
0
ファイル: MockRMApp.cs プロジェクト: orf53975/hadoop.net
 public MockRMApp(int newid, long time, RMAppState newState)
 {
     // ms
     finish = time;
     id     = MockApps.NewAppID(newid);
     state  = newState;
 }
コード例 #3
0
ファイル: TestAppManager.cs プロジェクト: orf53975/hadoop.net
        /// <exception cref="System.Exception"/>
        public virtual void TestRMAppSubmitDuplicateApplicationId()
        {
            ApplicationId appId = MockApps.NewAppID(0);

            asContext.SetApplicationId(appId);
            RMApp appOrig = rmContext.GetRMApps()[appId];

            NUnit.Framework.Assert.IsTrue("app name matches but shouldn't", "testApp1" != appOrig
                                          .GetName());
            // our testApp1 should be rejected and original app with same id should be left in place
            try
            {
                appMonitor.SubmitApplication(asContext, "test");
                NUnit.Framework.Assert.Fail("Exception is expected when applicationId is duplicate."
                                            );
            }
            catch (YarnException e)
            {
                NUnit.Framework.Assert.IsTrue("The thrown exception is not the expectd one.", e.Message
                                              .Contains("Cannot add a duplicate!"));
            }
            // make sure original app didn't get removed
            RMApp app = rmContext.GetRMApps()[appId];

            NUnit.Framework.Assert.IsNotNull("app is null", app);
            NUnit.Framework.Assert.AreEqual("app id doesn't match", appId, app.GetApplicationId
                                                ());
            NUnit.Framework.Assert.AreEqual("app state doesn't match", RMAppState.Finished, app
                                            .GetState());
        }
コード例 #4
0
            public virtual void Names()
            {
                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < 8; ++i)
                {
                    sb.Append(MockApps.NewAppName()).Append(' ');
                }
                SetTitle(sb.ToString());
            }
コード例 #5
0
ファイル: TestAppManager.cs プロジェクト: orf53975/hadoop.net
        public virtual void SetUp()
        {
            long now = Runtime.CurrentTimeMillis();

            rmContext = MockRMContext(1, now - 10);
            ResourceScheduler        scheduler     = MockResourceScheduler();
            Configuration            conf          = new Configuration();
            ApplicationMasterService masterService = new ApplicationMasterService(rmContext,
                                                                                  scheduler);

            appMonitor = new TestAppManager.TestRMAppManager(this, rmContext, new ClientToAMTokenSecretManagerInRM
                                                                 (), scheduler, masterService, new ApplicationACLsManager(conf), conf);
            appId = MockApps.NewAppID(1);
            RecordFactory recordFactory = RecordFactoryProvider.GetRecordFactory(null);

            asContext = recordFactory.NewRecordInstance <ApplicationSubmissionContext>();
            asContext.SetApplicationId(appId);
            asContext.SetAMContainerSpec(MockContainerLaunchContext(recordFactory));
            asContext.SetResource(MockResource());
            SetupDispatcher(rmContext, conf);
        }
コード例 #6
0
ファイル: TestAppManager.cs プロジェクト: orf53975/hadoop.net
 /// <exception cref="System.Exception"/>
 public virtual void TestRMAppSubmitMaxAppAttempts()
 {
     int[]   globalMaxAppAttempts     = new int[] { 10, 1 };
     int[][] individualMaxAppAttempts = new int[][] { new int[] { 9, 10, 11, 0 }, new
                                                      int[] { 1, 10, 0, -1 } };
     int[][] expectedNums = new int[][] { new int[] { 9, 10, 10, 10 }, new int[] { 1,
                                                                                   1, 1, 1 } };
     for (int i = 0; i < globalMaxAppAttempts.Length; ++i)
     {
         for (int j = 0; j < individualMaxAppAttempts.Length; ++j)
         {
             ResourceScheduler scheduler = MockResourceScheduler();
             Configuration     conf      = new Configuration();
             conf.SetInt(YarnConfiguration.RmAmMaxAttempts, globalMaxAppAttempts[i]);
             ApplicationMasterService masterService = new ApplicationMasterService(rmContext,
                                                                                   scheduler);
             TestAppManager.TestRMAppManager appMonitor = new TestAppManager.TestRMAppManager(
                 this, rmContext, new ClientToAMTokenSecretManagerInRM(), scheduler, masterService
                 , new ApplicationACLsManager(conf), conf);
             ApplicationId appID = MockApps.NewAppID(i * 4 + j + 1);
             asContext.SetApplicationId(appID);
             if (individualMaxAppAttempts[i][j] != 0)
             {
                 asContext.SetMaxAppAttempts(individualMaxAppAttempts[i][j]);
             }
             appMonitor.SubmitApplication(asContext, "test");
             RMApp app = rmContext.GetRMApps()[appID];
             NUnit.Framework.Assert.AreEqual("max application attempts doesn't match", expectedNums
                                             [i][j], app.GetMaxAppAttempts());
             // wait for event to be processed
             int timeoutSecs = 0;
             while ((GetAppEventType() == RMAppEventType.Kill) && timeoutSecs++ < 20)
             {
                 Sharpen.Thread.Sleep(1000);
             }
             SetAppEventType(RMAppEventType.Kill);
         }
     }
 }