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());
}
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());
}
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;
}
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));
}
}
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);
}
Aggregations