コード例 #1
0
 private static void maybeFillLinks(TaskConfig task) {
   if (task.getTaskLinksSize() == 0) {
     ImmutableMap.Builder<String, String> links = ImmutableMap.builder();
     for (IResource resource : ResourceManager.getTaskResources(ITaskConfig.build(task), PORTS)) {
       if (resource.getNamedPort().equals("health")) {
         links.put("health", "http://%host%:%port:health%");
       } else if (resource.getNamedPort().equals("http")) {
         links.put("http", "http://%host%:%port:http%");
       }
     }
     task.setTaskLinks(links.build());
   }
 }
コード例 #2
0
 /**
  * Creates a {@link IResourceAggregate} from {@link ResourceBag}.
  *
  * @param bag {@link ResourceBag} to convert.
  * @return A {@link IResourceAggregate} instance.
  */
 public static IResourceAggregate aggregateFromBag(ResourceBag bag) {
   return ThriftBackfill.backfillResourceAggregate(
       new ResourceAggregate()
           .setResources(
               bag.streamResourceVectors()
                   .map(
                       e ->
                           IResource.newBuilder(
                               e.getKey().getValue(),
                               e.getKey().getAuroraResourceConverter().valueOf(e.getValue())))
                   .collect(Collectors.toSet())));
 }