Tabnine Logo
ClusterSpec$Group
Code IndexAdd Tabnine to your IDE (free)

How to use
ClusterSpec$Group
in
com.yahoo.config.provision

Best Java code snippets using com.yahoo.config.provision.ClusterSpec$Group (Showing top 9 results out of 315)

origin: com.yahoo.vespa/config-model

allocation.addAll(allocateHostGroup(cluster.with(Optional.of(ClusterSpec.Group.from(0))),
                  flavor,
                  capacity,
  allocation.addAll(allocateHostGroup(cluster.with(Optional.of(ClusterSpec.Group.from(i))),
                    flavor,
                    capacity / groups,
origin: com.yahoo.vespa/config-model

String groupIndex = String.valueOf(hostGroup.getKey().get().index());
StorageGroup subgroup = new StorageGroup(owner, groupIndex, groupIndex);
for (Map.Entry<HostResource, ClusterMembership> host : hostGroup.getValue().entrySet()) {
origin: com.yahoo.vespa/node-repository

/**
 * Ensure sufficient nodes are reserved or active for the given application and cluster
 *
 * @return the list of nodes this cluster will have allocated if activated
 */
 // Note: This operation may make persisted changes to the set of reserved and inactive nodes,
 // but it may not change the set of active nodes, as the active nodes must stay in sync with the
 // active config model which is changed on activate
public List<Node> prepare(ApplicationId application, ClusterSpec cluster, NodeSpec requestedNodes, int wantedGroups) {
  List<Node> surplusNodes = findNodesInRemovableGroups(application, cluster, wantedGroups);
  MutableInteger highestIndex = new MutableInteger(findHighestIndex(application, cluster));
  List<Node> acceptedNodes = new ArrayList<>();
  for (int groupIndex = 0; groupIndex < wantedGroups; groupIndex++) {
    ClusterSpec clusterGroup = cluster.with(Optional.of(ClusterSpec.Group.from(groupIndex)));
    List<Node> accepted = groupPreparer.prepare(application, clusterGroup,
                          requestedNodes.fraction(wantedGroups), surplusNodes,
                          highestIndex, spareCount);
    replace(acceptedNodes, accepted);
  }
  moveToActiveGroup(surplusNodes, wantedGroups, cluster.group());
  replace(acceptedNodes, retire(surplusNodes));
  return acceptedNodes;
}
origin: com.yahoo.vespa/config-provisioning

private ClusterMembership(String stringValue, Version vespaVersion) {
  String[] components = stringValue.split("/");
  if (components.length < 4 || components.length > 7)
    throw new RuntimeException("Could not parse '" + stringValue + "' to a cluster membership. " +
                  "Expected 'clusterType/clusterId/groupId/index[/retired][/exclusive][/rotationId,...]'");
  boolean exclusive = false;
  Set<RotationName> rotations = Collections.emptySet();
  if (components.length > 4) {
    for (int i = 4; i < components.length; i++) {
      String component = components[i];
      switch (component) {
        case "exclusive": exclusive = true; break;
        case "retired": retired = true; break;
        default: rotations = rotationsFrom(component); break;
      }
    }
  }
  this.cluster = ClusterSpec.from(ClusterSpec.Type.valueOf(components[0]), ClusterSpec.Id.from(components[1]),
                  ClusterSpec.Group.from(Integer.valueOf(components[2])), vespaVersion, exclusive,
                  rotations);
  this.index = Integer.parseInt(components[3]);
  this.stringValue = toStringValue();
}
origin: com.yahoo.vespa/node-repository

/**
 * Returns a list of the nodes which are
 * in groups with index number above or equal the group count
 */
private List<Node> findNodesInRemovableGroups(ApplicationId application, ClusterSpec requestedCluster, int wantedGroups) {
  List<Node> surplusNodes = new ArrayList<>(0);
  for (Node node : nodeRepository.getNodes(application, Node.State.active)) {
    ClusterSpec nodeCluster = node.allocation().get().membership().cluster();
    if ( ! nodeCluster.id().equals(requestedCluster.id())) continue;
    if ( ! nodeCluster.type().equals(requestedCluster.type())) continue;
    if (nodeCluster.group().get().index() >= wantedGroups)
      surplusNodes.add(node);
  }
  return surplusNodes;
}

origin: com.yahoo.vespa/config-provisioning

public static Group from(int index) { return new Group(index); }
origin: com.yahoo.vespa/node-repository

/** Move nodes from unwanted groups to wanted groups to avoid lingering groups consisting of retired nodes */
private void moveToActiveGroup(List<Node> surplusNodes, int wantedGroups, Optional<ClusterSpec.Group> targetGroup) {
  for (ListIterator<Node> i = surplusNodes.listIterator(); i.hasNext(); ) {
    Node node = i.next();
    ClusterMembership membership = node.allocation().get().membership();
    ClusterSpec cluster = membership.cluster();
    if (cluster.group().get().index() >= wantedGroups) {
      ClusterSpec.Group newGroup = targetGroup.orElse(ClusterSpec.Group.from(0));
      ClusterMembership newGroupMembership = membership.with(cluster.with(Optional.of(newGroup)));
      i.set(node.with(node.allocation().get().with(newGroupMembership)));
    }
  }
}
origin: com.yahoo.vespa/config-provisioning

protected String toStringValue() {
  return cluster.type().name() +
      "/" + cluster.id().value() +
      (cluster.group().isPresent() ? "/" + cluster.group().get().index() : "") +
      "/" + index +
      ( cluster.isExclusive() ? "/exclusive" : "") +
      ( retired ? "/retired" : "") +
      ( !cluster.rotations().isEmpty() ? "/" + rotationsAsString(cluster.rotations()) : "");
}
origin: com.yahoo.vespa/node-repository

private void toSlime(ClusterMembership membership, Cursor object) {
  object.setString("clustertype", membership.cluster().type().name());
  object.setString("clusterid", membership.cluster().id().value());
  object.setString("group", String.valueOf(membership.cluster().group().get().index()));
  object.setLong("index", membership.index());
  object.setBool("retired", membership.retired());
}
com.yahoo.config.provisionClusterSpec$Group

Javadoc

Identifier of a group within a cluster

Most used methods

  • from
  • index
  • <init>

Popular in Java

  • Running tasks concurrently on multiple threads
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
  • getSystemService (Context)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JFrame (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now