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

chore: set max_retries in CommitProperties #2826

Merged
merged 7 commits into from
Sep 12, 2024

Conversation

helanto
Copy link
Contributor

@helanto helanto commented Aug 25, 2024

Description

Adds a with_max_retries in CommitProperties. Allow for clients to control the maximum number of times a commit will be retried before failing.

Related Issue(s)

Documentation

@github-actions github-actions bot added the binding/rust Issues for the Rust crate label Aug 25, 2024
Copy link

ACTION NEEDED

delta-rs follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

@helanto helanto force-pushed the set-max-retries-in-CommitProperties branch from cd47e2e to 8328f34 Compare August 25, 2024 14:26
@helanto helanto changed the title chore: Set max_retries in CommitProperties chore: set max_retries in CommitProperties Aug 25, 2024
@ion-elgreco
Copy link
Collaborator

This needs to be exposed for python users as well

rtyler
rtyler previously approved these changes Aug 26, 2024
@helanto helanto force-pushed the set-max-retries-in-CommitProperties branch from 7c2c324 to 3f5be93 Compare August 28, 2024 15:40
@helanto helanto requested a review from fvaleye as a code owner August 29, 2024 11:56
@github-actions github-actions bot added the binding/python Issues for the Python package label Aug 29, 2024
@helanto
Copy link
Contributor Author

helanto commented Aug 29, 2024

This needs to be exposed for python users as well

Not super familiar with how Python binding works. Made an attempt to expose the max_commit_retries in Python API. Let me know what you think. @ion-elgreco

@ion-elgreco
Copy link
Collaborator

@helanto Hmm perhaps we can introduce a CommitProperties class, where you have custom_metadata and commit_retries as variables, this would be a breaking change, so we need to warn users that custom_metadata should be passed into CommitProperties

@helanto helanto force-pushed the set-max-retries-in-CommitProperties branch 2 times, most recently from 0fb6fb6 to adf96ec Compare September 3, 2024 07:30
@helanto
Copy link
Contributor Author

helanto commented Sep 3, 2024

@helanto Hmm perhaps we can introduce a CommitProperties class, where you have custom_metadata and commit_retries as variables, this would be a breaking change, so we need to warn users that custom_metadata should be passed into CommitProperties

I believe I made the change. How do we warn users @ion-elgreco ?

@ion-elgreco
Copy link
Collaborator

@helanto Hmm perhaps we can introduce a CommitProperties class, where you have custom_metadata and commit_retries as variables, this would be a breaking change, so we need to warn users that custom_metadata should be passed into CommitProperties

I believe I made the change. How do we warn users @ion-elgreco ?

You can check in other places of the code base, where we show a warn when a parameter is passed that is deprecated

@helanto
Copy link
Contributor Author

helanto commented Sep 3, 2024

You can check in other places of the code base, where we show a warn when a parameter is passed that is deprecated

This means that we keep both parameters around. Do you have something in mind along the following lines?

def operation(
    ....,
    custom_metadata: Optional[Dict[str, str]] = None,  # We keep this around for compatibility reasons.
    commit_properties: OptionalCommit[Properties] = None,
):
    if custom_metadata is not None:
        warn("Please provide custom_metadata as part of commit_properties").
    ...

@ion-elgreco
Copy link
Collaborator

You can check in other places of the code base, where we show a warn when a parameter is passed that is deprecated

This means that we keep both parameters around. Do you have something in mind along the following lines?

def operation(
    ....,
    custom_metadata: Optional[Dict[str, str]] = None,  # We keep this around for compatibility reasons.
    commit_properties: OptionalCommit[Properties] = None,
):
    if custom_metadata is not None:
        warn("Please provide custom_metadata as part of commit_properties").
    ...

Yess, and then custom_metadata can be dropped in later versions

@ion-elgreco ion-elgreco force-pushed the set-max-retries-in-CommitProperties branch from adf96ec to ecd2a08 Compare September 7, 2024 10:35
@ion-elgreco
Copy link
Collaborator

@helanto do you have time to make that change? Because then we can merge : )

