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

Python: Add FUNCTION STATS command #1794

Merged

Conversation

jonathanl-bq
Copy link
Collaborator

Issue #, if available:
N/A

This PR adds the FUNCTION STATS command for the Python wrapper.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jonathanl-bq jonathanl-bq marked this pull request as ready for review July 3, 2024 21:21
@jonathanl-bq jonathanl-bq requested a review from a team as a code owner July 3, 2024 21:21
function_count (int): Expected functions count.
"""
running_script_info = response.get(b"running_script")
if running_script_info == None and len(running_function) != 0:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use is None instead of == None, and is not None instead of != None in python

Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add a changelog entry

python/python/glide/async_commands/standalone_commands.py Outdated Show resolved Hide resolved
python/python/glide/constants.py Show resolved Hide resolved
@@ -7951,6 +7952,153 @@ async def test_function_delete_with_routing(
await redis_client.function_delete(lib_name)
assert "Library not found" in str(e)

@pytest.mark.parametrize("cluster_mode", [False])
@pytest.mark.parametrize("protocol", [ProtocolVersion.RESP2, ProtocolVersion.RESP3])
async def test_function_stats(self, redis_client: GlideClient):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename redis_client to glide_client

Returns information about the function that's currently running and information about the
available execution engines.

See https://redis.io/commands/function-stats/ for more details
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure we want to mix use redis.io and valkey.io? Most python commands use valkey.io though.

@acarbonetto acarbonetto merged commit b2d36d7 into valkey-io:main Jul 4, 2024
20 checks passed
@acarbonetto acarbonetto deleted the python/integ_lotjonat_function_stats branch July 4, 2024 18:17
cyip10 pushed a commit to Bit-Quill/valkey-glide that referenced this pull request Jul 16, 2024
* Add cluster and standalone versions of FUNCTION STATS commands

* Add transaction implementation for FUNCTION STATS

* Start adding tests for FUNCTION STATS

* Try finish implementing tests

* Fix some issues in the tests

* Fix tests

* Document check_function_stats_response

* Run linters and formatters

* Import pytest

* Fix import ordering

* Fix mypy errors

* Fix transaction tests

* Address PR comments

* Fix black lint

* Address minor PR comments

---------

Co-authored-by: aaron-congo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

5 participants