public Map<String, String> getTextAttributes(Offer offer) { Map<String, String> textAttributes = new HashMap<>(); for (Attribute attribute : offer.getAttributesList()) { if (!attribute.getName().equals(rackIdAttributeKey)) { if (attribute.hasText()) { textAttributes.put(attribute.getName(), attribute.getText().getValue()); } else if (attribute.hasScalar()) { textAttributes.put(attribute.getName(), Double.toString(attribute.getScalar().getValue())); } else if (attribute.hasRanges()) { textAttributes.put(attribute.getName(), attribute.getRanges().getRangeList().toString()); } } } return textAttributes; }
attributesList.add(Attribute.newBuilder() .setType(Type.TEXT) .setName(entry.getKey()) .setHostname(host) .setUrl(URL.newBuilder().setScheme("scheme").setAddress(Address.newBuilder().setPort(8080))) .addAttributes(Attribute.newBuilder().setType(Type.TEXT).setText(Text.newBuilder().setValue(rack.or(configuration.getMesosConfiguration().getDefaultRackId()))).setName(configuration.getMesosConfiguration().getRackIdAttributeKey())) .addResources(cpusResource) .addResources(memoryResources)
public Map<String, String> getTextAttributes(Offer offer) { Map<String, String> textAttributes = new HashMap<>(); for (Attribute attribute : offer.getAttributesList()) { if (!attribute.getName().equals(rackIdAttributeKey)) { if (attribute.hasText()) { textAttributes.put(attribute.getName(), attribute.getText().getValue()); } else if (attribute.hasScalar()) { textAttributes.put(attribute.getName(), Double.toString(attribute.getScalar().getValue())); } else if (attribute.hasRanges()) { textAttributes.put(attribute.getName(), attribute.getRanges().getRangeList().toString()); } } } return textAttributes; }
attributesList.add(Attribute.newBuilder() .setType(Type.TEXT) .setName(entry.getKey()) .setHostname(host) .setUrl(URL.newBuilder().setScheme("scheme").setAddress(Address.newBuilder().setPort(8080))) .addAttributes(Attribute.newBuilder().setType(Type.TEXT).setText(Text.newBuilder().setValue(rack.or(configuration.getMesosConfiguration().getDefaultRackId()))).setName(configuration.getMesosConfiguration().getRackIdAttributeKey())) .addResources(cpusResource) .addResources(memoryResources)