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

Support prerequisite clients in Python SDK #561

Open
gritukan opened this issue Apr 30, 2024 · 0 comments
Open

Support prerequisite clients in Python SDK #561

gritukan opened this issue Apr 30, 2024 · 0 comments
Labels
SDK SDK related

Comments

@gritukan
Copy link
Member

YTsaurus supports prerequisite transactions, this is a possibility to annotate any Cypress query with a list of transactions and the action (either read or write) will be executed if and only if transaction is still alive.

Python SDK supports prerequisite transactions as well, however interface is not perfect. Consider the following example or usage: https://github.com/ytsaurus/ytsaurus/blob/dfcacd4b69f19b59ade7e035d088d2edb079507d/yt/python/yt/wrapper/tests/test_command_params.py#L16C25-L16C58. It seems good (however, I'd prefer an explicit method .with_prerequiste) but it is actually error-prone.

def create_client_with_command_params(client=None, **kwargs):
"""Creates new client with command params."""
new_client = YtClient(config=deepcopy(get_config(client)))
set_option("COMMAND_PARAMS", kwargs, new_client)
return new_client
This method overrides provided option, so in case if client already has some preprequisite transactions they will be overridden by a new list, however the natural logic is to join both lists.

Maybe it's a good idea to make a list of prerequisites not a generic option but a separate list.

@Kontakter Kontakter added the SDK SDK related label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SDK SDK related
Projects
None yet
Development

No branches or pull requests

2 participants