Beispiel #1
0
 protected ChildScalingRequirements getChildScalingRequirements(AutoScaleRequest request) {
   ChildScalingRequirements scalingRequirements = null;
   ProfileRequirements profileRequirements = request.getProfileRequirements();
   if (profileRequirements != null) {
     scalingRequirements = profileRequirements.getChildScalingRequirements();
   }
   return scalingRequirements;
 }
Beispiel #2
0
  @Override
  public void createContainers(AutoScaleRequest request) throws Exception {
    int count = request.getDelta();
    String profile = request.getProfile();
    String version = request.getVersion();
    FabricService fabricService = request.getFabricService();
    CreateChildContainerOptions.Builder builder = null;
    if (fabricService != null) {
      builder = createAutoScaleOptions(request, fabricService);
    }
    if (builder != null) {
      Set<String> ignoreContainerNames = new HashSet<>();
      for (int i = 0; i < count; i++) {
        final CreateChildContainerOptions.Builder configuredBuilder =
            builder.number(1).version(version).profiles(profile);

        Container[] containers = fabricService.getContainers();
        NameValidator nameValidator = Containers.createNameValidator(containers);
        String name =
            Containers.createContainerName(
                containers, profile, containerProvider.getScheme(), nameValidator);
        ignoreContainerNames.add(name);

        CreateChildContainerOptions options = configuredBuilder.name(name).build();
        LOG.info(
            "Creating container name "
                + name
                + " version "
                + version
                + " profile "
                + profile
                + " "
                + count
                + " container(s)");
        fabricService.createContainers(options);
      }
    } else {
      LOG.warn(
          "Could not create version "
              + version
              + " profile "
              + profile
              + " due to missing autoscale configuration");
    }
  }