public List<Task> call() throws Exception
{
AtomicLong task_id = new AtomicLong(1L);
String user_dir = config.getUserDir(job.getSubmitter());
List<Task> tasks = new ArrayList<Task>(1);
Task t = new Task(
job.getId(),
task_id.getAndIncrement(),
job.getServiceName(),
job.getCommand(),
job.getPriority(),
0);
for (TaskInput entry : job.getInput())
{
String fname = entry.getName();
byte[] fdata = entry.getData();
Fragmentable frag = FormatDetector.getFragmenter(new File(user_dir, fname));
if (frag == null)
throw new Exception("Failed to detect the format of input file:" + fname);
Object[] data;
int num_workers = WorkerManager.getInstance().getWorkerNum();
num_workers = num_workers > 0 ? num_workers : 10;
data = frag.fragment(new ByteArrayInputStream(fdata), num_workers);
t.addInput(new TaskInput(fname, data[0].toString().getBytes()));
}
tasks.add(t);
return tasks;
}