Examples of HostAttributes


Examples of org.apache.aurora.gen.HostAttributes

    assertEquals(Optional.of(attributes), read(HOST_A));
  }

  @Test
  public void testSetMaintenanceMode() {
    HostAttributes noMode = HOST_A_ATTRS.newBuilder();
    noMode.unsetMode();

    insert(IHostAttributes.build(noMode));
    // Default mode NONE should be automatically applied.
    assertEquals(Optional.of(HOST_A_ATTRS), read(HOST_A));

    IHostAttributes updatedA = IHostAttributes.build(noMode.deepCopy().setMode(DRAINED));
    // Inserting the updated value should ignore the mode.
    insert(updatedA);
    assertEquals(Optional.of(HOST_A_ATTRS), read(HOST_A));

    // Instead, the mode must be explicitly set to be changed.
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

    assertFalse(setMode(HOST_B, DRAINED));
  }

  @Test
  public void testSaveAttributesNotSet() {
    HostAttributes attributes = HOST_A_ATTRS.newBuilder();
    attributes.unsetAttributes();

    insert(IHostAttributes.build(attributes));
    assertEquals(
        Optional.of(IHostAttributes.build(attributes.setAttributes(ImmutableSet.<Attribute>of()))),
        read(HOST_A));
  }
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

    ImmutableSet<IScheduledTask> tasks = ImmutableSet.of(
        IScheduledTask.build(new ScheduledTask().setStatus(ScheduleStatus.PENDING)));
    Set<QuotaConfiguration> quotas =
        ImmutableSet.of(
            new QuotaConfiguration("steve", ResourceAggregates.none().newBuilder()));
    IHostAttributes attribute = IHostAttributes.build(new HostAttributes("host",
        ImmutableSet.of(new Attribute("attr", ImmutableSet.of("value")))));
    StoredJob job = new StoredJob(
        "jobManager",
        new JobConfiguration().setKey(new JobKey("owner", "env", "name")));
    String frameworkId = "framework_id";
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

    mapper.truncate();
  }

  @Override
  public void saveHostAttributes(IHostAttributes hostAttributes) {
    HostAttributes mutableAttributes = hostAttributes.newBuilder();

    // Default to NONE maintenance mode.
    if (!hostAttributes.isSetMode()) {
      mutableAttributes.setMode(MaintenanceMode.NONE);
    }
    // Ensure attributes is non-null.
    if (!hostAttributes.isSetAttributes()) {
      mutableAttributes.setAttributes(ImmutableSet.<Attribute>of());
    }

    // If this is an 'upsert', don't overwrite the previously-set maintenance mode.
    Optional<IHostAttributes> existing = getHostAttributes(hostAttributes.getHost());
    if (existing.isPresent()) {
      mutableAttributes.setMode(existing.get().getMode());
    }

    merge(IHostAttributes.build(mutableAttributes));
  }
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

  public static IHostAttributes getAttributes(Offer offer) {
    // Group by attribute name.
    Multimap<String, Protos.Attribute> valuesByName =
        Multimaps.index(offer.getAttributesList(), ATTRIBUTE_NAME);

    return IHostAttributes.build(new HostAttributes(
        offer.getHostname(),
        FluentIterable.from(valuesByName.asMap().entrySet())
            .transform(ATTRIBUTE_CONVERTER)
            .toSet())
        .setSlaveId(offer.getSlaveId().getValue()));
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

          }
        })
        .put(Op._Fields.SAVE_HOST_ATTRIBUTES, new Closure<Op>() {
          @Override
          public void execute(Op op) throws RuntimeException {
            HostAttributes attributes = op.getSaveHostAttributes().getHostAttributes();
            // Prior to commit 5cf760b, the store would persist maintenance mode changes for
            // unknown hosts.  5cf760b began rejecting these, but the replicated log may still
            // contain entries with a null slave ID.
            if (attributes.isSetSlaveId()) {
              writeBehindAttributeStore.saveHostAttributes(IHostAttributes.build(attributes));
            } else {
              LOG.info("Dropping host attributes with no slave ID: " + attributes);
            }
          }
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

        .setSlaveId(slave)
        .setHostname(slaveHost)
        .setFrameworkId(FrameworkID.newBuilder().setValue(FRAMEWORK_ID).build())
        .setId(OFFER_ID)
        .build();
    return new HostOffer(mesosOffer, IHostAttributes.build(new HostAttributes()));
  }
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

    assertEquals(0, getValue(rackStatName("rackB")));
    assertEquals(1, getValue(jobStatName(failedTask, FAILED)));
  }

  private IExpectationSetters<?> expectGetHostRack(String host, String rackToReturn) {
    IHostAttributes attributes = IHostAttributes.build(new HostAttributes()
        .setHost(host)
        .setAttributes(ImmutableSet.of(
            new Attribute().setName("rack").setValues(ImmutableSet.of(rackToReturn)))));
    return expect(storageUtil.attributeStore.getHostAttributes(host))
        .andReturn(Optional.of(attributes));
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

  }

  @Test
  public void testSaveHostAttributes() {
    IHostAttributes attributes = IHostAttributes.build(
        new HostAttributes()
            .setHost("a")
            .setMode(MaintenanceMode.DRAINING)
            .setAttributes(ImmutableSet.of(
                new Attribute().setName("b").setValues(ImmutableSet.of("1", "2")))));
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

        IScheduledTask.build(new ScheduledTask().setStatus(ScheduleStatus.PENDING)));
    Set<QuotaConfiguration> quotas =
        ImmutableSet.of(
            new QuotaConfiguration("steve", ResourceAggregates.none().newBuilder()));
    IHostAttributes attribute = IHostAttributes.build(
        new HostAttributes("host", ImmutableSet.of(new Attribute("attr", ImmutableSet.of("value"))))
            .setSlaveId("slave id"));
    // A legacy attribute that has a maintenance mode set, but nothing else.  These should be
    // dropped.
    IHostAttributes legacyAttribute = IHostAttributes.build(
        new HostAttributes("host", ImmutableSet.<Attribute>of()));
    StoredJob job = new StoredJob(
        "jobManager",
        new JobConfiguration().setKey(new JobKey("owner", "env", "name")));
    String frameworkId = "framework_id";
    ILock lock = ILock.build(new Lock()
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.