Package org.apache.aurora.scheduler

Examples of org.apache.aurora.scheduler.ResourceSlot


    expectGetHostAttributes(HOST_A, host(HOST_A), rack(RACK_A)).atLeastOnce();
    expectGetHostMaintenanceStatus(HOST_A).times(4);

    control.replay();

    ResourceSlot twoPorts = ResourceSlot.from(
        DEFAULT_CPUS,
        Amount.of(DEFAULT_RAM, Data.MB),
        Amount.of(DEFAULT_DISK, Data.MB),
        2);
View Full Code Here


          .addAll(Iterables.transform(possibleVictims, Tasks.ASSIGNED_TO_SLAVE_HOST))
          .addAll(Iterables.transform(offers, OFFER_TO_HOST)).build();

      String host = Iterables.getOnlyElement(hosts);

      ResourceSlot slackResources =
          ResourceSlot.sum(Iterables.transform(offers, OFFER_TO_RESOURCE_SLOT));

      if (!Iterables.isEmpty(offers)) {
        Set<SchedulingFilter.Veto> vetos = schedulingFilter.filter(
            slackResources,
            host,
            pendingTask.getTask(),
            pendingTask.getTaskId(),
            attributeAggregate);

        if (vetos.isEmpty()) {
          return Optional.<Set<IAssignedTask>>of(ImmutableSet.<IAssignedTask>of());
        }
      }

      FluentIterable<IAssignedTask> preemptableTasks =
          FluentIterable.from(possibleVictims).filter(canPreempt(pendingTask));

      if (preemptableTasks.isEmpty()) {
        return Optional.absent();
      }

      List<IAssignedTask> toPreemptTasks = Lists.newArrayList();

      Iterable<IAssignedTask> sortedVictims = RESOURCE_ORDER.immutableSortedCopy(preemptableTasks);

      for (IAssignedTask victim : sortedVictims) {
        toPreemptTasks.add(victim);

        ResourceSlot totalResource = ResourceSlot.sum(
            ResourceSlot.sum(Iterables.transform(toPreemptTasks, TASK_TO_RESOURCES)),
            slackResources);

        Set<SchedulingFilter.Veto> vetos = schedulingFilter.filter(
            totalResource,
View Full Code Here

          .addAll(Iterables.transform(possibleVictims, Tasks.ASSIGNED_TO_SLAVE_HOST))
          .addAll(Iterables.transform(offers, OFFER_TO_HOST)).build();

      String host = Iterables.getOnlyElement(hosts);

      ResourceSlot slackResources =
          ResourceSlot.sum(Iterables.transform(offers, OFFER_TO_RESOURCE_SLOT));

      if (!Iterables.isEmpty(offers)) {
        if (Iterables.size(offers) > 1) {
          // There are multiple offers for the same host. Since both have maintenance information
          // we don't preempt with this information and wait for mesos to merge the two offers for
          // us.
          return Optional.absent();
        }
        IHostAttributes attributes = Iterables.getOnlyElement(
            FluentIterable.from(offers).transform(OFFER_TO_ATTRIBUTES).toSet());

        Set<SchedulingFilter.Veto> vetoes = schedulingFilter.filter(
            slackResources,
            attributes,
            pendingTask.getTask(),
            pendingTask.getTaskId(),
            attributeAggregate);

        if (vetoes.isEmpty()) {
          return Optional.<Set<IAssignedTask>>of(ImmutableSet.<IAssignedTask>of());
        }
      }

      FluentIterable<IAssignedTask> preemptableTasks =
          FluentIterable.from(possibleVictims).filter(canPreempt(pendingTask));

      if (preemptableTasks.isEmpty()) {
        return Optional.absent();
      }

      List<IAssignedTask> toPreemptTasks = Lists.newArrayList();

      Iterable<IAssignedTask> sortedVictims = RESOURCE_ORDER.immutableSortedCopy(preemptableTasks);

      for (IAssignedTask victim : sortedVictims) {
        toPreemptTasks.add(victim);

        ResourceSlot totalResource = ResourceSlot.sum(
            ResourceSlot.sum(Iterables.transform(toPreemptTasks, TASK_TO_RESOURCES)),
            slackResources);

        Optional<IHostAttributes> attributes = getHostAttributes(host);
        if (!attributes.isPresent()) {
View Full Code Here

  @Test
  public void testSufficientPorts() {
    control.replay();

    ResourceSlot twoPorts = ResourceSlot.from(
        DEFAULT_CPUS,
        Amount.of(DEFAULT_RAM, Data.MB),
        Amount.of(DEFAULT_DISK, Data.MB),
        2);
View Full Code Here

TOP

Related Classes of org.apache.aurora.scheduler.ResourceSlot

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.