Search in sources :

Example 1 with ReportingTask

use of org.dkpro.lab.task.ReportingTask in project dkpro-lab by dkpro.

the class ReportingEngine method run.

@Override
public String run(Task aConfiguration) throws ExecutionException, LifeCycleException {
    if (!(aConfiguration instanceof ReportingTask)) {
        throw new ExecutionException("This engine can only execute [" + ReportingTask.class.getName() + "]");
    }
    // Create persistence service for injection into analysis components
    TaskContext ctx = null;
    try {
        ctx = contextFactory.createContext(aConfiguration);
        // Now the setup is complete
        ctx.getLifeCycleManager().initialize(ctx, aConfiguration);
        // Start recording
        ctx.getLifeCycleManager().begin(ctx, aConfiguration);
        // End recording (here the reports will nbe done)
        ctx.getLifeCycleManager().complete(ctx, aConfiguration);
        return ctx.getId();
    } finally {
        if (ctx != null) {
            ctx.getLifeCycleManager().destroy(ctx, aConfiguration);
        }
    }
}
Also used : TaskContext(org.dkpro.lab.engine.TaskContext) ExecutionException(org.dkpro.lab.engine.ExecutionException) ReportingTask(org.dkpro.lab.task.ReportingTask)

Aggregations

ExecutionException (org.dkpro.lab.engine.ExecutionException)1 TaskContext (org.dkpro.lab.engine.TaskContext)1 ReportingTask (org.dkpro.lab.task.ReportingTask)1