示例#1
0
 public virtual void SetResourceRequests(IList <ResourceRequest> requests)
 {
     try
     {
         writeLock.Lock();
         this.resourceRequests = requests;
     }
     finally
     {
         writeLock.Unlock();
     }
 }
示例#2
0
 private void _set(string label, ResourceUsage.ResourceType type, Org.Apache.Hadoop.Yarn.Api.Records.Resource
                   res)
 {
     try
     {
         writeLock.Lock();
         ResourceUsage.UsageByLabel usage = GetAndAddIfMissing(label);
         usage.resArr[type.idx] = res;
     }
     finally
     {
         writeLock.Unlock();
     }
 }
 public virtual void UpdatePreemptionInfo(Resource resource, RMContainer container
                                          )
 {
     try
     {
         writeLock.Lock();
         resourcePreempted = Resources.AddTo(resourcePreempted, resource);
     }
     finally
     {
         writeLock.Unlock();
     }
     if (!container.IsAMContainer())
     {
         // container got preempted is not a master container
         Log.Info(string.Format("Non-AM container preempted, current appAttemptId=%s, " +
                                "containerId=%s, resource=%s", attemptId, container.GetContainerId(), resource));
         numNonAMContainersPreempted.IncrementAndGet();
     }
     else
     {
         // container got preempted is a master container
         Log.Info(string.Format("AM container preempted, " + "current appAttemptId=%s, containerId=%s, resource=%s"
                                , attemptId, container.GetContainerId(), resource));
         isPreempted.Set(true);
     }
 }
 protected internal virtual void InitMaximumResourceCapability(Org.Apache.Hadoop.Yarn.Api.Records.Resource
                                                               maximumAllocation)
 {
     maxAllocWriteLock.Lock();
     try
     {
         if (this.configuredMaximumAllocation == null)
         {
             this.configuredMaximumAllocation = Resources.Clone(maximumAllocation);
             this.maximumAllocation           = Resources.Clone(maximumAllocation);
         }
     }
     finally
     {
         maxAllocWriteLock.Unlock();
     }
 }
示例#5
0
 private void _set(string label, QueueCapacities.CapacityType type, float value)
 {
     try
     {
         writeLock.Lock();
         QueueCapacities.Capacities cap = capacitiesMap[label];
         if (null == cap)
         {
             cap = new QueueCapacities.Capacities();
             capacitiesMap[label] = cap;
         }
         cap.capacitiesArr[type.idx] = value;
     }
     finally
     {
         writeLock.Unlock();
     }
 }
示例#6
0
 public virtual void Handle(NMClientAsyncImpl.ContainerEvent @event)
 {
     writeLock.Lock();
     try
     {
         try
         {
             this.stateMachine.DoTransition(@event.GetType(), @event);
         }
         catch (InvalidStateTransitonException e)
         {
             Log.Error("Can't handle this event at current state", e);
         }
     }
     finally
     {
         writeLock.Unlock();
     }
 }