Beispiel #1
0
 public virtual void Move(Queue newQueue)
 {
     lock (this)
     {
         QueueMetrics oldMetrics = queue.GetMetrics();
         QueueMetrics newMetrics = newQueue.GetMetrics();
         foreach (IDictionary <string, ResourceRequest> asks in requests.Values)
         {
             ResourceRequest request = asks[ResourceRequest.Any];
             if (request != null)
             {
                 oldMetrics.DecrPendingResources(user, request.GetNumContainers(), request.GetCapability
                                                     ());
                 newMetrics.IncrPendingResources(user, request.GetNumContainers(), request.GetCapability
                                                     ());
             }
         }
         oldMetrics.MoveAppFrom(this);
         newMetrics.MoveAppTo(this);
         activeUsersManager.DeactivateApplication(user, applicationId);
         activeUsersManager = newQueue.GetActiveUsersManager();
         activeUsersManager.ActivateApplication(user, applicationId);
         this.queue     = newQueue;
         this.queueName = newQueue.GetQueueName();
     }
 }
Beispiel #2
0
 public SchedulerApplicationAttempt(ApplicationAttemptId applicationAttemptId, string
                                    user, Queue queue, ActiveUsersManager activeUsersManager, RMContext rmContext)
 {
     // This pendingRelease is used in work-preserving recovery scenario to keep
     // track of the AM's outstanding release requests. RM on recovery could
     // receive the release request form AM before it receives the container status
     // from NM for recovery. In this case, the to-be-recovered containers reported
     // by NM should not be recovered.
     // Time of the last container scheduled at the current allowed level
     Preconditions.CheckNotNull(rmContext, "RMContext should not be null");
     this.rmContext         = rmContext;
     this.appSchedulingInfo = new AppSchedulingInfo(applicationAttemptId, user, queue,
                                                    activeUsersManager, rmContext.GetEpoch());
     this.queue          = queue;
     this.pendingRelease = new HashSet <ContainerId>();
     this.attemptId      = applicationAttemptId;
     if (rmContext.GetRMApps() != null && rmContext.GetRMApps().Contains(applicationAttemptId
                                                                         .GetApplicationId()))
     {
         ApplicationSubmissionContext appSubmissionContext = rmContext.GetRMApps()[applicationAttemptId
                                                                                   .GetApplicationId()].GetApplicationSubmissionContext();
         if (appSubmissionContext != null)
         {
             unmanagedAM = appSubmissionContext.GetUnmanagedAM();
             this.logAggregationContext = appSubmissionContext.GetLogAggregationContext();
         }
     }
 }
        private Queue CreateQueue(string name, Queue parent)
        {
            QueueMetrics       metrics            = QueueMetrics.ForQueue(name, parent, false, conf);
            ActiveUsersManager activeUsersManager = new ActiveUsersManager(metrics);
            Queue queue = Org.Mockito.Mockito.Mock <Queue>();

            Org.Mockito.Mockito.When(queue.GetMetrics()).ThenReturn(metrics);
            Org.Mockito.Mockito.When(queue.GetActiveUsersManager()).ThenReturn(activeUsersManager
                                                                               );
            return(queue);
        }
Beispiel #4
0
 public AppSchedulingInfo(ApplicationAttemptId appAttemptId, string user, Queue queue
                          , ActiveUsersManager activeUsersManager, long epoch)
 {
     // TODO making containerIdCounter long
     //private final ApplicationStore store;
     /* Allocated by scheduler */
     // for app metrics
     this.applicationAttemptId = appAttemptId;
     this.applicationId        = appAttemptId.GetApplicationId();
     this.queue              = queue;
     this.queueName          = queue.GetQueueName();
     this.user               = user;
     this.activeUsersManager = activeUsersManager;
     this.containerIdCounter = new AtomicLong(epoch << EpochBitShift);
 }