如何解决在并行运行中启用引用的任何方式
我可以通过这个启用引用错误
options(error = function() {
calls <- sys.calls()
if (length(calls) >= 2L) {
sink(stderr())
on.exit(sink(NULL))
cat("Backtrace:\n")
calls <- rev(calls[-length(calls)])
for (i in seq_along(calls)) {
cat(i,": ",deparse(calls[[i]],nlines = 20L),"\n",sep = "")
}
for (i in calls) {
print(i) #,sep = "")
}
}
if (!interactive()) {
q(status = 1)
}
})
f <- function(x) x + 1
g <- function(x) f(x)
g("a")
我只想得到这个引用
Error in x + 1 : non-numeric argument to binary operator
Backtrace:
1: f(x)
2: g("a")
function(x) f(x)
g("a")
然而,引用在像这样的并行循环的情况下是没有用的:
> cl <- makeCluster(10)
> registerDoParallel(cl)
> d <- foreach (v=c(1:10),.packages=c('data.table','zoo','RcppRoll','bit64') ) %dopar% {
+
+
+ b = 6
+ g("a")
+ c = 1
+ }
Error in { : task 1 Failed - "non-numeric argument to binary operator"
Backtrace:
1: stop(simpleError(msg,call = expr))
2: e$fun(obj,substitute(ex),parent.frame(),e$data)
3: foreach(v= c(1:10),.packages = c("data.table","zoo","RcppRoll","bit64")) %dopar% { b = 6 g("a") c = 1}
stop(simpleError(msg,call = expr))
e$fun(obj,e$data)
foreach(v= c(1:10),"bit64")) %dopar% {
b = 6
g("a")
c = 1
}
除了
还有什么办法可以得到更多的细节追踪吗?Error in { : task 1 Failed - "non-numeric argument to binary operator"
更类似于非并行调用。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。