为什么 DistributedCache 会破坏我的文件名
我有一个奇怪的问题,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);
I have a weird problem, DistributedCache appears to change the names of my files, it uses the original name as the parent folder and adds the file as a child.
i.e. folder\filename.ext becomes folder\filename.ext\filename.ext
Any ideas, my code is below.
Thanks
Akintayo
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
}
}
}
Update: 16 August 2010
Replacing the original call with the following, stops the mangling of the names.
DistributedCache.addCacheArchive(new URI(ecgParamsLocation), firstStageConf);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确定要使用
addCacheArchive()
吗?有一个addCacheFile()
http://hadoop.apache.org/common/docs/r0.15.2/api/org/apache/hadoop/filecache/DistributedCache。 html#getCacheFiles%28org.apache.hadoop.conf.Configuration%29 以及。Are you sure you want to use
addCacheArchive()
? There is aaddCacheFile()
http://hadoop.apache.org/common/docs/r0.15.2/api/org/apache/hadoop/filecache/DistributedCache.html#getCacheFiles%28org.apache.hadoop.conf.Configuration%29 as well.