本文整理汇总了Java中org.apache.hadoop.mapreduce.filecache.DistributedCache.getLocalCacheFiles方法的典型用法代码示例。如果您正苦于以下问题:Java DistributedCache.getLocalCacheFiles方法的具体用法?Java DistributedCache.getLocalCacheFiles怎么用?Java DistributedCache.getLocalCacheFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.mapreduce.filecache.DistributedCache
的用法示例。
在下文中一共展示了DistributedCache.getLocalCacheFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupDistCacheFiles
import org.apache.hadoop.mapreduce.filecache.DistributedCache; //导入方法依赖的package包/类
protected void setupDistCacheFiles(JobConf job)
throws IOException
{
if ( MRJobConfiguration.getDistCacheInputIndices(job) == null )
return;
//boolean isJobLocal = false;
isJobLocal = InfrastructureAnalyzer.isLocalMode(job);
String[] inputIndices = MRJobConfiguration.getInputPaths(job);
String[] dcIndices = MRJobConfiguration.getDistCacheInputIndices(job).split(Instruction.INSTRUCTION_DELIM);
Path[] dcFiles = DistributedCache.getLocalCacheFiles(job);
PDataPartitionFormat[] inputPartitionFormats = MRJobConfiguration.getInputPartitionFormats(job);
DistributedCacheInput[] dcInputs = new DistributedCacheInput[dcIndices.length];
for(int i=0; i < dcIndices.length; i++) {
byte inputIndex = Byte.parseByte(dcIndices[i]);
//load if not already present (jvm reuse)
if( !dcValues.containsKey(inputIndex) )
{
// When the job is in local mode, files can be read from HDFS directly -- use
// input paths as opposed to "local" paths prepared by DistributedCache.
Path p = null;
if(isJobLocal)
p = new Path(inputIndices[ Byte.parseByte(dcIndices[i]) ]);
else
p = dcFiles[i];
dcInputs[i] = new DistributedCacheInput(
p,
MRJobConfiguration.getNumRows(job, inputIndex), //rlens[inputIndex],
MRJobConfiguration.getNumColumns(job, inputIndex), //clens[inputIndex],
MRJobConfiguration.getNumRowsPerBlock(job, inputIndex), //brlens[inputIndex],
MRJobConfiguration.getNumColumnsPerBlock(job, inputIndex), //bclens[inputIndex],
inputPartitionFormats[inputIndex]
);
dcValues.put(inputIndex, dcInputs[i]);
}
}
}
示例2: getLocalCacheFiles
import org.apache.hadoop.mapreduce.filecache.DistributedCache; //导入方法依赖的package包/类
/**
* Return the path array of the localized files
* @return A path array of localized files
* @throws IOException
*/
public Path[] getLocalCacheFiles()
throws IOException {
return DistributedCache.getLocalCacheFiles(conf);
}