doRedis on Windows 7 gives error as soon as foreach loop is run

江枫思渺然 提交于 2019-12-10 22:18:22

问题


I have a simple setup as follows:

Sys.info()
                 sysname                      release                      version                     nodename 
               "Windows"                      "7 x64" "build 7601, Service Pack 1"                "OCTAVE-WS21" 
                 machine                        login                         user               effective_user 
                "x86-64"                      "kjain"                      "kjain"                      "kjain" 

I am trying to use doRedis package in R to set up a cluster. I have "2.8.2101" version of Redis installed on my machine. To begin with, I tried to run a job on my local machine (in RStudio):

library(doRedis)
registerDoRedis('jobs')
getDoParName()
#[1] "doRedis"
getDoParRegistered()
#[1] TRUE
startLocalWorkers(n = 2,queue = 'jobs')
getDoParWorkers()
#[1] 2

I have checked that Redis is running as a service (redis-cli ping returns 'PONG')

But, when I try to run a simple foreach loop I get the following error; I get the same error even if I restart everything:

workerIndex = foreach(i=1:100) %dopar% {i}

Error in sprintf("%s:%.0f.env", queue, ID) : invalid format '%.0f'; use format %s for character objects

Obviously, the sequential version works fine:

workerIndex = foreach(i=1:100) %do% {i}
workerIndex
#[[1]]
#[1] 1

#[[2]]
#[1] 2
etc.

Please help! Any comments/pointers are appreciated. Please let me know if you need more information.


回答1:


I just encountered the same error as you, however on Ubuntu. The solution I found was on this website: https://github.com/bwlewis/doRedis/issues/23

In short run this in R: options('redis:num'=TRUE)

If you are curious what the source of the error is feel free to click the link and read about it :)

Regards, Gideon



来源:https://stackoverflow.com/questions/31939951/doredis-on-windows-7-gives-error-as-soon-as-foreach-loop-is-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!