一旦运行foreach循环,Windows 7上的doRedis就会给出错误 [英] doRedis on Windows 7 gives error as soon as foreach loop is run

查看:126
本文介绍了一旦运行foreach循环,Windows 7上的doRedis就会给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的设置,如下所示:

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" 

我正在尝试使用R中的doRedis包来设置集群.我的机器上安装了Redis的"2.8.2101"版本.首先,我尝试在本地计算机(在RStudio中)上运行作业:

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

我已检查Redis是否正在作为服务运行(重新分配返回"PONG")

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

但是,当我尝试运行一个简单的foreach循环时,出现以下错误;即使重新启动所有内容,我也会遇到相同的错误:

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}

sprintf(%s:%.0f.env",队列,ID)中的错误: 无效的格式'%.0f';对字符对象使用格式%s

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.

推荐答案

我在Ubuntu上遇到了与您相同的错误.我找到的解决方案在此网站上: https://github.com/bwlewis/doRedis/issues/23

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

简而言之,在R中运行此命令: options('redis:num'=TRUE)

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 :)

关于, 基甸

这篇关于一旦运行foreach循环,Windows 7上的doRedis就会给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