我正在使用 0 减少的 hadoop。map
目标是在方法中增量创建对象。然后在某个时候将其写入(序列化)到输出文件夹。就像我说的那样,这reduce
件作品在这里不会做任何事情。我该怎么做呢?这就是我所拥有的:
在配置方法中,我得到文件的路径:
@Override
public void configure(JobConf conf) {
taskSideEffectFile = FileOutputFormat.getWorkOutputPath(conf) + "/temp";
}
在 map 方法中,我正在构建我的对象,最终我想序列化它,现在我试图将它始终写在 map 方法上:
@Override
public void map(LongWritable key, Text value,
OutputCollector<Text, IntWritable> output, Reporter reporter)
throws IOException {
AddInstanceToClassifier(value.toString());
try
{
//serialize classifier
weka.core.SerializationHelper.write( taskSideEffectFile, nb);
}
catch (Exception ex)
{
System.err.println("Failed to serialize classifier: " + ex.getMessage());
throw new IOException("taskSideEffectFile: " + ex.getMessage());
}
}
这是我得到的错误:
12/05/09 22:47:00 INFO mapred.JobClient: map 0% reduce 0%
12/05/09 22:47:08 INFO mapred.JobClient: Task Id : attempt_201205091117_0015_m_000001_0, Status : FAILED
java.io.IOException: taskSideEffectFile: hdfs:/192.168.78.129:9000/user/hadoop-user/output/_temporary/_attempt_201205091117_0015_m_000001_0/temp (No such file or directory)
at naive.bayes.hadoop.MusicClassifierMapper.SaveClassifier(MusicClassifierMapper.java:168)
at naive.bayes.hadoop.MusicClassifierMapper.map(MusicClassifierMapper.java:121)
at naive.bayes.hadoop.MusicClassifierMapper.map(MusicClassifierMapper.java:1)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:47)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:227)
at org.apache.hadoop.mapred.TaskTracker$Child.main(TaskTracker.java:2209)
注意:我使用的是 yahoo 的 hadoop-0.18.0(我认为这是我从 eclipse 运行应用程序的唯一方法)