Search in sources :

Example 1 with FeederConfig

use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.

the class DomV20ClientsBuilder method createSpoolers.

/**
 * Creates VespaSpooler objects using the given xml Element.
 */
private void createSpoolers(AbstractConfigProducer pcp, Element element, Clients clients) {
    String jvmArgs = null;
    if (element.hasAttribute(VespaDomBuilder.JVMARGS_ATTRIB_NAME))
        jvmArgs = element.getAttribute(VespaDomBuilder.JVMARGS_ATTRIB_NAME);
    SimpleConfigProducer spoolerCfg = new VespaDomBuilder.DomSimpleConfigProducerBuilder(element.getNodeName()).build(pcp, element);
    Element spoolersFeederOptions = findFeederOptions(element);
    createSpoolMasters(spoolerCfg, element);
    for (Element e : XML.getChildren(element, "spooler")) {
        String configId = e.getAttribute("id").trim();
        FeederConfig.Builder feederConfig = getFeederConfig(spoolersFeederOptions, e);
        SpoolerConfig.Builder spoolConfig = getSpoolConfig(e);
        if (configId.length() == 0) {
            int index = clients.getVespaSpoolers().size();
            VespaSpoolerService spoolerService = new VespaSpoolerServiceBuilder(index, new VespaSpooler(feederConfig, spoolConfig)).build(spoolerCfg, e);
            if ("".equals(spoolerService.getJvmArgs()) && jvmArgs != null)
                spoolerService.setJvmArgs(jvmArgs);
            spoolerService.setProp("index", String.valueOf(index));
            clients.getVespaSpoolers().add(spoolerService);
        } else {
            new VespaSpoolerProducerBuilder(configId, new VespaSpooler(feederConfig, spoolConfig)).build(spoolerCfg, e);
        }
    }
}
Also used : SimpleConfigProducer(com.yahoo.vespa.model.SimpleConfigProducer) Element(org.w3c.dom.Element) FeederConfig(com.yahoo.vespaclient.config.FeederConfig) SpoolerConfig(com.yahoo.vespa.config.content.spooler.SpoolerConfig) VespaSpoolerService(com.yahoo.vespa.model.clients.VespaSpoolerService) VespaSpooler(com.yahoo.vespa.model.clients.VespaSpooler)

Example 2 with FeederConfig

use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.

the class VisitorSearcherTestCase method testNoClusterParamWhenSeveralClusters.

@Test(expected = IllegalArgumentException.class)
public void testNoClusterParamWhenSeveralClusters() throws Exception {
    DocumentSessionFactory factory = new DocumentSessionFactory(docType);
    ClusterListConfig.Storage.Builder storageCluster1 = new ClusterListConfig.Storage.Builder().configid("storage/cluster.foo").name("foo");
    ClusterListConfig.Storage.Builder storageCluster2 = new ClusterListConfig.Storage.Builder().configid("storage/cluster.bar").name("bar");
    ClusterListConfig clusterListCfg = new ClusterListConfig(new ClusterListConfig.Builder().storage(Arrays.asList(storageCluster1, storageCluster2)));
    ClusterList clusterList = new ClusterList(clusterListCfg);
    VisitSearcher searcher = new VisitSearcher(new FeedContext(new MessagePropertyProcessor(new FeederConfig(new FeederConfig.Builder().timeout(100).route("whatever").retryenabled(true)), new LoadTypeConfig(new LoadTypeConfig.Builder())), factory, docMan, clusterList, new NullFeedMetric()));
    searcher.getVisitorParameters(newQuery("visit?visit.selection=id.user=1234"), null);
}
Also used : ClusterList(com.yahoo.vespaclient.ClusterList) ClusterListConfig(com.yahoo.cloud.config.ClusterListConfig) FeederConfig(com.yahoo.vespaclient.config.FeederConfig) FeedContext(com.yahoo.feedapi.FeedContext) MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) NullFeedMetric(com.yahoo.feedhandler.NullFeedMetric) LoadTypeConfig(com.yahoo.vespa.config.content.LoadTypeConfig) Test(org.junit.Test)

Example 3 with FeederConfig

use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.

the class VespaFeedHandlerTestCase method setup.

