-
Notifications
You must be signed in to change notification settings - Fork 84
Python: Add Batch support #3555
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
base: main
Are you sure you want to change the base?
Python: Add Batch support #3555
Conversation
d4fb032
to
41dc46b
Compare
Please don't forget changelog |
bae1fb6
to
76dda70
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job 🚀
CHANGELOG.md
Outdated
@@ -1,5 +1,5 @@ | |||
#### Changes | |||
|
|||
* Python: Add python pipeline support ([#3555](https://github.com/valkey-io/valkey-glide/pull/3555)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Python: Add python pipeline support ([#3555](https://github.com/valkey-io/valkey-glide/pull/3555)) | |
* Python: Add Batches support ([#3555](https://github.com/valkey-io/valkey-glide/pull/3555)) |
python/dev_requirements.txt
Outdated
sphinx-rtd-theme | ||
deprecated >= 1.2.18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deprecated >= 1.2.18 | |
deprecated >= 1.2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deprecated >= 1.2.18 | |
deprecated |
maybe, u should check whats best
>>> transaction = BaseTransaction() | ||
Transaction vs Pipeline: | ||
- Transactions (is_atomic=True) ensure that all commands are executed atomically. | ||
In a transaction, all keys must belong to the same slot. This means if any key is in a different slot, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a transaction, all keys must belong to the same slot.
- this is not the place for this doc, it should be in ClusterBatch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all this section can be removed
python/python/tests/test_batch.py
Outdated
|
||
for _, info in result[0].items(): | ||
assert isinstance(info, bytes) | ||
assert config_key in info.decode() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confiig_key: config_value in info.decode()
python/python/tests/test_batch.py
Outdated
|
||
pipeline.get(key) | ||
|
||
with pytest.raises(RequestError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check the error message
python/python/tests/test_batch.py
Outdated
assert result[4] == b"value1" | ||
assert result[5] == b"value2" | ||
|
||
assert isinstance(result[2], Exception) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert isinstance(result[2], Exception) | |
assert isinstance(result[2], RequestError) |
python/python/tests/test_batch.py
Outdated
assert isinstance(result[2], Exception) | ||
assert "wrong number of arguments" in str(result[2]) | ||
|
||
assert isinstance(result[3], Exception) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert isinstance(result[3], Exception) | |
assert isinstance(result[3], RequestError) |
python/python/tests/test_batch.py
Outdated
|
||
@pytest.mark.parametrize("cluster_mode", [True, False]) | ||
@pytest.mark.parametrize("protocol", [ProtocolVersion.RESP2, ProtocolVersion.RESP3]) | ||
async def test_pipeline_timeout(self, glide_client: TGlideClient): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge this with the transaction test and call it test batch timeout
@@ -253,6 +253,7 @@ jobs: | |||
run: | | |||
python -m pip install --upgrade pip | |||
pip install sphinx sphinx-rtd-theme | |||
pip install -r dev_requirements.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note changes coming from #3541
python/python/tests/test_batch.py
Outdated
] | ||
) | ||
transaction.fcall(func_name, [], arguments=["one", "two"]) | ||
if batch.is_atomic: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Are there any restrictions for function commands in pipelines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its because function commands are routed to all nodes, so the response is different
Signed-off-by: BoazBD <[email protected]>
Signed-off-by: BoazBD <[email protected]>
Signed-off-by: BoazBD <[email protected]>
Signed-off-by: BoazBD <[email protected]>
Signed-off-by: BoazBD <[email protected]>
Signed-off-by: BoazBD <[email protected]>
Signed-off-by: BoazBD <[email protected]>
Signed-off-by: BoazBD <[email protected]>
Signed-off-by: BoazBD <[email protected]>
0fe1f67
to
d898b8e
Compare
Signed-off-by: BoazBD <[email protected]>
Signed-off-by: BoazBD <[email protected]>
Issue link
This Pull Request is linked to issue (URL): 3546
Checklist
Before submitting the PR make sure the following are checked: