I forgot to mention, it is blocked because of calling the getEmptyJCas() method inside of CasMultiplier.
Best, Artem On Sep 27, 2013, at 1:03 AM, Artem Vovk <[email protected]> wrote: > Hi Richard, > >> did you try asking the AggregateBuilder for a description, >> calling getOperationalProperties().setOutputsNewCASes(true) >> on the description and then creating the engine? > > thanks Richard, it solved my problem! > > However, I noticed that while using the JCasIterator I should release every > JCas object after using it, otherwise the process is blocked because of the > CasPool(?): > > JCasIterator it = engine.processAndOutputNewCASes(jCas); > while(it.hasNext()) { > JCas a = it.next(); > ... > a.release(); > } > > Best, > Artem > > On Sep 5, 2013, at 7:59 PM, Richard Eckart de Castilho > <[email protected]> wrote: > >> Hi Artem, >> >> did you try asking the AggregateBuilder for a description, >> calling getOperationalProperties().setOutputsNewCASes(true) >> on the description and then creating the engine? >> >> I have an apparently working piece of code looking along these lines >> >> // The part starting with a splitter and ending with a merger has to be in >> its own >> // aggregate. The flow controller of the aggregate has to drop the >> intermediate CASes. >> FlowControllerDescription fcd = >> createFlowControllerDescription(FixedFlowController.class, >> FixedFlowController.PARAM_ACTION_AFTER_CAS_MULTIPLIER, "drop"); >> AnalysisEngineDescription embedded = createEngineDescription(fcd, splitter, >> tokenizer, merger); >> >> // The final merged CAS, however, needs to be returned from the aggregate >> embedded.getAnalysisEngineMetaData().getOperationalProperties().setOutputsNewCASes(true); >> >> // Need to wrap into another aggregate because runPipeline has no immediate >> support for >> // flow control >> AnalysisEngineDescription pipelineDesc = >> createEngineDescription(sentenceDetector, embedded, consumer); >> >> SimplePipeline.runPipeline(createReaderDescription(…), pipelineDesc); >> >> Cheers, >> >> -- Richard >> >> On 30.08.2013, at 23:32, Artem Vovk <[email protected]> wrote: >> >>> Hi, >>> >>> I wanted to write a test for MyJCasMultiplier, to check how many JCases are >>> created. Here is my code: >>> >>> AnalysisEngineDescription segmenter = >>> createEngineDescription(BreakIteratorSegmenter.class); >>> >>> AnalysisEngineDescription multiplier = >>> createEngineDescription(MyJCasMultiplier.class); >>> >>> AggregateBuilder ab = new AggregateBuilder(); >>> ab.add(segmenter); >>> ab.add(multiplier); >>> >>> AnalysisEngine engine = ab.createAggregate(); >>> engine.getAnalysisEngineMetaData().getOperationalProperties().setOutputsNewCASes(true); >>> >>> JCas jCas = engine.newJCas(); >>> jCas.setDocumentText(testString); >>> JCasIterator it = engine.processAndOutputNewCASes(jCas); >>> >>> The problem is that engine.processAndOutputNewCASes(jCas) returns always 0 >>> JCases, but I know it should be more :) Did I miss something here or it is >>> a framework issue? >>> >>> Best, >>> Artem >> >
