Package org.apache.aurora.scheduler

Examples of org.apache.aurora.scheduler.HostOffer


              if (LOG.isLoggable(Level.FINE)) {
                LOG.log(Level.FINE, String.format("Received offer: %s", offer));
              }
              totalResourceOffers.incrementAndGet();
              for (TaskLauncher launcher : taskLaunchers) {
                if (launcher.willUse(new HostOffer(offer, attributes))) {
                  break;
                }
              }
            }
          }
View Full Code Here


        offersBySlave.put(offer.getOffer().getSlaveId(), offer);
        offersByHost.put(offer.getOffer().getHostname(), offer);
      }

      synchronized boolean remove(OfferID id) {
        HostOffer removed = offersById.remove(id);
        if (removed != null) {
          offers.remove(removed);
          offersBySlave.remove(removed.getOffer().getSlaveId());
          offersByHost.remove(removed.getOffer().getHostname());
        }
        return removed != null;
      }
View Full Code Here

        }
        return removed != null;
      }

      synchronized void updateHostAttributes(IHostAttributes attributes) {
        HostOffer offer = offersByHost.remove(attributes.getHost());
        if (offer != null) {
          // Remove and re-add a host's offer to re-sort based on its new hostStatus
          remove(offer.getOffer().getId());
          add(new HostOffer(offer.getOffer(),  attributes));
        }
      }
View Full Code Here

  private void expectOffers(Offer ... offers) {
    Iterable<HostOffer> hostOffers = FluentIterable.from(Lists.newArrayList(offers))
        .transform(new Function<Offer, HostOffer>() {
          @Override
          public HostOffer apply(Offer offer) {
            return new HostOffer(
                offer,
                IHostAttributes.build(new HostAttributes().setMode(MaintenanceMode.NONE)));
          }
        });
    expect(offerQueue.getOffers()).andReturn(hostOffers);
View Full Code Here

            .andReturn(Optional.of(draining));
        IHostAttributes saved = IHostAttributes.build(
            Conversions.getAttributes(OFFER.getOffer()).newBuilder().setMode(DRAINING));
        expect(storageUtil.attributeStore.saveHostAttributes(saved)).andReturn(true);

        HostOffer offer = new HostOffer(OFFER.getOffer(), draining);
        expect(systemLauncher.willUse(offer)).andReturn(false);
        expect(userLauncher.willUse(offer)).andReturn(true);
      }
    }.run();
  }
View Full Code Here

  @Test
  public void testOffersSorted() throws Exception {
    // Ensures that non-DRAINING offers are preferred - the DRAINING offer would be tried last.

    HostOffer offerA = setMode(OFFER_A, DRAINING);
    HostOffer offerC = setMode(OFFER_C, DRAINING);

    TaskInfo task = TaskInfo.getDefaultInstance();
    expect(offerAcceptor.apply(OFFER_B)).andReturn(Optional.of(task));
    driver.launchTask(OFFER_B.getOffer().getId(), task);

    driver.declineOffer(offerA.getOffer().getId());
    driver.declineOffer(offerC.getOffer().getId());

    control.replay();

    offerQueue.addOffer(offerA);
    offerQueue.addOffer(OFFER_B);
View Full Code Here

    offerQueue.addOffer(OFFER_A);
    clock.advance(RETURN_DELAY);
  }

  private static HostOffer setMode(HostOffer offer, MaintenanceMode mode) {
    return new HostOffer(
        offer.getOffer(),
        IHostAttributes.build(offer.getAttributes().newBuilder().setMode(mode)));
  }
View Full Code Here

        .clearResources()
        .addAllResources(resources)
        .build();
    assertEquals(0, insufficientOffers.get());
    assertFalse(gcExecutorLauncher.willUse(
        new HostOffer(smallOffer, IHostAttributes.build(new HostAttributes()))));
    assertEquals(1, insufficientOffers.get());
  }
View Full Code Here

  @Test
  public void testOneOfferPerSlave() {
    expectAnyMaintenanceCalls();
    Capture<Runnable> offerExpirationCapture = expectOfferDeclineIn(10);

    HostOffer offerAB = new HostOffer(
        Offers.makeOffer("OFFER_B").toBuilder().setSlaveId(OFFER_A.getOffer().getSlaveId()).build(),
        IHostAttributes.build(new HostAttributes()));

    driver.declineOffer(OFFER_A.getOffer().getId());
    driver.declineOffer(offerAB.getOffer().getId());

    replayAndCreateScheduler();

    offerQueue.addOffer(OFFER_A);
    offerQueue.addOffer(offerAB);
View Full Code Here

    driver.launchTask(OFFER_B.getOffer().getId(), mesosTaskA);
    Capture<Runnable> captureA = expectTaskRetryIn(FIRST_SCHEDULE_DELAY_MS);

    IScheduledTask taskB = makeTask("B", PENDING);
    TaskInfo mesosTaskB = makeTaskInfo(taskB);
    HostOffer updatedOfferC = new HostOffer(
        OFFER_C.getOffer(),
        IHostAttributes.build(OFFER_C.getAttributes().newBuilder().setMode(NONE)));
    expectMaybeAssign(updatedOfferC, taskB, emptyJob).andReturn(Optional.of(mesosTaskB));
    driver.launchTask(OFFER_C.getOffer().getId(), mesosTaskB);
    Capture<Runnable> captureB = expectTaskRetryIn(FIRST_SCHEDULE_DELAY_MS);
View Full Code Here

TOP

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

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.