Search in sources :

Example 1 with PlanDefinition

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;
}
Also used : AbstractVoidPlanDefinition(alluxio.job.plan.AbstractVoidPlanDefinition) PlanDefinition(alluxio.job.plan.PlanDefinition)

Example 2 with PlanDefinition

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;
}
Also used : Serializable(java.io.Serializable) WorkerInfo(alluxio.wire.WorkerInfo) BatchedJobConfig(alluxio.job.plan.BatchedJobConfig) JobConfig(alluxio.job.JobConfig) AbstractVoidPlanDefinition(alluxio.job.plan.AbstractVoidPlanDefinition) PlanDefinition(alluxio.job.plan.PlanDefinition) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Pair(alluxio.collections.Pair)

Aggregations

AbstractVoidPlanDefinition (alluxio.job.plan.AbstractVoidPlanDefinition)2 PlanDefinition (alluxio.job.plan.PlanDefinition)2 Pair (alluxio.collections.Pair)1 JobConfig (alluxio.job.JobConfig)1 BatchedJobConfig (alluxio.job.plan.BatchedJobConfig)1 WorkerInfo (alluxio.wire.WorkerInfo)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Serializable (java.io.Serializable)1