Copy link

codecov bot commented Sep 7, 2024

Codecov Report

Attention: Patch coverage is 0% with 61 lines in your changes missing coverage. Please review.

Project coverage is 72.66%. Comparing base (8ba4fe0) to head (289fd00).

Files with missing lines Patch % Lines
python/src/lib.rs 0.00% 55 Missing ⚠️
crates/core/src/operations/transaction/mod.rs 0.00% 4 Missing ⚠️
python/src/merge.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2826      +/-   ##
==========================================
- Coverage   72.67%   72.66%   -0.02%     
==========================================
  Files         131      131              
  Lines       39957    39962       +5     
  Branches    39957    39962       +5     
==========================================
- Hits        29040    29037       -3     
- Misses       9059     9064       +5     
- Partials     1858     1861       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rtyler rtyler marked this pull request as draft September 9, 2024 14:11
@helanto
Copy link
Contributor Author

helanto commented Sep 10, 2024

@helanto do you have time to make that change? Because then we can merge : )

Yes I will work on it today!

@helanto helanto force-pushed the set-max-retries-in-CommitProperties branch 2 times, most recently from 1110cb5 to 640a0c6 Compare September 10, 2024 07:50
@helanto
Copy link
Contributor Author

helanto commented Sep 10, 2024

@helanto do you have time to make that change? Because then we can merge : )

Yes I will work on it today!

I believe I made the changes if you can take a look @ion-elgreco

@helanto helanto marked this pull request as ready for review September 10, 2024 08:37
@ion-elgreco
Copy link
Collaborator

@helanto just one more thing, commit_metadata in the pyo3 functions can be removed, and in Python if custom metadata is still passed, you can wrap it into CommitPropeti e

@helanto helanto force-pushed the set-max-retries-in-CommitProperties branch from 640a0c6 to 956fd54 Compare September 11, 2024 07:31
@helanto
Copy link
Contributor Author

helanto commented Sep 11, 2024

@helanto just one more thing, commit_metadata in the pyo3 functions can be removed, and in Python if custom metadata is still passed, you can wrap it into CommitPropeti e

I look at pyo3 function definitions and they don't have any commit_metadata argument ? Do you mean custom_metadata ? The pyo3 functions look like the following:

#[pyo3(signature = ...)]
pub fn some_function(
        ...,
        custom_metadata: Option<HashMap<String, String>>,
        max_commit_retries: Option<usize>,
)

I can create a pyo3 class that wraps custom_metadata and max_commit_retries, similar to PyPostCommitHookProperties here. At the moment the CommitProperties only exist as a publicly facing Python class, it's not a pyo3 class. @ion-elgreco

@ion-elgreco
Copy link
Collaborator

ion-elgreco commented Sep 11, 2024

Yeah I meant custom_metadata. We need a rust struct which has a derive indeed

@helanto helanto force-pushed the set-max-retries-in-CommitProperties branch 3 times, most recently from 5ef3095 to b4fd5cf Compare September 11, 2024 17:08
@helanto
Copy link
Contributor Author

helanto commented Sep 11, 2024

Yeah I meant custom_metadata. We need a rust struct which has a derive indeed

Now it should be good! Let me know what you think @ion-elgreco

@helanto helanto force-pushed the set-max-retries-in-CommitProperties branch from b4fd5cf to ab30ac0 Compare September 11, 2024 17:22
@helanto helanto force-pushed the set-max-retries-in-CommitProperties branch from ab30ac0 to 39093c7 Compare September 11, 2024 17:32
ion-elgreco
ion-elgreco previously approved these changes Sep 12, 2024
Copy link
Collaborator

@ion-elgreco ion-elgreco left a comment

Choose a reason for hiding this comment

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

Thankss!!

@rtyler rtyler added this pull request to the merge queue Sep 12, 2024
Merged via the queue into delta-io:main with commit 507b50e Sep 12, 2024
24 checks passed
@helanto helanto deleted the set-max-retries-in-CommitProperties branch September 13, 2024 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding/python Issues for the Python package binding/rust Issues for the Rust crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants