Search in sources :

Example 1 with HadoopJobId

use of org.apache.ignite.internal.processors.hadoop.HadoopJobId in project ignite by apache.

the class HadoopShuffleFinishRequest method readExternal.

/** {@inheritDoc} */
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    jobId = new HadoopJobId();
    jobId.readExternal(in);
    msgCnt = in.readLong();
}
Also used : HadoopJobId(org.apache.ignite.internal.processors.hadoop.HadoopJobId)

Example 2 with HadoopJobId

use of org.apache.ignite.internal.processors.hadoop.HadoopJobId in project ignite by apache.

the class HadoopShuffleFinishResponse method readExternal.

/** {@inheritDoc} */
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    jobId = new HadoopJobId();
    jobId.readExternal(in);
}
Also used : HadoopJobId(org.apache.ignite.internal.processors.hadoop.HadoopJobId)

Example 3 with HadoopJobId

use of org.apache.ignite.internal.processors.hadoop.HadoopJobId in project ignite by apache.

the class HadoopExternalTaskExecutionSelfTest method testSimpleTaskSubmit.

/**
     * @throws Exception If failed.
     */
public void testSimpleTaskSubmit() throws Exception {
    String testInputFile = "/test";
    prepareTestFile(testInputFile);
    Configuration cfg = new Configuration();
    setupFileSystems(cfg);
    Job job = Job.getInstance(cfg);
    job.setMapperClass(TestMapper.class);
    job.setCombinerClass(TestReducer.class);
    job.setReducerClass(TestReducer.class);
    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(IntWritable.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(IntWritable.class);
    job.setNumReduceTasks(1);
    FileInputFormat.setInputPaths(job, new Path("igfs://:" + getTestIgniteInstanceName(0) + "@/" + testInputFile));
    FileOutputFormat.setOutputPath(job, new Path("igfs://:" + getTestIgniteInstanceName(0) + "@/output"));
    job.setJarByClass(getClass());
    IgniteInternalFuture<?> fut = grid(0).hadoop().submit(new HadoopJobId(UUID.randomUUID(), 1), createJobInfo(job.getConfiguration()));
    fut.get();
}
Also used : IgfsPath(org.apache.ignite.igfs.IgfsPath) Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) HadoopConfiguration(org.apache.ignite.configuration.HadoopConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) Job(org.apache.hadoop.mapreduce.Job) HadoopJobId(org.apache.ignite.internal.processors.hadoop.HadoopJobId)

Example 4 with HadoopJobId

use of org.apache.ignite.internal.processors.hadoop.HadoopJobId in project ignite by apache.

the class HadoopJobTracker method reducerTasks.

/**
     * Creates reducer tasks based on job information.
     *
     * @param reducers Reducers (may be {@code null}).
     * @param job Job instance.
     * @return Collection of task infos.
     */
private Collection<HadoopTaskInfo> reducerTasks(int[] reducers, HadoopJobEx job) {
    UUID locNodeId = ctx.localNodeId();
    HadoopJobId jobId = job.id();
    JobLocalState state = activeJobs.get(jobId);
    Collection<HadoopTaskInfo> tasks = null;
    if (reducers != null) {
        if (state == null)
            state = initState(job.id());
        for (int rdc : reducers) {
            if (state.addReducer(rdc)) {
                if (log.isDebugEnabled())
                    log.debug("Submitting REDUCE task for execution [locNodeId=" + locNodeId + ", rdc=" + rdc + ']');
                HadoopTaskInfo taskInfo = new HadoopTaskInfo(REDUCE, jobId, rdc, 0, null);
                if (tasks == null)
                    tasks = new ArrayList<>();
                tasks.add(taskInfo);
            }
        }
    }
    return tasks;
}
Also used : HadoopTaskInfo(org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo) ArrayList(java.util.ArrayList) UUID(java.util.UUID) HadoopJobId(org.apache.ignite.internal.processors.hadoop.HadoopJobId)

Example 5 with HadoopJobId

use of org.apache.ignite.internal.processors.hadoop.HadoopJobId in project ignite by apache.

the class HadoopJobTracker method mapperTasks.

/**
     * Creates mapper tasks based on job information.
     *
     * @param mappers Mapper blocks.
     * @param meta Job metadata.
     * @return Collection of created task infos or {@code null} if no mapper tasks scheduled for local node.
     */
private Collection<HadoopTaskInfo> mapperTasks(Iterable<HadoopInputSplit> mappers, HadoopJobMetadata meta) {
    UUID locNodeId = ctx.localNodeId();
    HadoopJobId jobId = meta.jobId();
    JobLocalState state = activeJobs.get(jobId);
    Collection<HadoopTaskInfo> tasks = null;
    if (mappers != null) {
        if (state == null)
            state = initState(jobId);
        int mapperIdx = 0;
        for (HadoopInputSplit split : mappers) {
            if (state.addMapper(split)) {
                if (log.isDebugEnabled())
                    log.debug("Submitting MAP task for execution [locNodeId=" + locNodeId + ", split=" + split + ']');
                HadoopTaskInfo taskInfo = new HadoopTaskInfo(MAP, jobId, meta.taskNumber(split), 0, split);
                taskInfo.mapperIndex(mapperIdx++);
                if (tasks == null)
                    tasks = new ArrayList<>();
                tasks.add(taskInfo);
            }
        }
    }
    return tasks;
}
Also used : HadoopTaskInfo(org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo) ArrayList(java.util.ArrayList) HadoopInputSplit(org.apache.ignite.hadoop.HadoopInputSplit) UUID(java.util.UUID) HadoopJobId(org.apache.ignite.internal.processors.hadoop.HadoopJobId)

Aggregations

HadoopJobId (org.apache.ignite.internal.processors.hadoop.HadoopJobId)39 UUID (java.util.UUID)15 Path (org.apache.hadoop.fs.Path)13 Job (org.apache.hadoop.mapreduce.Job)13 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)10 Configuration (org.apache.hadoop.conf.Configuration)9 HadoopConfiguration (org.apache.ignite.configuration.HadoopConfiguration)7 IgfsPath (org.apache.ignite.igfs.IgfsPath)7 IOException (java.io.IOException)6 JobConf (org.apache.hadoop.mapred.JobConf)5 FileSystemConfiguration (org.apache.ignite.configuration.FileSystemConfiguration)5 HadoopDefaultJobInfo (org.apache.ignite.internal.processors.hadoop.HadoopDefaultJobInfo)4 IgniteHadoopFileSystem (org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem)3 HadoopHelperImpl (org.apache.ignite.internal.processors.hadoop.HadoopHelperImpl)3 HadoopJobEx (org.apache.ignite.internal.processors.hadoop.HadoopJobEx)3 HadoopTaskCancelledException (org.apache.ignite.internal.processors.hadoop.HadoopTaskCancelledException)3 HadoopTaskInfo (org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo)3 ArrayList (java.util.ArrayList)2 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 HadoopMapReducePlan (org.apache.ignite.hadoop.HadoopMapReducePlan)2