我写了一个mapreduce作业来从数据集中提取一些信息.数据集是用户对电影的评分.用户数约为250K,电影数约为300k.地图的输出是<user, <movie, rating>*> and <movie,<user,rating>*>.在reducer中,我将处理这些对.
但是当我运行这个工作时,映射器按预期完成,但是reducer总是抱怨
Task attempt_* failed to report status for 600 seconds.
Run Code Online (Sandbox Code Playgroud)
我知道这是由于无法更新状态,所以我context.progress()在我的代码中添加了一个调用,如下所示:
int count = 0;
while (values.hasNext()) {
if (count++ % 100 == 0) {
context.progress();
}
/*other code here*/
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,这没有帮助.仍有许多减少任务失败.
这是日志:
Task attempt_201104251139_0295_r_000014_1 failed to report status for 600 seconds. Killing!
11/05/03 10:09:09 INFO mapred.JobClient: Task Id : attempt_201104251139_0295_r_000012_1, Status : FAILED
Task attempt_201104251139_0295_r_000012_1 failed to report status for 600 seconds. Killing!
11/05/03 10:09:09 INFO mapred.JobClient: Task Id : …Run Code Online (Sandbox Code Playgroud) 我想迭代shell中的参数列表,我知道如何使用它
for var in $@
Run Code Online (Sandbox Code Playgroud)
但我想这样做
for ((i=3; i<=$#; i++))
Run Code Online (Sandbox Code Playgroud)
我需要这个,因为前两个参数不会进入循环.谁知道怎么做?期待你的帮助.
程
我使用inotify监视本地文件,例如"/ root/temp"使用
inotify_add_watch(fd, "/root/temp", mask).
Run Code Online (Sandbox Code Playgroud)
删除此文件时,程序将被read(fd, buf, bufSize)功能阻止.即使我创建了一个新的"/ root/temp"文件,程序仍然被读取函数阻塞.我想知道inotify是否可以检测到已创建受监视文件,并且读取函数可以从fd获取某些内容,以便不会永久阻止读取.这是我的代码:
uint32_t mask = IN_ALL_EVENTS;
int fd = inotify_init();
int wd = inotify_add_watch(fd, "/root/temp", mask);
char *buf = new char[1000];
int nbytes = read(fd, buf, 500);
Run Code Online (Sandbox Code Playgroud)
我监控了所有事件.
我是R.的新手.现在我的功能如下:
funItemAverRating = function()
{
itemRatingNum = array(0, itemNum);
print("begin");
apply(input, 1, function(x)
{
itemId = x[2]+1;
itemAverRating[itemId] <<- itemAverRating[itemId] + x[3];
itemRatingNum[itemId] <<- itemRatingNum[itemId] + 1;
}
);
}
Run Code Online (Sandbox Code Playgroud)
在这个函数中输入是一个n*3数据框,n是~6*(10e+7),itemRatingNum是一个大小的向量~3*(10e+5).
我的问题是为什么apply功能这么慢(完成需要将近一个小时)?此外,随着函数的运行,它会使用越来越多的内存.但正如您所看到的,变量都是在apply函数外部定义的.有谁能够帮我?
程