doRedis
doRedis copied to clipboard
Example code for setGetTask contains a typo
The setGetTask example that can be found in the pdf documentation on CRAN contains a typoe. I very much hope, that setting getTask is still supported. I want to use to control the order of execution in a parallel foreach loop (which definitely would be awesome).
The example gives the following code example and imho misses a " and a closing bracket). Or maybe I am missing something.
getTask <- function(queue, job_id, ...)
{
key <- sprintf("
redisEval("local x=redis.call('hkeys',KEYS[1])[1];
if x==nil then return nil end;
local ans=redis.call('hget',KEYS[1],x);
redis.call('hdel',KEYS[1],x);i
return ans",key)
}
Many thanks for the great package though, this saved me already many hours of work and is much appreciated.
When comparing the default_getTask method, I guess now, that the "sprintf" line is truncated at the first percent sign and should look something like the following:
getTaskDefault <- function ( queue , job_id , ...)
{
key <- sprintf("%s:%s",queue, job_id)
return(redisEval("local x=redis.call('hkeys',KEYS[1])[1];
if x==nil then return nil end;
local ans=redis.call('hget',KEYS[1],x);
redis.call('set', KEYS[1] .. '.start.' .. x, x);
redis.call('hdel',KEYS[1],x);
return ans",key))
}
As it still needs to be corrected in the documentation, I of course leave it open.
thanks, traveling but will fix this weekend
On 1/18/17, thomaskisler [email protected] wrote:
As it still needs to be corrected in the documentation, I of course leave it open.
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/bwlewis/doRedis/issues/44#issuecomment-273454545