public void setup(com.yahoo.messagebus.Error e, LoadTypeConfig loadTypeCfg, boolean autoReply, DummySessionFactory.ReplyFactory autoReplyFactory) throws Exception {
    DocumentTypeManager docMan = new DocumentTypeManager();
    DocumentTypeManagerConfigurer.configure(docMan, "file:" + xmlFilesPath + "documentmanager.cfg");
    if (autoReply) {
        if (autoReplyFactory != null) {
            factory = DummySessionFactory.createWithAutoReplyFactory(autoReplyFactory);
        } else {
            factory = DummySessionFactory.createWithErrorAutoReply(e);
        }
    } else {
        factory = DummySessionFactory.createDefault();
    }
    context = new FeedContext(new MessagePropertyProcessor(new FeederConfig(new FeederConfig.Builder()), loadTypeCfg), factory, docMan, new ClusterList(), new NullFeedMetric());
    Executor threadPool = Executors.newCachedThreadPool();
    feedHandler = new VespaFeedHandler(context, threadPool);
    removeHandler = new VespaFeedHandlerRemove(context, threadPool);
    statusHandler = new VespaFeedHandlerStatus(context, false, false, threadPool);
    removeLocationHandler = new VespaFeedHandlerRemoveLocation(context, threadPool);
    CallStack dpCallstack = new CallStack("bar");
    dpCallstack.addLast(new TestDocProc());
    dpCallstack.addLast(new TestLaterDocProc());
    DocprocService myservice = new DocprocService("bar");
    myservice.setCallStack(dpCallstack);
    myservice.setInService(true);
    ComponentRegistry<DocprocService> registry = new ComponentRegistry<DocprocService>();
    registry.register(new ComponentId(myservice.getName()), myservice);
    DocumentProcessingHandler handler = new DocumentProcessingHandler(registry, new ComponentRegistry<>(), new ComponentRegistry<>(), new DocumentProcessingHandlerParameters());
    Container container = Container.get();
    ComponentRegistry<RequestHandler> requestHandlerComponentRegistry = new ComponentRegistry<>();
    requestHandlerComponentRegistry.register(new ComponentId(DocumentProcessingHandler.class.getName()), handler);
    container.setRequestHandlerRegistry(requestHandlerComponentRegistry);
}
Also used : ClusterList(com.yahoo.vespaclient.ClusterList) CallStack(com.yahoo.docproc.CallStack) FeederConfig(com.yahoo.vespaclient.config.FeederConfig) Container(com.yahoo.container.Container) Executor(java.util.concurrent.Executor) DocumentProcessingHandler(com.yahoo.docproc.jdisc.DocumentProcessingHandler) MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) RequestHandler(com.yahoo.jdisc.handler.RequestHandler) ComponentRegistry(com.yahoo.component.provider.ComponentRegistry) FeedContext(com.yahoo.feedapi.FeedContext) ComponentId(com.yahoo.component.ComponentId) DocumentProcessingHandlerParameters(com.yahoo.docproc.jdisc.DocumentProcessingHandlerParameters)

Example 4 with FeederConfig

use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.

the class VespaFeederTestCase method testParseArgs.

@Test
public void testParseArgs() throws Exception {
    String argsS = "--abortondataerror false --abortonsenderror false --file foo.xml --maxpending 10" + " --maxpendingsize 11 --maxfeedrate 29 --mode benchmark --noretry --retrydelay 12 --route e6 --timeout 13 --trace 4" + " --validate -v bar.xml --priority LOW_1";
    Arguments arguments = new Arguments(argsS.split(" "), DummySessionFactory.createWithAutoReply());
    FeederConfig config = arguments.getFeederConfig();
    assertEquals(false, config.abortondocumenterror());
    assertEquals(13.0, config.timeout(), 0.00001);
    assertEquals(false, config.retryenabled());
    assertEquals(12.0, config.retrydelay(), 0.0001);
    assertEquals("e6", config.route());
    assertEquals(4, config.tracelevel());
    assertEquals(false, config.abortonsenderror());
    assertEquals(10, config.maxpendingdocs());
    assertEquals(11, config.maxpendingbytes());
    assertEquals(29.0, config.maxfeedrate(), 0.0001);
    assertTrue(arguments.isVerbose());
    assertFalse(config.createifnonexistent());
    assertEquals("LOW_1", arguments.getPriority());
    assertEquals("benchmark", arguments.getMode());
    assertEquals("foo.xml", arguments.getFiles().get(0));
    assertEquals("bar.xml", arguments.getFiles().get(1));
}
Also used : FeederConfig(com.yahoo.vespaclient.config.FeederConfig) Test(org.junit.Test)

Example 5 with FeederConfig

use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.

the class SpoolerTestCase method testFeederConfigBuilder.

private void testFeederConfigBuilder(VespaModel model, String id, FeederConfig.Builder expected) throws Exception {
    FeederConfig.Builder b = new FeederConfig.Builder();
    model.getConfig(b, id);
    FeederConfig config = new FeederConfig(b);
    FeederConfig expectedConfig = new FeederConfig(expected);
    assertEquals(expectedConfig, config);
}
Also used : FeederConfig(com.yahoo.vespaclient.config.FeederConfig)

Aggregations

FeederConfig (com.yahoo.vespaclient.config.FeederConfig)9 FeedContext (com.yahoo.feedapi.FeedContext)5 MessagePropertyProcessor (com.yahoo.feedapi.MessagePropertyProcessor)5 ClusterList (com.yahoo.vespaclient.ClusterList)5 Test (org.junit.Test)5 NullFeedMetric (com.yahoo.feedhandler.NullFeedMetric)4 ClusterListConfig (com.yahoo.cloud.config.ClusterListConfig)2 Chain (com.yahoo.component.chain.Chain)2 GetDocumentMessage (com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage)2 Message (com.yahoo.messagebus.Message)2 Searcher (com.yahoo.search.Searcher)2 Execution (com.yahoo.search.searchchain.Execution)2 LoadTypeConfig (com.yahoo.vespa.config.content.LoadTypeConfig)2 Element (org.w3c.dom.Element)2 ComponentId (com.yahoo.component.ComponentId)1 ComponentRegistry (com.yahoo.component.provider.ComponentRegistry)1 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)1 Container (com.yahoo.container.Container)1 CallStack (com.yahoo.docproc.CallStack)1 DocumentProcessingHandler (com.yahoo.docproc.jdisc.DocumentProcessingHandler)1