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

Refactors mongodb persister a little #472

Merged
merged 2 commits into from
Dec 13, 2024
Merged

Refactors mongodb persister a little #472

merged 2 commits into from
Dec 13, 2024

Conversation

skrawcz
Copy link
Contributor

@skrawcz skrawcz commented Dec 13, 2024

This is so that we can more easily test the persister, but allowing one to inject a custom client. The old way prevented that. This now then makes the behavior inline with the other persisters.

Changes

  • mongodb persister

How I tested this

  • unit tests

Notes

  • to bring it up to par

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

Important

Refactors MongoDB persister to allow custom client injection, introduces MongoDBBasePersister, and deprecates MongoDBPersister.

  • Refactoring:
    • Introduces MongoDBBasePersister in b_mongodb.py for custom MongoDB client injection.
    • Deprecates MongoDBPersister, maintaining backward compatibility.
  • Documentation:
    • Updates persister.rst to reference MongoDBBasePersister.
  • Testing:
    • Updates test_b_mongodb.py to use MongoDBBasePersister.
    • Adds test for backward compatibility with MongoDBPersister.

This description was created by Ellipsis for 1d26f53. It will automatically update as commits are pushed.

This is so that we can more easily test the persister,
but allowing one to inject a custom client. The old
way prevented that. This now then makes the behavior
inline with the other persisters.
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 59907ad in 53 seconds

More details
  • Looked at 157 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. burr/integrations/persisters/b_mongodb.py:44
  • Draft comment:
    Consider handling the default assignment of serde_kwargs in the __init__ method to avoid redundancy.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The from_values method in MongoDBBasePersister uses a default value for serde_kwargs as None and then assigns an empty dictionary if it is None. This pattern is repeated in the __init__ method. It would be more efficient to handle this default assignment in one place, preferably in the __init__ method, to avoid redundancy.
2. burr/integrations/persisters/b_mongodb.py:45
  • Draft comment:
    Consider handling the default assignment of mongo_client_kwargs in the __init__ method to avoid redundancy.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The from_values method in MongoDBBasePersister uses a default value for mongo_client_kwargs as None and then assigns an empty dictionary if it is None. This pattern is repeated in the __init__ method of MongoDBPersister. It would be more efficient to handle this default assignment in one place, preferably in the __init__ method, to avoid redundancy.

Workflow ID: wflow_fQAvXc4PO3Ai249v


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

github-actions bot commented Dec 13, 2024

A preview of 1d26f53 is uploaded and can be seen here:

https://burr.dagworks.io/pull/472

Changes may take a few minutes to propagate. Since this is a preview of production, content with draft: true will not be rendered. The source is here: https://github.com/DAGWorks-Inc/burr/tree/gh-pages/pull/472/

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 1d26f53 in 12 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_0lYwCtw0m5QkOfIS


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@skrawcz skrawcz merged commit 1c36e6c into main Dec 13, 2024
11 checks passed
@skrawcz skrawcz deleted the refactor_mongodb branch December 13, 2024 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants