Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example code for setGetTask contains a typo #44

Open
thomaskisler opened this issue Jan 16, 2017 · 3 comments
Open

Example code for setGetTask contains a typo #44

thomaskisler opened this issue Jan 16, 2017 · 3 comments

Comments

@thomaskisler
Copy link

thomaskisler commented Jan 16, 2017

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.

@thomaskisler
Copy link
Author

thomaskisler commented Jan 18, 2017

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

@thomaskisler
Copy link
Author

As it still needs to be corrected in the documentation, I of course leave it open.

@thomaskisler thomaskisler reopened this Jan 18, 2017
@bwlewis
Copy link
Owner

bwlewis commented Jan 20, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants