Package org.apache.hadoop.yarn.server.resourcemanager.resource

Examples of org.apache.hadoop.yarn.server.resourcemanager.resource.ResourceWeights


   * Test that CPU works as well as memory
   */
  @Test
  public void testCPU() {
    scheds.add(new FakeSchedulable(Resources.createResource(0, 20),
        new ResourceWeights(2.0f)));
    scheds.add(new FakeSchedulable(Resources.createResource(0, 0),
        new ResourceWeights(1.0f)));
    scheds.add(new FakeSchedulable(Resources.createResource(0, 5),
        new ResourceWeights(1.0f)));
    scheds.add(new FakeSchedulable(Resources.createResource(0, 15),
        new ResourceWeights(0.5f)));
    ComputeFairShares.computeShares(scheds,
        Resources.createResource(0, 45), ResourceType.CPU);
    verifyCPUShares(20, 5, 5, 15);
  }
View Full Code Here


  }
 
  public FakeSchedulable(int minShare, int maxShare, double weight, int fairShare, int usage,
      long startTime) {
    this(Resources.createResource(minShare, 0), Resources.createResource(maxShare, 0),
        new ResourceWeights((float)weight), Resources.createResource(fairShare, 0),
        Resources.createResource(usage, 0), startTime);
  }
View Full Code Here

      weight *= app.getPriority().getPriority();
      if (weightAdjuster != null) {
        // Run weight through the user-supplied weightAdjuster
        weight = weightAdjuster.adjustWeight(app, weight);
      }
      return new ResourceWeights((float)weight);
    }
  }
View Full Code Here

        val = Math.min(val, 1.0f);
        queueMaxAMShares.put(queueName, val);
      } else if ("weight".equals(field.getTagName())) {
        String text = ((Text)field.getFirstChild()).getData().trim();
        double val = Double.parseDouble(text);
        queueWeights.put(queueName, new ResourceWeights((float)val));
      } else if ("minSharePreemptionTimeout".equals(field.getTagName())) {
        String text = ((Text)field.getFirstChild()).getData().trim();
        long val = Long.parseLong(text) * 1000L;
        minSharePreemptionTimeouts.put(queueName, val);
      } else if ("schedulingPolicy".equals(field.getTagName())
View Full Code Here

      this.clusterCapacity = clusterCapacity;
    }

    @Override
    public int compare(Schedulable s1, Schedulable s2) {
      ResourceWeights sharesOfCluster1 = new ResourceWeights();
      ResourceWeights sharesOfCluster2 = new ResourceWeights();
      ResourceWeights sharesOfMinShare1 = new ResourceWeights();
      ResourceWeights sharesOfMinShare2 = new ResourceWeights();
      ResourceType[] resourceOrder1 = new ResourceType[NUM_RESOURCES];
      ResourceType[] resourceOrder2 = new ResourceType[NUM_RESOURCES];
     
      // Calculate shares of the cluster for each resource both schedulables.
      calculateShares(s1.getResourceUsage(),
          clusterCapacity, sharesOfCluster1, resourceOrder1, s1.getWeights());
      calculateShares(s1.getResourceUsage(),
          s1.getMinShare(), sharesOfMinShare1, null, ResourceWeights.NEUTRAL);
      calculateShares(s2.getResourceUsage(),
          clusterCapacity, sharesOfCluster2, resourceOrder2, s2.getWeights());
      calculateShares(s2.getResourceUsage(),
          s2.getMinShare(), sharesOfMinShare2, null, ResourceWeights.NEUTRAL);
     
      // A queue is needy for its min share if its dominant resource
      // (with respect to the cluster capacity) is below its configured min share
      // for that resource
      boolean s1Needy = sharesOfMinShare1.getWeight(resourceOrder1[0]) < 1.0f;
      boolean s2Needy = sharesOfMinShare2.getWeight(resourceOrder2[0]) < 1.0f;
     
      int res = 0;
      if (!s2Needy && !s1Needy) {
        res = compareShares(sharesOfCluster1, sharesOfCluster2,
            resourceOrder1, resourceOrder2);
View Full Code Here

    this.startTime = scheduler.getClock().getTime();
    this.queue = queue;
    this.containerTokenSecretManager = scheduler.
        getContainerTokenSecretManager();
    this.priority = Priority.newInstance(1);
    this.resourceWeights = new ResourceWeights();
  }
View Full Code Here

    weight *= app.getPriority().getPriority();
    if (weightAdjuster != null) {
      // Run weight through the user-supplied weightAdjuster
      weight = weightAdjuster.adjustWeight(app, weight);
    }
    ResourceWeights resourceWeights = app.getResourceWeights();
    resourceWeights.setWeight((float)weight);
    return resourceWeights;
  }
View Full Code Here

  public long getFairSharePreemptionTimeout() {
    return fairSharePreemptionTimeout;
  }
 
  public ResourceWeights getQueueWeight(String queue) {
    ResourceWeights weight = queueWeights.get(queue);
    return (weight == null) ? ResourceWeights.NEUTRAL : weight;
  }
View Full Code Here

      weight *= app.getPriority().getPriority();
      if (weightAdjuster != null) {
        // Run weight through the user-supplied weightAdjuster
        weight = weightAdjuster.adjustWeight(app, weight);
      }
      return new ResourceWeights((float)weight);
    }
  }
View Full Code Here

        int val = Integer.parseInt(text);
        queueMaxApps.put(queueName, val);
      } else if ("weight".equals(field.getTagName())) {
        String text = ((Text)field.getFirstChild()).getData().trim();
        double val = Double.parseDouble(text);
        queueWeights.put(queueName, new ResourceWeights((float)val));
      } else if ("minSharePreemptionTimeout".equals(field.getTagName())) {
        String text = ((Text)field.getFirstChild()).getData().trim();
        long val = Long.parseLong(text) * 1000L;
        minSharePreemptionTimeouts.put(queueName, val);
      } else if ("schedulingPolicy".equals(field.getTagName())
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.server.resourcemanager.resource.ResourceWeights

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.