Skip to content

Python: Add FUNCTION STATS command#1794

Merged
acarbonetto merged 17 commits intovalkey-io:mainfrom
Bit-Quill:python/integ_lotjonat_function_stats
Jul 4, 2024
Merged

Python: Add FUNCTION STATS command#1794
acarbonetto merged 17 commits intovalkey-io:mainfrom
Bit-Quill:python/integ_lotjonat_function_stats

Conversation

@jonathanl-bq
Copy link
Copy Markdown
Contributor

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 added the python 🐍 Python wrapper label Jul 3, 2024
@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
Copy Markdown
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
Copy Markdown

@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


@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
Copy Markdown

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
Copy Markdown
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
@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 <aaron.congo@improving.com>
Yury-Fridlyand pushed a commit to Bit-Quill/valkey-glide that referenced this pull request Jun 6, 2025
* 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 <aaron.congo@improving.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python 🐍 Python wrapper

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants