Search in sources :

Example 11 with ExecutableTaskBase

use of org.dkpro.lab.task.impl.ExecutableTaskBase in project dkpro-lab by dkpro.

the class MultiThreadBatchTaskTest method importTest.

@Test(expected = UnresolvedImportException.class)
public void importTest() throws Exception {
    Task producer = new ExecutableTaskBase() {

        @Override
        public void execute(TaskContext aContext) throws Exception {
            System.out.println("Running producer");
            Properties data = new Properties();
            data.setProperty("key", "value");
            aContext.storeBinary("DATA", new PropertiesAdapter(data));
        }
    };
    Task consumer = new ExecutableTaskBase() {

        @Override
        public void execute(TaskContext aContext) throws Exception {
            System.out.println("Running consumer");
            Properties data = new Properties();
            aContext.retrieveBinary("DATA", new PropertiesAdapter(data));
            Assert.assertEquals(data.getProperty("key"), "value");
        }
    };
    consumer.addImport(producer, "DATA1", "DATA");
    DefaultBatchTask batch = new DefaultBatchTask();
    // BatchTask batch = new BatchTask();
    batch.addTask(producer);
    batch.addTask(consumer);
    Lab.getInstance().run(batch);
}
Also used : DefaultBatchTask(org.dkpro.lab.task.impl.DefaultBatchTask) TaskContext(org.dkpro.lab.engine.TaskContext) PropertiesAdapter(org.dkpro.lab.storage.impl.PropertiesAdapter) ExecutableTaskBase(org.dkpro.lab.task.impl.ExecutableTaskBase) Properties(java.util.Properties) DefaultBatchTask(org.dkpro.lab.task.impl.DefaultBatchTask) Test(org.junit.Test)

Aggregations

ExecutableTaskBase (org.dkpro.lab.task.impl.ExecutableTaskBase)11 DefaultBatchTask (org.dkpro.lab.task.impl.DefaultBatchTask)10 Test (org.junit.Test)10 TaskContext (org.dkpro.lab.engine.TaskContext)9 Task (org.dkpro.lab.task.Task)6 ParameterSpace (org.dkpro.lab.task.ParameterSpace)4 File (java.io.File)3 ImsCwbWriter (de.tudarmstadt.ukp.dkpro.core.io.imscwb.ImsCwbWriter)2 XmiWriter (de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter)2 SnowballStemmer (de.tudarmstadt.ukp.dkpro.core.snowball.SnowballStemmer)2 BreakIteratorSegmenter (de.tudarmstadt.ukp.dkpro.core.tokit.BreakIteratorSegmenter)2 Properties (java.util.Properties)2 ExamplePosAnnotator (org.dkpro.lab.ml.example.ExamplePosAnnotator)2 PropertiesAdapter (org.dkpro.lab.storage.impl.PropertiesAdapter)2 UimaTaskBase (org.dkpro.lab.uima.task.impl.UimaTaskBase)2 Collection (java.util.Collection)1 ReportBase (org.dkpro.lab.reporting.ReportBase)1 FileSystemStorageService (org.dkpro.lab.storage.filesystem.FileSystemStorageService)1 FoldDimensionBundle (org.dkpro.lab.task.impl.FoldDimensionBundle)1 TcShallowLearningAdapter (org.dkpro.tc.core.ml.TcShallowLearningAdapter)1