我正在使用以下运行代码运行 mapreduce 作业,并且它不断给我以下异常。我确保在开始工作之前删除了该文件夹,但它不起作用。
编码:
JobConf jobConf = new JobConf( getConf(), MPTU.class );
jobConf.setJobName( "MPTU" );
AvroJob.setMapperClass( jobConf, MPTUMapper.class );
AvroJob.setReducerClass( jobConf, MPTUReducer.class );
long milliSeconds = 1000 * 60 * 60;
jobConf.setLong( "mapred.task.timeout", milliSeconds );
Job job = new Job( jobConf );
job.setJarByClass( MPTU.class );
String paths = args[0] + "," + args[1];
FileInputFormat.setInputPaths( job, paths );
Path outputDir = new Path( args[2] );
outputDir.getFileSystem( jobConf ).delete( outputDir, true );
FileOutputFormat.setOutputPath( job, outputDir );
AvroJob.setInputSchema( jobConf, Pair.getPairSchema( Schema.create( Type.LONG ), Schema.create( Type.STRING ) ) );
AvroJob.setMapOutputSchema( jobConf, Pair.getPairSchema( Schema.create( Type.STRING ),
Schema.create( Type.STRING ) ) );
AvroJob.setOutputSchema( jobConf,
Pair.getPairSchema( Schema.create( Type.STRING ), Schema.create( Type.STRING ) ) );
job.setNumReduceTasks( 400 );
job.submit();
JobClient.runJob( jobConf );
例外:
13:31:39,268 ERROR UserGroupInformation:1335 - PriviledgedActionException as:msadri (auth:SIMPLE) cause:org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory file:/Users/msadri/Documents/files/linkage_output already exists
Exception in thread "main" org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory file:/Users/msadri/Documents/files/linkage_output already exists
at org.apache.hadoop.mapred.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:117)
at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:937)
at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:896)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1332)
at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:896)
at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:870)
at org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:1319)
at com.reunify.socialmedia.RecordLinkage.MatchProfileTwitterUserHandler.run(MatchProfileTwitterUserHandler.java:58)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at com.reunify.socialmedia.RecordLinkage.MatchProfileTwitterUserHandler.main(MatchProfileTwitterUserHandler.java:81)