Hi,
actually, DKPro Lab does feature a factory model for tasks, but in the case of the BatchTask, I unfortunately didn't apply it.
A task in DKPro Lab is modeled as:
- a "task" class - holds configuration, maps parameters from the parameter space to parameters of the underlying tools, e.g.
some "ngramSize" parameter on the experiment level would be injected into a "PARAM_NGRAM_SIZE" on the UIMA level.
- a "task engine" class - uses the configuration to actually run a task, e.g. uses the UIMA descriptor produced from a
"task" class and hands it over to uimaFIT for execution
- a "task execution" service - locates the correct "task engine" given a task, provides task with execution context, and
runs task using the engine,
So we have a UimaTask (UimaTaskBase abstract class) and multiple "engines" for UIMA, e.g. using uimaFIT or using the CPE.
We also have a very simple ExecutableTask (ExecutableTaskBase) which basically is just a runnable.
Now what I should have done would be to implement the parameter sweeping logic in a BatchTaskEngine and just keep the information
about which subtasks exist in the BatchTask. This would have had the effect that somebody would at some point implement a
MultiThreadedBatchTaskEngine and would just swap it in as a replacement of the BatchTaskEngine (e.g. by replacing a Maven dependency)
and that's it.
However, I implemented the BatchTask in terms of the ExecutableTask and didn't make a proper separation between configuration and
run logic. So maybe creating that separation is what you are looking for.
Cheers,
-- Richard