Search in sources :

Example 1 with DefaultTaskExecutionService

use of org.dkpro.lab.engine.impl.DefaultTaskExecutionService in project dkpro-lab by dkpro.

the class MultiThreadBatchTaskTest method setup.

@Before
public void setup() {
    File path = new File("target/repository/" + getClass().getSimpleName() + "/" + name.getMethodName());
    System.setProperty("DKPRO_HOME", path.getAbsolutePath());
    FileUtils.deleteQuietly(path);
    // Configure Lab to use MultiThreadBatchTaskEngine
    // Use newInstance here to avoid leaking the reconfiguration into other unit tests
    Lab lab = Lab.newInstance(Lab.DEFAULT_CONTEXT);
    oldEngine = ((DefaultTaskExecutionService) lab.getTaskExecutionService()).getEngine(BatchTask.class);
    ((DefaultTaskExecutionService) lab.getTaskExecutionService()).registerEngine(BatchTask.class, MultiThreadBatchTaskEngine.class);
    lab.setProperty(MultiThreadBatchTaskEngine.PROP_THREADS, "10");
}
Also used : DefaultBatchTask(org.dkpro.lab.task.impl.DefaultBatchTask) DefaultTaskExecutionService(org.dkpro.lab.engine.impl.DefaultTaskExecutionService) Lab(org.dkpro.lab.Lab) File(java.io.File) Before(org.junit.Before)

Example 2 with DefaultTaskExecutionService

use of org.dkpro.lab.engine.impl.DefaultTaskExecutionService in project dkpro-lab by dkpro.

the class MultiThreadBatchTaskTest method teardown.

@After
public void teardown() {
    // Restore Lab to using default BatchTask engine
    Lab lab = Lab.getInstance();
    oldEngine = ((DefaultTaskExecutionService) lab.getTaskExecutionService()).getEngine(BatchTask.class);
    ((DefaultTaskExecutionService) lab.getTaskExecutionService()).registerEngine(BatchTask.class, oldEngine);
}
Also used : DefaultBatchTask(org.dkpro.lab.task.impl.DefaultBatchTask) DefaultTaskExecutionService(org.dkpro.lab.engine.impl.DefaultTaskExecutionService) Lab(org.dkpro.lab.Lab) After(org.junit.After)

Aggregations

Lab (org.dkpro.lab.Lab)2 DefaultTaskExecutionService (org.dkpro.lab.engine.impl.DefaultTaskExecutionService)2 DefaultBatchTask (org.dkpro.lab.task.impl.DefaultBatchTask)2 File (java.io.File)1 After (org.junit.After)1 Before (org.junit.Before)1