-
大小: 9.3MB文件类型: .zip金币: 2下载: 1 次发布日期: 2023-08-23
- 语言: 其他
- 标签:
资源简介
根据官网maven结构源码自动生成zip源码包,请放心使用
代码片段和文件信息
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License Version 2.0 (the
* “License“); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing software
* distributed under the License is distributed on an “AS IS“ BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop;
import java.io.IOException;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapred.FileOutputFormat;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.JobContext;
import org.apache.hadoop.mapred.OutputCommitter;
import org.apache.hadoop.mapred.TaskAttemptContext;
public class CustomOutputCommitter extends OutputCommitter {
public static final String JOB_SETUP_FILE_NAME = “_job_setup“;
public static final String JOB_COMMIT_FILE_NAME = “_job_commit“;
public static final String JOB_ABORT_FILE_NAME = “_job_abort“;
public static final String TASK_SETUP_FILE_NAME = “_task_setup“;
public static final String TASK_ABORT_FILE_NAME = “_task_abort“;
public static final String TASK_COMMIT_FILE_NAME = “_task_commit“;
@Override
public void setupJob(JobContext jobContext) throws IOException {
writeFile(jobContext.getJobConf() JOB_SETUP_FILE_NAME);
}
@Override
public void commitJob(JobContext jobContext) throws IOException {
super.commitJob(jobContext);
writeFile(jobContext.getJobConf() JOB_COMMIT_FILE_NAME);
}
@Override
public void abortJob(JobContext jobContext int status)
throws IOException {
super.abortJob(jobContext status);
writeFile(jobContext.getJobConf() JOB_ABORT_FILE_NAME);
}
@Override
public void setupTask(TaskAttemptContext taskContext) throws IOException {
writeFile(taskContext.getJobConf() TASK_SETUP_FILE_NAME);
}
@Override
public boolean needsTaskCommit(TaskAttemptContext taskContext)
throws IOException {
return true;
}
@Override
public void commitTask(TaskAttemptContext taskContext) throws IOException {
writeFile(taskContext.getJobConf() TASK_COMMIT_FILE_NAME);
}
@Override
public void abortTask(TaskAttemptContext taskContext) throws IOException {
writeFile(taskContext.getJobConf() TASK_ABORT_FILE_NAME);
}
private void writeFile(JobConf conf String filename) throws IOException {
System.out.println(“writing file ----“ + filename);
Path outputPath = FileOutputFormat.getOutputPath(conf);
FileSystem fs = outputPath.getFileSys
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-07-11 09:28 org\
目录 0 2018-07-11 09:28 org\apache\
目录 0 2018-07-11 09:28 org\apache\hadoop\
目录 0 2018-07-11 09:28 org\apache\hadoop\ant\
目录 0 2018-07-11 09:28 org\apache\hadoop\ant\condition\
文件 2042 2018-07-11 09:28 org\apache\hadoop\ant\condition\Dfsba
文件 983 2018-07-11 09:28 org\apache\hadoop\ant\condition\DfsExists.java
文件 982 2018-07-11 09:28 org\apache\hadoop\ant\condition\DfsIsDir.java
文件 984 2018-07-11 09:28 org\apache\hadoop\ant\condition\DfsZeroLen.java
文件 6855 2018-07-11 09:28 org\apache\hadoop\ant\DfsTask.java
目录 0 2018-07-11 09:28 org\apache\hadoop\classification\
文件 2633 2018-07-11 09:28 org\apache\hadoop\classification\InterfaceAudience.java
文件 2483 2018-07-11 09:28 org\apache\hadoop\classification\InterfaceStability.java
目录 0 2018-07-11 09:28 org\apache\hadoop\classification\tools\
文件 2194 2018-07-11 09:28 org\apache\hadoop\classification\tools\ExcludePrivateAnnotationsJDiffDoclet.java
文件 2239 2018-07-11 09:28 org\apache\hadoop\classification\tools\ExcludePrivateAnnotationsStandardDoclet.java
文件 2517 2018-07-11 09:28 org\apache\hadoop\classification\tools\IncludePublicAnnotationsStandardDoclet.java
文件 1038 2018-07-11 09:28 org\apache\hadoop\classification\tools\package-info.java
文件 9326 2018-07-11 09:28 org\apache\hadoop\classification\tools\RootDocProcessor.java
文件 2565 2018-07-11 09:28 org\apache\hadoop\classification\tools\StabilityOptions.java
目录 0 2018-07-11 09:28 org\apache\hadoop\conf\
文件 1296 2018-07-11 09:28 org\apache\hadoop\conf\Configurable.java
文件 100519 2018-07-11 09:28 org\apache\hadoop\conf\Configuration.java
文件 1553 2018-07-11 09:28 org\apache\hadoop\conf\Configured.java
文件 3482 2018-07-11 09:28 org\apache\hadoop\conf\ConfServlet.java
文件 868 2018-07-11 09:28 org\apache\hadoop\conf\package.html
文件 1987 2018-07-11 09:28 org\apache\hadoop\conf\Reconfigurable.java
文件 8311 2018-07-11 09:28 org\apache\hadoop\conf\Reconfigurableba
文件 2879 2018-07-11 09:28 org\apache\hadoop\conf\ReconfigurationException.java
文件 8898 2018-07-11 09:28 org\apache\hadoop\conf\ReconfigurationServlet.java
文件 2103 2018-07-11 09:28 org\apache\hadoop\conf\ReconfigurationTaskStatus.java
............此处省略4596个文件信息
评论
共有 条评论