use of alluxio.job.plan.PlanDefinition in project alluxio by Alluxio.
the class BatchedJobDefinition method runTask.
@Override
public SerializableVoid runTask(BatchedJobConfig config, BatchedJobTask task, RunTaskContext context) throws Exception {
String jobType = config.getJobType();
@SuppressWarnings("rawtypes") PlanDefinition plan = JobDefinitionFactory.create(jobType);
plan.runTask(task.getJobConfig(), task.getJobTaskArgs(), context);
return null;
}
use of alluxio.job.plan.PlanDefinition in project alluxio by Alluxio.
the class BatchedJobDefinition method selectExecutors.
@Override
public Set<Pair<WorkerInfo, BatchedJobTask>> selectExecutors(BatchedJobConfig config, List<WorkerInfo> jobWorkerInfoList, SelectExecutorsContext context) throws Exception {
// get job type and config
String jobType = config.getJobType();
PlanDefinition plan = JobDefinitionFactory.create(jobType);
// convert map to config
final ObjectMapper mapper = new ObjectMapper();
Class<?> jobConfigClass = plan.getJobConfigClass();
Set<Pair<WorkerInfo, BatchedJobTask>> allTasks = Sets.newHashSet();
for (Map<String, String> configMap : config.getJobConfigs()) {
JobConfig jobConfig = (JobConfig) mapper.convertValue(configMap, jobConfigClass);
Set<Pair<WorkerInfo, Serializable>> tasks = plan.selectExecutors(jobConfig, jobWorkerInfoList, context);
for (Pair<WorkerInfo, Serializable> task : tasks) {
BatchedJobTask batchedTask = new BatchedJobTask(jobConfig, task.getSecond());
allTasks.add(new Pair<>(task.getFirst(), batchedTask));
}
}
return allTasks;
}
Aggregations