예제 #1
0
 public AppAttemptInfo(ResourceManager rm, RMAppAttempt attempt, string user, string
                       schemePrefix)
 {
     this.startTime        = 0;
     this.containerId      = string.Empty;
     this.nodeHttpAddress  = string.Empty;
     this.nodeId           = string.Empty;
     this.logsLink         = string.Empty;
     this.blacklistedNodes = string.Empty;
     if (attempt != null)
     {
         this.id        = attempt.GetAppAttemptId().GetAttemptId();
         this.startTime = attempt.GetStartTime();
         Container masterContainer = attempt.GetMasterContainer();
         if (masterContainer != null)
         {
             this.containerId     = masterContainer.GetId().ToString();
             this.nodeHttpAddress = masterContainer.GetNodeHttpAddress();
             this.nodeId          = masterContainer.GetNodeId().ToString();
             this.logsLink        = WebAppUtils.GetRunningLogURL(schemePrefix + masterContainer.GetNodeHttpAddress
                                                                     (), ConverterUtils.ToString(masterContainer.GetId()), user);
             if (rm.GetResourceScheduler() is AbstractYarnScheduler)
             {
                 AbstractYarnScheduler ayScheduler = (AbstractYarnScheduler)rm.GetResourceScheduler
                                                         ();
                 SchedulerApplicationAttempt sattempt = ayScheduler.GetApplicationAttempt(attempt.
                                                                                          GetAppAttemptId());
                 if (sattempt != null)
                 {
                     blacklistedNodes = StringUtils.Join(sattempt.GetBlacklistedNodes(), ", ");
                 }
             }
         }
     }
 }
        public static void InitializeRMContext(int numContainers, AbstractYarnScheduler scheduler
                                               , RMContext mockRMContext)
        {
            Org.Mockito.Mockito.When(mockRMContext.GetScheduler()).ThenReturn(scheduler);
            Resource r = CalculateClusterResource(numContainers);

            Org.Mockito.Mockito.DoReturn(r).When(scheduler).GetClusterResource();
        }
예제 #3
0
        public virtual void TestAddAndRemoveAppFromFiFoScheduler()
        {
            Configuration conf = new Configuration();

            conf.SetClass(YarnConfiguration.RmScheduler, typeof(FifoScheduler), typeof(ResourceScheduler
                                                                                       ));
            MockRM rm = new MockRM(conf);
            AbstractYarnScheduler <SchedulerApplicationAttempt, SchedulerNode> fs = (AbstractYarnScheduler
                                                                                     <SchedulerApplicationAttempt, SchedulerNode>)rm.GetResourceScheduler();

            TestSchedulerUtils.VerifyAppAddedAndRemovedFromScheduler(fs.GetSchedulerApplications
                                                                         (), fs, "queue");
        }
예제 #4
0
 public static ICollection <string> GetBlacklistedNodes(ResourceManager rm, ApplicationAttemptId
                                                        appid)
 {
     if (rm.GetResourceScheduler() is AbstractYarnScheduler)
     {
         AbstractYarnScheduler ayScheduler = (AbstractYarnScheduler)rm.GetResourceScheduler
                                                 ();
         SchedulerApplicationAttempt attempt = ayScheduler.GetApplicationAttempt(appid);
         if (attempt != null)
         {
             return(attempt.GetBlacklistedNodes());
         }
     }
     return(null);
 }