【问题标题】:Why does DistributedCache mangle my file names为什么 DistributedCache 会破坏我的文件名
【发布时间】:2011-03-25 11:16:01
【问题描述】:

我有一个奇怪的问题,DistributedCache 似乎更改了我的文件的名称,它使用原始名称作为父文件夹并将文件添加为子文件夹。

即folder\filename.ext 变成 folder\filename.ext\filename.ext

任何想法,我的代码如下。 谢谢 阿金塔约

String paramsLocation="/user/fwang/settings/ecgparams.txt";
DistributedCache.addCacheFile(new URI(paramsLocation), firstStageConf);

Path[] paths = DistributedCache.getLocalCacheFiles(job);
 for (Path path: paths) {
  if (path.getName().equals(ecgParamsFilename)) {
   File f = new File(path.toString());
    if (f.exists()) {
     ecgParamsFullFileName = f.getAbsolutePath();
     //this becomes /user/fwang/settings/ecgparams.txt/ecgparams.txt 
    }
  }
 }

更新:2010 年 8 月 16 日 用下面的代码替换原来的调用,停止名称的修改。

DistributedCache.addCacheArchive(new URI(ecgParamsLocation), firstStageConf);

【问题讨论】:

    标签: java path uri hadoop mapreduce


    【解决方案1】:
    猜你喜欢
    • 2011-08-19
    • 2013-06-25
    • 2013-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多