Implement support for passing an arg to INFO command #301

merged 3 commits into from Nov 30, 2012


None yet
2 participants

aouyar commented Nov 17, 2012

The INFO command in Redis Server has an optional parameter used to select a specific section. The implementation of the info command in redis-py does not implement the optional parameter. Without this parameter it is not possible to retrieve command counters and stats.

I've forked redis-py to implement support for passing a parameter to the INFO command. In older versions of Redis Server that do not support this optional parameter, the command would return an empty dictionary.

Hope you would find this patch worthy of adding to redis-py,
Thanks in advance.

I think this makes sense. However, the try/except based on the response here won't work in the case of pipelines. It should likely be moved to the parse_info() helper.


aouyar replied Nov 21, 2012

I have not tried using pipelines yet, but I can check to see if I can move the handling to parse_info() helper and try to do some testing with pipelines. The other option might be to leave out the error checking for older versions of Redis and let the user handle this error directly.

Just let me know what you would prefer and I can try to fix the implementation.

Thanks in advance...


aouyar commented Nov 27, 2012

After checking the code in more detail, it became apparent that handling of response errors occurs before the response callbacks and parse_info are executed and the current organization of the code does not facilitate the implementation of custom error handling routines for individual commands. In the end I decided to let the user handle the differences between server versions. If the section option is passed to an old version of Redis Server, redis-py will generate a ResponseError and the end user should retry without the section option.

Additionally, a bug in the handling of floats in nested values in the info results was discovered and fixed.

Please do not hesitate to contact me again if you think I should be doing something differently.I hope you would consider these changes worthy of inclusion in redis-py.

Thanks in advance,
Ali Onur Uyar


aouyar commented Nov 30, 2012

Any updates on this one?

andymccurdy pushed a commit that referenced this pull request Nov 30, 2012

Andy McCurdy
Merge pull request #301 from aouyar/master
Implement support for passing an arg to INFO command

@andymccurdy andymccurdy merged commit 7919499 into andymccurdy:master Nov 30, 2012

1 check passed

default The Travis build passed

andymccurdy commented Nov 30, 2012

this looks good. thanks!


aouyar commented Dec 1, 2012

You're welcome. I am glad that you merged it.

Thanks for making and sharing redis-py,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment