Search in sources :

Example 26 with ContainerCluster

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

the class ModelProvisioningTest method test2ContentNodesProduces1ClusterController.

@Test
public void test2ContentNodesProduces1ClusterController() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <content version='1.0' id='bar'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='2'/>" + "  </content>" + "</services>";
    int numberOfHosts = 2;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, true);
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    ContentCluster cluster = model.getContentClusters().get("bar");
    ContainerCluster clusterControllers = cluster.getClusterControllers();
    assertEquals(1, clusterControllers.getContainers().size());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 27 with ContainerCluster

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

the class ModelProvisioningTest method testClusterControllersCanSupplementWithAllContainerClusters.

@Test
public void testClusterControllersCanSupplementWithAllContainerClusters() throws ParseException {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <admin version='4.0'/>" + "  <container version='1.0' id='foo1'>" + "     <nodes count='2'/>" + "  </container>" + "  <container version='1.0' id='foo2'>" + "     <nodes count='1'/>" + "  </container>" + "  <content version='1.0' id='bar'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <controllers><nodes dedicated='false' count='5'/></controllers>" + "     <nodes count='2'/>" + "  </content>" + "</services>";
    int numberOfHosts = 5;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, true);
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    ContentCluster cluster = model.getContentClusters().get("bar");
    ContainerCluster clusterControllers = cluster.getClusterControllers();
    // TODO: Expected 5 with this feature reactivated
    assertEquals(1, clusterControllers.getContainers().size());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 28 with ContainerCluster

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

the class DocumentProtocol method createRoutingTable.

/**
 * This function extrapolates any routes for the document protocol that it can from the vespa model.
 *
 * @param plugins All initialized plugins of the vespa model.
 * @return Routing table for the document protocol.
 */
private static RoutingTableSpec createRoutingTable(ConfigModelRepo plugins) {
    // Build simple hops and routes.
    List<ContentCluster> content = Content.getContentClusters(plugins);
    Collection<ContainerCluster> containerClusters = ContainerModel.containerClusters(plugins);
    RoutingTableSpec table = new RoutingTableSpec(NAME);
    addContainerClusterDocprocHops(containerClusters, table);
    addContentRouting(content, table);
    // Build the indexing hop if it is possible to derive.
    addIndexingHop(content, table);
    // Build the default route if is is possible to derive.
    addDefaultRoute(content, containerClusters, table);
    // Return the complete routing table.
    simplifyRouteNames(table);
    return table;
}
Also used : RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 29 with ContainerCluster

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

the class ContainerModelBuilder method addDocproc.

private void addDocproc(Element spec, ContainerCluster cluster) {
    ContainerDocproc containerDocproc = buildDocproc(cluster, spec);
    if (containerDocproc != null) {
        cluster.setDocproc(containerDocproc);
        ContainerDocproc.Options docprocOptions = containerDocproc.options;
        cluster.setMbusParams(new ContainerCluster.MbusParams(docprocOptions.maxConcurrentFactor, docprocOptions.documentExpansionFactor, docprocOptions.containerCoreMemory));
    }
}
Also used : ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContainerDocproc(com.yahoo.vespa.model.container.docproc.ContainerDocproc)

Example 30 with ContainerCluster

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

the class ContainerModelBuilderTest method user_config_can_be_overridden_on_node.

@Test
public void user_config_can_be_overridden_on_node() throws Exception {
    Element containerElem = DomBuilderTest.parse("<jdisc id='default' version='1.0'>", "  <config name=\"prelude.cluster.qr-monitor\">" + "    <requesttimeout>111</requesttimeout>", "  </config> " + "  <nodes>", "    <node hostalias='host1' />", "    <node hostalias='host2'>", "      <config name=\"prelude.cluster.qr-monitor\">", "        <requesttimeout>222</requesttimeout>", "      </config> ", "    </node>", "  </nodes>", "</jdisc>");
    root = ContentClusterUtils.createMockRoot(new String[] { "host1", "host2" });
    createModel(root, containerElem);
    ContainerCluster cluster = (ContainerCluster) root.getChildren().get("default");
    assertThat(cluster.getContainers().size(), is(2));
    assertEquals(root.getConfig(QrMonitorConfig.class, "default/container.0").requesttimeout(), 111);
    assertEquals(root.getConfig(QrMonitorConfig.class, "default/container.1").requesttimeout(), 222);
}
Also used : Element(org.w3c.dom.Element) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Matchers.containsString(org.hamcrest.Matchers.containsString) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest) Test(org.junit.Test)

Aggregations

ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)42 Test (org.junit.Test)28 VespaModel (com.yahoo.vespa.model.VespaModel)22 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)16 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)11 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)10 Element (org.w3c.dom.Element)6 Component (com.yahoo.vespa.model.container.component.Component)4 ComponentId (com.yahoo.component.ComponentId)3 ContainerModel (com.yahoo.vespa.model.container.ContainerModel)3 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 DeployState (com.yahoo.config.model.deploy.DeployState)2 Container (com.yahoo.vespa.model.container.Container)2 ContainerDocproc (com.yahoo.vespa.model.container.docproc.ContainerDocproc)2 JettyHttpServer (com.yahoo.vespa.model.container.http.JettyHttpServer)2 DeploymentSpec (com.yahoo.config.application.api.DeploymentSpec)1 ConfigModel (com.yahoo.config.model.ConfigModel)1 MockRoot (com.yahoo.config.model.test.MockRoot)1 Zone (com.yahoo.config.provision.Zone)1