Search in sources :

Example 1 with ContainerModel

use of com.yahoo.vespa.model.container.ContainerModel in project vespa by vespa-engine.

the class DomAdminV4Builder method pickContainerHostsForSlobrok.

/**
 * Returns a list of container hosts to use for an auxiliary cluster.
 * The list returns the same nodes on each invocation given the same available nodes.
 *
 * @param count the desired number of nodes. More nodes may be returned to ensure a smooth transition
 *        on topology changes, and less nodes may be returned if fewer are available
 * @param minHostsPerContainerCluster the desired number of hosts per cluster
 */
private List<HostResource> pickContainerHostsForSlobrok(int count, int minHostsPerContainerCluster) {
    Collection<ContainerModel> containerModelsWithSlobrok = containerModels.stream().filter(this::shouldHaveSlobrok).collect(Collectors.toList());
    int hostsPerCluster = (int) Math.max(minHostsPerContainerCluster, Math.ceil((double) count / containerModelsWithSlobrok.size()));
    // Pick from all container clusters to make sure we don't lose all nodes at once if some clusters are removed.
    // This will overshoot the desired size (due to ceil and picking at least one node per cluster).
    List<HostResource> picked = new ArrayList<>();
    for (ContainerModel containerModel : containerModelsWithSlobrok) picked.addAll(pickContainerHostsFrom(containerModel, hostsPerCluster));
    return picked;
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) ArrayList(java.util.ArrayList) ContainerModel(com.yahoo.vespa.model.container.ContainerModel)

Example 2 with ContainerModel

use of com.yahoo.vespa.model.container.ContainerModel in project vespa by vespa-engine.

the class Content method createTlds.

public void createTlds(ConfigModelRepo modelRepo) {
    IndexedSearchCluster indexedCluster = cluster.getSearch().getIndexed();
    if (indexedCluster == null)
        return;
    SimpleConfigProducer tldParent = new SimpleConfigProducer(indexedCluster, "tlds");
    for (ConfigModel model : modelRepo.asMap().values()) {
        if (!(model instanceof ContainerModel))
            continue;
        ContainerCluster containerCluster = ((ContainerModel) model).getCluster();
        // this is not a qrs cluster
        if (containerCluster.getSearch() == null)
            continue;
        log.log(LogLevel.DEBUG, "Adding tlds for indexed cluster " + indexedCluster.getClusterName() + ", container cluster " + containerCluster.getName());
        indexedCluster.addTldsWithSameIdsAsContainers(tldParent, containerCluster);
    }
    indexedCluster.setupDispatchGroups();
}
Also used : IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) ConfigModel(com.yahoo.config.model.ConfigModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContainerModel(com.yahoo.vespa.model.container.ContainerModel)

Example 3 with ContainerModel

use of com.yahoo.vespa.model.container.ContainerModel in project vespa by vespa-engine.

the class ContainerModelBuilderTestBase method createModel.

public static void createModel(MockRoot root, DeployState deployState, Element... containerElems) throws SAXException, IOException {
    for (Element containerElem : containerElems) {
        ContainerModel model = new ContainerModelBuilder(false, ContainerModelBuilder.Networking.enable).build(deployState, null, root, containerElem);
        ContainerCluster cluster = model.getCluster();
        generateDefaultSearchChains(cluster);
    }
    root.freezeModelTopology();
}
Also used : Element(org.w3c.dom.Element) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContainerModel(com.yahoo.vespa.model.container.ContainerModel)

Example 4 with ContainerModel

use of com.yahoo.vespa.model.container.ContainerModel in project vespa by vespa-engine.

the class StandaloneDocprocContainerTest method setupCluster.

public ContainerCluster setupCluster(boolean standalone) {
    ContainerModelBuilder builder = new ContainerModelBuilder(standalone, Networking.disable);
    ContainerModel model = builder.build(DeployState.createTestState(), null, root, servicesXml());
    if (!standalone)
        model.getCluster().getDocproc().getChains().addServersAndClientsForChains();
    root.freezeModelTopology();
    return model.getCluster();
}
Also used : ContainerModelBuilder(com.yahoo.vespa.model.container.xml.ContainerModelBuilder) ContainerModel(com.yahoo.vespa.model.container.ContainerModel)

Example 5 with ContainerModel

use of com.yahoo.vespa.model.container.ContainerModel in project vespa by vespa-engine.

the class DeploymentFileValidator method validate.

@Override
public void validate(VespaModel model, DeployState deployState) {
    Optional<Reader> deployment = deployState.getApplicationPackage().getDeployment();
    if (deployment.isPresent()) {
        Reader deploymentReader = deployment.get();
        DeploymentSpec deploymentSpec = DeploymentSpec.fromXml(deploymentReader);
        final Optional<String> globalServiceId = deploymentSpec.globalServiceId();
        if (globalServiceId.isPresent()) {
            Set<ContainerCluster> containerClusters = model.getRoot().configModelRepo().getModels(ContainerModel.class).stream().map(ContainerModel::getCluster).filter(cc -> cc.getName().equals(globalServiceId.get())).collect(Collectors.toSet());
            if (containerClusters.size() != 1) {
                throw new IllegalArgumentException("global-service-id '" + globalServiceId.get() + "' specified in deployment.xml does not match any container cluster id");
            }
        }
    }
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) DeploymentSpec(com.yahoo.config.application.api.DeploymentSpec) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerModel(com.yahoo.vespa.model.container.ContainerModel) Optional(java.util.Optional) Set(java.util.Set) Reader(java.io.Reader) Collectors(java.util.stream.Collectors) DeploymentSpec(com.yahoo.config.application.api.DeploymentSpec) Reader(java.io.Reader) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContainerModel(com.yahoo.vespa.model.container.ContainerModel)

Aggregations

ContainerModel (com.yahoo.vespa.model.container.ContainerModel)7 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)3 ContainerModelBuilder (com.yahoo.vespa.model.container.xml.ContainerModelBuilder)2 DeploymentSpec (com.yahoo.config.application.api.DeploymentSpec)1 DocprocConfig (com.yahoo.config.docproc.DocprocConfig)1 SchemamappingConfig (com.yahoo.config.docproc.SchemamappingConfig)1 ConfigModel (com.yahoo.config.model.ConfigModel)1 DeployState (com.yahoo.config.model.deploy.DeployState)1 BundlesConfig (com.yahoo.container.BundlesConfig)1 ComponentsConfig (com.yahoo.container.ComponentsConfig)1 ChainsConfig (com.yahoo.container.core.ChainsConfig)1 ContainerMbusConfig (com.yahoo.container.jdisc.ContainerMbusConfig)1 DocumentmanagerConfig (com.yahoo.document.config.DocumentmanagerConfig)1 QrStartConfig (com.yahoo.search.config.QrStartConfig)1 HostResource (com.yahoo.vespa.model.HostResource)1 VespaModel (com.yahoo.vespa.model.VespaModel)1 IndexedSearchCluster (com.yahoo.vespa.model.search.IndexedSearchCluster)1 Reader (java.io.Reader)1 ArrayList (java.util.ArrayList)1 Optional (java.util.Optional)1