Search in sources :

Example 11 with Container

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

the class StandaloneContainerActivatorTest method requireThatPortsCanBeFoundNoHttp.

@Test
public void requireThatPortsCanBeFoundNoHttp() throws IOException, ParserConfigurationException, SAXException {
    final Path applicationDir = Files.createTempDirectory("application");
    try {
        writeApplicationPackage(getJdiscXml("<http/>"), applicationDir);
        StandaloneContainerActivator activator = new StandaloneContainerActivator();
        Container container = StandaloneContainerActivator.getContainer(newAppDirBinding(applicationDir));
        List<Integer> ports = getPorts(activator, container);
        assertThat(ports, empty());
    } finally {
        IOUtils.recursiveDeleteDir(applicationDir.toFile());
    }
}
Also used : Path(java.nio.file.Path) Container(com.yahoo.vespa.model.container.Container) Test(org.junit.Test)

Example 12 with Container

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

the class ModelProvisioningTest method testCombinedClusterWithJvmArgs.

@Test
public void testCombinedClusterWithJvmArgs() {
    String xmlWithNodes = "<?xml version='1.0' encoding='utf-8' ?>" + "<services>" + "  <container version='1.0' id='container1'>" + "     <document-processing/>" + "     <nodes of='content1' jvmargs='testarg'/>" + "  </container>" + "  <content version='1.0' id='content1'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='2'/>" + "   </content>" + "</services>";
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(2);
    VespaModel model = tester.createModel(xmlWithNodes, true);
    assertEquals("Nodes in content1", 2, model.getContentClusters().get("content1").getRootGroup().getNodes().size());
    assertEquals("Nodes in container1", 2, model.getContainerClusters().get("container1").getContainers().size());
    for (Container container : model.getContainerClusters().get("container1").getContainers()) assertTrue(container.getJvmArgs().contains("testarg"));
}
Also used : Container(com.yahoo.vespa.model.container.Container) VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 13 with Container

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

the class IndexedSearchCluster method addTldsWithSameIdsAsContainers.

/**
 * Make sure to allocate tld with same id as container (i.e if container cluster name is 'foo', with containers
 * with index 0,1,2 the tlds created will get names ../foo.0.tld.0, ../foo.1.tld.1, ../foo.2.tld.2, so that tld config id is
 * stable no matter what changes are done to the number of containers in a container cluster
 * @param tldParent the indexed search cluster the tlds to add should be connected to
 * @param containerCluster the container cluster that should use the tlds created for searching the indexed search cluster above
 */
public void addTldsWithSameIdsAsContainers(AbstractConfigProducer tldParent, ContainerCluster containerCluster) {
    for (Container container : containerCluster.getContainers()) {
        String containerSubId = container.getSubId();
        if (!containerSubId.contains(".")) {
            throw new RuntimeException("Expected container sub id to be of the form string.number");
        }
        int containerIndex = Integer.parseInt(containerSubId.split("\\.")[1]);
        String containerClusterName = containerCluster.getName();
        log.log(LogLevel.DEBUG, "Adding tld with index " + containerIndex + " for content cluster " + this.getClusterName() + ", container cluster " + containerClusterName + " (container id " + containerSubId + ") on host " + container.getHostResource().getHostname());
        rootDispatch.addDispatcher(createTld(tldParent, container.getHostResource(), containerClusterName, containerIndex));
    }
}
Also used : Container(com.yahoo.vespa.model.container.Container)

Example 14 with Container

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

the class ContainerModelBuilder method addStandaloneNode.

private void addStandaloneNode(ContainerCluster cluster) {
    Container container = new Container(cluster, "standalone", cluster.getContainers().size());
    cluster.addContainers(Collections.singleton(container));
}
Also used : Container(com.yahoo.vespa.model.container.Container)

Example 15 with Container

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

the class ClusterControllerCluster method getConfig.

@Override
public void getConfig(ZookeeperServerConfig.Builder builder) {
    builder.clientPort(ZK_CLIENT_PORT);
    for (Container c : containerCluster.getContainers()) {
        ClusterControllerContainer container = (ClusterControllerContainer) c;
        ZookeeperServerConfig.Server.Builder serverBuilder = new ZookeeperServerConfig.Server.Builder();
        serverBuilder.hostname(container.getHostName());
        serverBuilder.id(container.getIndex());
        builder.server(serverBuilder);
    }
}
Also used : Container(com.yahoo.vespa.model.container.Container) ZookeeperServerConfig(com.yahoo.cloud.config.ZookeeperServerConfig)

Aggregations

Container (com.yahoo.vespa.model.container.Container)16 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)4 Element (org.w3c.dom.Element)4 Path (java.nio.file.Path)3 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)2 HostResource (com.yahoo.vespa.model.HostResource)2 VespaModel (com.yahoo.vespa.model.VespaModel)2 ModelElement (com.yahoo.vespa.model.builder.xml.dom.ModelElement)2 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)2 ZookeeperServerConfig (com.yahoo.cloud.config.ZookeeperServerConfig)1 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)1 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)1 ClusterMembership (com.yahoo.config.provision.ClusterMembership)1 ClusterControllerCluster (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerCluster)1 ClusterControllerClusterVerifier (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerClusterVerifier)1 ClusterControllerContainer (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer)1 DocprocChain (com.yahoo.vespa.model.container.docproc.DocprocChain)1 DocumentProcessor (com.yahoo.vespa.model.container.docproc.DocumentProcessor)1 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)1