use of com.yahoo.vespa.model.builder.xml.dom.ModelElement in project vespa by vespa-engine.
the class ContainerModelBuilder method createNodesFromNodeCount.
private List<Container> createNodesFromNodeCount(ContainerCluster cluster, Element nodesElement, ConfigModelContext context) {
NodesSpecification nodesSpecification = NodesSpecification.from(new ModelElement(nodesElement), context.getDeployState().getWantedNodeVespaVersion());
Map<HostResource, ClusterMembership> hosts = nodesSpecification.provision(cluster.getRoot().getHostSystem(), ClusterSpec.Type.container, ClusterSpec.Id.from(cluster.getName()), log);
return createNodesFromHosts(hosts, cluster);
}
use of com.yahoo.vespa.model.builder.xml.dom.ModelElement in project vespa by vespa-engine.
the class ContainerModelBuilder method createNodesFromContentServiceReference.
private List<Container> createNodesFromContentServiceReference(ContainerCluster cluster, Element nodesElement, ConfigModelContext context) {
// Resolve references to content clusters at the XML level because content clusters must be built after container clusters
String referenceId = nodesElement.getAttribute("of");
Element services = servicesRootOf(nodesElement).orElseThrow(() -> clusterReferenceNotFoundException(cluster, referenceId));
Element referencedService = findChildById(services, referenceId).orElseThrow(() -> clusterReferenceNotFoundException(cluster, referenceId));
if (!referencedService.getTagName().equals("content"))
throw new IllegalArgumentException(cluster + " references service '" + referenceId + "', " + "but that is not a content service");
Element referencedNodesElement = XML.getChild(referencedService, "nodes");
if (referencedNodesElement == null)
throw new IllegalArgumentException(cluster + " references service '" + referenceId + "' to supply nodes, " + "but that service has no <nodes> element");
cluster.setHostClusterId(referenceId);
Map<HostResource, ClusterMembership> hosts = StorageGroup.provisionHosts(NodesSpecification.from(new ModelElement(referencedNodesElement), context.getDeployState().getWantedNodeVespaVersion()), referenceId, cluster.getRoot().getHostSystem(), context.getDeployLogger());
return createNodesFromHosts(hosts, cluster);
}
use of com.yahoo.vespa.model.builder.xml.dom.ModelElement in project vespa by vespa-engine.
the class DomResourceLimitsBuilder method build.
public static ResourceLimits build(ModelElement contentXml) {
ResourceLimits.Builder builder = new ResourceLimits.Builder();
ModelElement resourceLimits = contentXml.getChild("resource-limits");
if (resourceLimits == null) {
return builder.build();
}
if (resourceLimits.getChild("disk") != null) {
builder.setDiskLimit(resourceLimits.childAsDouble("disk"));
}
if (resourceLimits.getChild("memory") != null) {
builder.setMemoryLimit(resourceLimits.childAsDouble("memory"));
}
return builder.build();
}
use of com.yahoo.vespa.model.builder.xml.dom.ModelElement in project vespa by vespa-engine.
the class DomTuningDispatchBuilder method build.
public static TuningDispatch build(ModelElement contentXml) {
TuningDispatch.Builder builder = new TuningDispatch.Builder();
ModelElement tuningElement = contentXml.getChild("tuning");
if (tuningElement == null) {
return builder.build();
}
ModelElement dispatchElement = tuningElement.getChild("dispatch");
if (dispatchElement == null) {
return builder.build();
}
builder.setMaxHitsPerPartition(dispatchElement.childAsInteger("max-hits-per-partition"));
builder.setDispatchPolicy(dispatchElement.childAsString("dispatch-policy"));
builder.setUseLocalNode(dispatchElement.childAsBoolean("use-local-node"));
builder.setMinGroupCoverage(dispatchElement.childAsDouble("min-group-coverage"));
builder.setMinActiveDocsCoverage(dispatchElement.childAsDouble("min-active-docs-coverage"));
return builder.build();
}
use of com.yahoo.vespa.model.builder.xml.dom.ModelElement in project vespa by vespa-engine.
the class ContentSearchCluster method addSearchDefinitions.
private void addSearchDefinitions(List<ModelElement> searchDefs, AbstractSearchCluster sc) {
for (ModelElement e : searchDefs) {
SearchDefinitionXMLHandler searchDefinitionXMLHandler = new SearchDefinitionXMLHandler(e);
SearchDefinition searchDefinition = searchDefinitionXMLHandler.getResponsibleSearchDefinition(sc.getRoot().getDeployState().getSearchDefinitions());
if (searchDefinition == null)
throw new RuntimeException("Search definition parsing error or file does not exist: '" + searchDefinitionXMLHandler.getName() + "'");
// TODO: remove explicit building of user configs when the complete content model is built using builders.
sc.getLocalSDS().add(new AbstractSearchCluster.SearchDefinitionSpec(searchDefinition, UserConfigBuilder.build(e.getXml(), sc.getRoot().getDeployState(), sc.getRoot().deployLogger())));
// need to get the document names from this sdfile
sc.addDocumentNames(searchDefinition);
}
}
Aggregations