Пример #1
0
 /// <summary>Process resource update on a node.</summary>
 public virtual void UpdateNodeResource(RMNode nm, ResourceOption resourceOption)
 {
     lock (this)
     {
         SchedulerNode node = GetSchedulerNode(nm.GetNodeID());
         Org.Apache.Hadoop.Yarn.Api.Records.Resource newResource = resourceOption.GetResource
                                                                       ();
         Org.Apache.Hadoop.Yarn.Api.Records.Resource oldResource = node.GetTotalResource();
         if (!oldResource.Equals(newResource))
         {
             // Log resource change
             Log.Info("Update resource on node: " + node.GetNodeName() + " from: " + oldResource
                      + ", to: " + newResource);
             Sharpen.Collections.Remove(nodes, nm.GetNodeID());
             UpdateMaximumAllocation(node, false);
             // update resource to node
             node.SetTotalResource(newResource);
             nodes[nm.GetNodeID()] = (N)node;
             UpdateMaximumAllocation(node, true);
             // update resource to clusterResource
             Resources.SubtractFrom(clusterResource, oldResource);
             Resources.AddTo(clusterResource, newResource);
         }
         else
         {
             // Log resource change
             Log.Warn("Update resource on node: " + node.GetNodeName() + " with the same resource: "
                      + newResource);
         }
     }
 }
        private SchedulerNode CreateNode()
        {
            SchedulerNode node = Org.Mockito.Mockito.Mock <SchedulerNode>();

            Org.Mockito.Mockito.When(node.GetNodeName()).ThenReturn("somehost");
            Org.Mockito.Mockito.When(node.GetRackName()).ThenReturn("somerack");
            Org.Mockito.Mockito.When(node.GetNodeID()).ThenReturn(nodeId);
            return(node);
        }
Пример #3
0
 public static bool IsBlacklisted(SchedulerApplicationAttempt application, SchedulerNode
                                  node, Log Log)
 {
     if (application.IsBlacklisted(node.GetNodeName()))
     {
         if (Log.IsDebugEnabled())
         {
             Log.Debug("Skipping 'host' " + node.GetNodeName() + " for " + application.GetApplicationId
                           () + " since it has been blacklisted");
         }
         return(true);
     }
     if (application.IsBlacklisted(node.GetRackName()))
     {
         if (Log.IsDebugEnabled())
         {
             Log.Debug("Skipping 'rack' " + node.GetRackName() + " for " + application.GetApplicationId
                           () + " since it has been blacklisted");
         }
         return(true);
     }
     return(false);
 }
Пример #4
0
 /// <summary>
 /// The
 /// <see cref="ResourceScheduler"/>
 /// is allocating data-local resources to the
 /// application.
 /// </summary>
 /// <param name="allocatedContainers">resources allocated to the application</param>
 private void AllocateNodeLocal(SchedulerNode node, Priority priority, ResourceRequest
                                nodeLocalRequest, Container container, IList <ResourceRequest> resourceRequests)
 {
     lock (this)
     {
         // Update future requirements
         DecResourceRequest(node.GetNodeName(), priority, nodeLocalRequest);
         ResourceRequest rackLocalRequest = requests[priority][node.GetRackName()];
         DecResourceRequest(node.GetRackName(), priority, rackLocalRequest);
         ResourceRequest offRackRequest = requests[priority][ResourceRequest.Any];
         DecrementOutstanding(offRackRequest);
         // Update cloned NodeLocal, RackLocal and OffRack requests for recovery
         resourceRequests.AddItem(CloneResourceRequest(nodeLocalRequest));
         resourceRequests.AddItem(CloneResourceRequest(rackLocalRequest));
         resourceRequests.AddItem(CloneResourceRequest(offRackRequest));
     }
 }