本文整理匯總了Java中org.apache.hadoop.mapred.InvalidJobConfException類的典型用法代碼示例。如果您正苦於以下問題:Java InvalidJobConfException類的具體用法?Java InvalidJobConfException怎麽用?Java InvalidJobConfException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
InvalidJobConfException類屬於org.apache.hadoop.mapred包,在下文中一共展示了InvalidJobConfException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkOutputSpecs
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
public void checkOutputSpecs(JobContext job
) throws FileAlreadyExistsException, IOException{
// Ensure that the output directory is set and not already there
Path outDir = getOutputPath(job);
if (outDir == null) {
throw new InvalidJobConfException("Output directory not set.");
}
// get delegation token for outDir's file system
TokenCache.obtainTokensForNamenodes(job.getCredentials(),
new Path[] { outDir }, job.getConfiguration());
if (outDir.getFileSystem(job.getConfiguration()).exists(outDir)) {
throw new FileAlreadyExistsException("Output directory " + outDir +
" already exists");
}
}
示例2: checkOutputSpecs
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
public void checkOutputSpecs(JobContext job
) throws FileAlreadyExistsException, IOException{
// Ensure that the output directory is set and not already there
Path outDir = getOutputPath(job);
if (outDir == null) {
throw new InvalidJobConfException("Output directory not set.");
}
// get delegation token for outDir's file system
TokenCache.obtainTokensForNamenodes(job.getCredentials(),
new Path[] {outDir},
job.getConfiguration());
if (outDir.getFileSystem(job.getConfiguration()).exists(outDir)) {
throw new FileAlreadyExistsException("Output directory " + outDir +
" already exists");
}
}
示例3: checkOutputSpecs
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
/**
* Overridden to avoid throwing an exception if the specified directory
* for export already exists.
*/
@Override
public void checkOutputSpecs(JobContext job) throws FileAlreadyExistsException, IOException {
Path outDir = getOutputPath(job);
if(outDir == null) {
throw new InvalidJobConfException("Output directory not set.");
} else {
TokenCache.obtainTokensForNamenodes(job.getCredentials(), new Path[]{outDir}, job.getConfiguration());
/*
if(outDir.getFileSystem(job.getConfiguration()).exists(outDir)) {
System.out.println("Output dir already exists, no problem");
throw new FileAlreadyExistsException("Output directory " + outDir + " already exists");
}
*/
}
}
示例4: checkOutputSpecs
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
@Override
public void checkOutputSpecs(FileSystem ignored, JobConf job) throws FileAlreadyExistsException, InvalidJobConfException, IOException {
// Ensure that the output directory is set and not already there
Path outDir = getOutputPath(job);
if (outDir == null && job.getNumReduceTasks() != 0) {
throw new InvalidJobConfException("Output directory not set in JobConf.");
}
if (outDir != null) {
FileSystem fs = outDir.getFileSystem(job);
// normalize the output directory
outDir = fs.makeQualified(outDir);
setOutputPath(job, outDir);
// get delegation token for the outDir's file system
TokenCache.obtainTokensForNamenodes(job.getCredentials(), new Path[]{outDir}, job);
String jobUuid = job.get("zephyr.job.uuid");
if (jobUuid == null)
throw new InvalidJobConfException("This output format REQUIRES the value zephyr.job.uuid to be specified in the job configuration!");
// // check its existence
// if (fs.exists(outDir)) {
// throw new FileAlreadyExistsException("Output directory " + outDir
// + " already exists");
// }
}
}
示例5: checkOutputSpecs
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
@Override
public void checkOutputSpecs(JobContext job) throws IOException {
super.checkOutputSpecs(job);
if (getCompressOutput(job) &&
getOutputCompressionType(job) == CompressionType.RECORD ) {
throw new InvalidJobConfException("SequenceFileAsBinaryOutputFormat "
+ "doesn't support Record Compression" );
}
}
示例6: checkOutputSpecs
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
@Override
public void checkOutputSpecs(JobContext job
) throws InvalidJobConfException, IOException {
// Ensure that the output directory is set
Path outDir = getOutputPath(job);
if (outDir == null) {
throw new InvalidJobConfException("Output directory not set in JobConf.");
}
final Configuration jobConf = job.getConfiguration();
// get delegation token for outDir's file system
TokenCache.obtainTokensForNamenodes(job.getCredentials(),
new Path[] { outDir }, jobConf);
final FileSystem fs = outDir.getFileSystem(jobConf);
if (fs.exists(outDir)) {
// existing output dir is considered empty iff its only content is the
// partition file.
//
final FileStatus[] outDirKids = fs.listStatus(outDir);
boolean empty = false;
if (outDirKids != null && outDirKids.length == 1) {
final FileStatus st = outDirKids[0];
final String fname = st.getPath().getName();
empty =
!st.isDirectory() && TeraInputFormat.PARTITION_FILENAME.equals(fname);
}
if (TeraSort.getUseSimplePartitioner(job) || !empty) {
throw new FileAlreadyExistsException("Output directory " + outDir
+ " already exists");
}
}
}
示例7: checkOutputSpecs
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
@Override
public void checkOutputSpecs(FileSystem ignored, JobConf job)
throws FileAlreadyExistsException, InvalidJobConfException, IOException {
String tableName = job.get(OUTPUT_TABLE);
if (tableName == null) {
throw new IOException("Must specify table name");
}
}
示例8: testSetupDistributedCacheConflicts
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Test(timeout = 120000, expected = InvalidJobConfException.class)
public void testSetupDistributedCacheConflicts() throws Exception {
Configuration conf = new Configuration();
conf.setClass("fs.mockfs.impl", MockFileSystem.class, FileSystem.class);
URI mockUri = URI.create("mockfs://mock/");
FileSystem mockFs = ((FilterFileSystem)FileSystem.get(mockUri, conf))
.getRawFileSystem();
URI archive = new URI("mockfs://mock/tmp/something.zip#something");
Path archivePath = new Path(archive);
URI file = new URI("mockfs://mock/tmp/something.txt#something");
Path filePath = new Path(file);
when(mockFs.resolvePath(archivePath)).thenReturn(archivePath);
when(mockFs.resolvePath(filePath)).thenReturn(filePath);
DistributedCache.addCacheArchive(archive, conf);
conf.set(MRJobConfig.CACHE_ARCHIVES_TIMESTAMPS, "10");
conf.set(MRJobConfig.CACHE_ARCHIVES_SIZES, "10");
conf.set(MRJobConfig.CACHE_ARCHIVES_VISIBILITIES, "true");
DistributedCache.addCacheFile(file, conf);
conf.set(MRJobConfig.CACHE_FILE_TIMESTAMPS, "11");
conf.set(MRJobConfig.CACHE_FILES_SIZES, "11");
conf.set(MRJobConfig.CACHE_FILE_VISIBILITIES, "true");
Map<String, LocalResource> localResources =
new HashMap<String, LocalResource>();
MRApps.setupDistributedCache(conf, localResources);
}
示例9: testSetupDistributedCacheConflictsFiles
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Test(timeout = 120000, expected = InvalidJobConfException.class)
public void testSetupDistributedCacheConflictsFiles() throws Exception {
Configuration conf = new Configuration();
conf.setClass("fs.mockfs.impl", MockFileSystem.class, FileSystem.class);
URI mockUri = URI.create("mockfs://mock/");
FileSystem mockFs = ((FilterFileSystem)FileSystem.get(mockUri, conf))
.getRawFileSystem();
URI file = new URI("mockfs://mock/tmp/something.zip#something");
Path filePath = new Path(file);
URI file2 = new URI("mockfs://mock/tmp/something.txt#something");
Path file2Path = new Path(file2);
when(mockFs.resolvePath(filePath)).thenReturn(filePath);
when(mockFs.resolvePath(file2Path)).thenReturn(file2Path);
DistributedCache.addCacheFile(file, conf);
DistributedCache.addCacheFile(file2, conf);
conf.set(MRJobConfig.CACHE_FILE_TIMESTAMPS, "10,11");
conf.set(MRJobConfig.CACHE_FILES_SIZES, "10,11");
conf.set(MRJobConfig.CACHE_FILE_VISIBILITIES, "true,true");
Map<String, LocalResource> localResources =
new HashMap<String, LocalResource>();
MRApps.setupDistributedCache(conf, localResources);
}
示例10: checkOutputSpecs
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
@Override
public void checkOutputSpecs(JobContext job
) throws InvalidJobConfException, IOException {
// Ensure that the output directory is set
Path outDir = getOutputPath(job);
if (outDir == null) {
throw new InvalidJobConfException("Output directory not set in JobConf.");
}
// get delegation token for outDir's file system
TokenCache.obtainTokensForNamenodes(job.getCredentials(),
new Path[] { outDir }, job.getConfiguration());
}
示例11: checkOutputSpecs
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
public void checkOutputSpecs(FileSystem fs, JobConf job) throws IOException {
Path out = FileOutputFormat.getOutputPath(job);
if ((out == null) && (job.getNumReduceTasks() != 0)) {
throw new InvalidJobConfException(
"Output directory not set in JobConf.");
}
if (fs == null) {
fs = out.getFileSystem(job);
}
if (fs.exists(new Path(out, CrawlDatum.PARSE_DIR_NAME)))
throw new IOException("Segment already parsed!");
}
示例12: checkOutputSpecs
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
public void checkOutputSpecs(FileSystem fs, JobConf job) throws IOException {
Path out = FileOutputFormat.getOutputPath(job);
if ((out == null) && (job.getNumReduceTasks() != 0)) {
throw new InvalidJobConfException("Output directory not set in JobConf.");
}
if (fs == null) {
fs = out.getFileSystem(job);
}
if (fs.exists(new Path(out, CrawlDatum.FETCH_DIR_NAME)))
throw new IOException("Segment already fetched!");
}
示例13: MapRedGfxdRecordWriter
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
public MapRedGfxdRecordWriter(Configuration conf) throws IOException {
this.tableName = conf.get(OUTPUT_TABLE);
try {
this.batchExecutor = util.new RowCommandBatchExecutor(getDriver(conf),
conf.get(OUTPUT_URL), conf.getInt(OUTPUT_BATCH_SIZE,
OUTPUT_BATCH_SIZE_DEFAULT));
} catch (ClassNotFoundException e) {
logger.error("Gemfirexd client classes are missing from the classpath", e);
throw new InvalidJobConfException(e);
}
}
示例14: validateConfiguration
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
/**
* Validates correctness and completeness of job's output configuration. Job
* configuration must contain url, table and schema name
*
* @param conf
* job conf
* @throws InvalidJobConfException
*/
protected static void validateConfiguration(Configuration conf)
throws InvalidJobConfException {
// User must configure the output region name.
String url = conf.get(OUTPUT_URL);
if (url == null || url.trim().isEmpty()) {
throw new InvalidJobConfException("Output URL not configured.");
}
String table = conf.get(OUTPUT_TABLE);
if (table == null || table.trim().isEmpty()) {
throw new InvalidJobConfException("Output table name not provided.");
}
}
示例15: GfxdRecordWriter
import org.apache.hadoop.mapred.InvalidJobConfException; //導入依賴的package包/類
public GfxdRecordWriter(Configuration conf) throws IOException {
this.tableName = conf.get(OUTPUT_TABLE);
try {
this.batchExecutor = util.new RowCommandBatchExecutor(getDriver(conf),
conf.get(OUTPUT_URL), conf.getInt(OUTPUT_BATCH_SIZE,
OUTPUT_BATCH_SIZE_DEFAULT));
} catch (ClassNotFoundException e) {
logger.error("Gemfirexd client classes are missing from the classpath", e);
throw new InvalidJobConfException(e);
}
}