当前位置: 首页>>代码示例>>Java>>正文


Java DistributedCache.getLocalCacheFiles方法代码示例

本文整理汇总了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]);
       	}
	}	
}
 
开发者ID:apache,项目名称:systemml,代码行数:43,代码来源:MRBaseForCommonInstructions.java

示例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);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:JobContextImpl.java


注:本文中的org.apache.hadoop.mapreduce.filecache.DistributedCache.getLocalCacheFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。