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

feat: add MinIO configuration #20

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

feat: add MinIO configuration #20

wants to merge 13 commits into from

Conversation

psankhe28
Copy link
Collaborator

@psankhe28 psankhe28 commented Sep 5, 2024

Description

Added configuration variables required for MinIO.

  • Fixes #(issue number)

Fixes #18

Checklist

  • My code follows the contributing guidelines
    of this project, including, in particular, with regard to any style guidelines
  • The title of my PR complies with the
    Conventional Commits specification; in particular, it clearly
    indicates that a change is a breaking change
  • I acknowledge that all my commits will be squashed into a single commit,
    using the PR title as the commit message
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have updated the user-facing documentation to describe any new or
    changed behavior
  • I have added type annotations for all function/class/method interfaces
    or updated existing ones (only for Python, TypeScript, etc.)
  • I have provided appropriate documentation
    (Google-style Python docstrings) for all
    packages/modules/functions/classes/methods or updated existing ones
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature
    works
  • New and existing unit tests pass locally with my changes
  • I have not reduced the existing code coverage

Comments

Summary by Sourcery

Add support for MinIO configuration and client management, enabling the application to interact with MinIO storage. This includes defining configuration settings, creating a MinIO client, and handling bucket creation. Additionally, enhance the application with a custom configuration model and utility functions to manage configurations.

New Features:

  • Introduce MinIO configuration support, including hostname, port, access key, secret key, and bucket name settings.
  • Add a MinIO client for managing MinIO configurations and bucket creation within the application.

Enhancements:

  • Implement a custom configuration model for the FOCA app to handle MinIO settings.
  • Add utility functions to retrieve configuration paths and custom configurations.

Documentation:

  • Document the MinIO configuration model, including attributes and examples, for user reference.

Signed-off-by: Pratiksha Sankhe <[email protected]>
Copy link
Contributor

sourcery-ai bot commented Sep 5, 2024

Reviewer's Guide by Sourcery

This pull request adds MinIO configuration support to the cloud storage handler. It introduces new configuration variables, a MinioClient class for managing MinIO client setup and bucket creation, and updates the configuration model to include MinIO settings. The changes improve the modularity and maintainability of the code while providing necessary functionality for MinIO integration.

File-Level Changes

Change Details Files
Add MinIO configuration to the YAML config file
  • Introduce 'custom' section in the YAML config
  • Add MinIO-specific configuration parameters (hostname, port, access_key, secret_key, bucket_name)
deployment/config.yaml
Implement MinioClient class for managing MinIO operations
  • Create MinioClient class with initialization and bucket creation methods
  • Implement MinioConfig class for loading and parsing MinIO configuration
  • Add error handling for configuration not found scenarios
cloud_storage_handler/clients/minio_client.py
Update main application to use MinIO client
  • Import and initialize MinioClient in the main application
  • Create MinIO bucket on application startup
  • Update Foca initialization to use custom config model
cloud_storage_handler/main.py
Add Pydantic models for MinIO configuration
  • Create MinioConfig model with validation for configuration parameters
  • Add type annotations and default values for MinIO configuration
cloud_storage_handler/api/elixircloud/csh/models.py
Implement utility functions for configuration management
  • Add function to get configuration file path
  • Implement function to load custom configuration
cloud_storage_handler/utils.py
Create custom configuration model for the FOCA app
  • Define CustomConfig class inheriting from BaseModel
  • Include MinioConfig as a field in CustomConfig
cloud_storage_handler/custom_config.py
Add new exception for configuration not found errors
  • Create ConfigNotFoundError class
cloud_storage_handler/exceptions.py

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @psankhe28 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 2 issues found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

deployment/config.yaml Show resolved Hide resolved
cloud_storage_handler/minio_client.py Outdated Show resolved Hide resolved
cloud_storage_handler/consts.py Outdated Show resolved Hide resolved
cloud_storage_handler/api/elixircloud/csh/models.py Outdated Show resolved Hide resolved
cloud_storage_handler/minio_client.py Outdated Show resolved Hide resolved
cloud_storage_handler/consts.py Outdated Show resolved Hide resolved
cloud_storage_handler/minio_client.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4f7c103) to head (bfac0b9).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #20   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines           23        23           
=========================================
  Hits            23        23           
Flag Coverage Δ
test_integration 100.00% <ø> (ø)
test_unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Signed-off-by: Pratiksha Sankhe <[email protected]>
@psankhe28 psankhe28 marked this pull request as draft September 5, 2024 07:59
Signed-off-by: Pratiksha Sankhe <[email protected]>
Signed-off-by: Pratiksha Sankhe <[email protected]>
Signed-off-by: Pratiksha Sankhe <[email protected]>
@psankhe28 psankhe28 marked this pull request as ready for review September 5, 2024 18:11
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @psankhe28 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please add comprehensive unit tests for the new MinIO functionality to ensure reliability and ease of future maintenance.
  • Consider adding more detailed docstrings for public methods and classes, particularly in the new files like minio_client.py and custom_config.py.
  • In the MinioConfig class, consider adding a warning log when falling back to default configurations to encourage users to provide their own settings.
Here's what I looked at during the review
  • 🟡 General issues: 5 issues found
  • 🟡 Security: 2 issues found
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

deployment/config.yaml Show resolved Hide resolved
deployment/config.yaml Outdated Show resolved Hide resolved
cloud_storage_handler/minio_client.py Outdated Show resolved Hide resolved
cloud_storage_handler/minio_client.py Outdated Show resolved Hide resolved
cloud_storage_handler/consts.py Outdated Show resolved Hide resolved
cloud_storage_handler/consts.py Outdated Show resolved Hide resolved
cloud_storage_handler/utils.py Show resolved Hide resolved
cloud_storage_handler/minio_client.py Outdated Show resolved Hide resolved
cloud_storage_handler/minio_client.py Outdated Show resolved Hide resolved
Copy link
Member

@uniqueg uniqueg left a comment

Choose a reason for hiding this comment

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

I'm a bit confused. Started reviewing and found that some of the things are already addressed further down in some other/better way. Can you make sure the PR is cleaned up and only what needs to be in here (in the best possible way) is in here?

cloud_storage_handler/consts.py Outdated Show resolved Hide resolved
cloud_storage_handler/consts.py Outdated Show resolved Hide resolved
cloud_storage_handler/consts.py Outdated Show resolved Hide resolved
cloud_storage_handler/consts.py Outdated Show resolved Hide resolved
cloud_storage_handler/api/elixircloud/csh/models.py Outdated Show resolved Hide resolved
cloud_storage_handler/api/elixircloud/csh/models.py Outdated Show resolved Hide resolved
cloud_storage_handler/api/elixircloud/csh/models.py Outdated Show resolved Hide resolved
cloud_storage_handler/api/elixircloud/csh/models.py Outdated Show resolved Hide resolved
Signed-off-by: Pratiksha Sankhe <[email protected]>
@psankhe28 psankhe28 marked this pull request as draft September 10, 2024 18:34
Signed-off-by: Pratiksha Sankhe <[email protected]>
@psankhe28 psankhe28 marked this pull request as ready for review September 11, 2024 15:22
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @psankhe28 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟡 Security: 2 issues found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟡 Documentation: 3 issues found

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

deployment/config.yaml Show resolved Hide resolved
cloud_storage_handler/main.py Outdated Show resolved Hide resolved
cloud_storage_handler/clients/minio_client.py Outdated Show resolved Hide resolved
cloud_storage_handler/clients/minio_client.py Outdated Show resolved Hide resolved
docs/source/pages/cloud_storage_handler.rst Show resolved Hide resolved
docs/source/pages/cloud_storage_handler.rst Show resolved Hide resolved
cloud_storage_handler/clients/minio_client.py Outdated Show resolved Hide resolved
Signed-off-by: Pratiksha Sankhe <[email protected]>
Signed-off-by: Pratiksha Sankhe <[email protected]>
@psankhe28 psankhe28 self-assigned this Sep 11, 2024
Signed-off-by: Pratiksha Sankhe <[email protected]>
Signed-off-by: Pratiksha Sankhe <[email protected]>
cloud_storage_handler/api/elixircloud/csh/models.py Outdated Show resolved Hide resolved
cloud_storage_handler/clients/minio.py Show resolved Hide resolved
"""Initialize MinioConfig with a configuration file.

Args:
config_file (str): Path to the configuration file. If not provided,
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove datatype in all the pydocs, Ill leave it to you and wont comment again as its repetitive :).

Copy link
Collaborator

Choose a reason for hiding this comment

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

@psankhe28 you have resolved this conversation (mmaybe by mistake), but haven't remove d the datatype from pydocs?

# Current
config_file (str): Path to the configuration file.

# Change to
config_file : Path to the configuration file.

Copy link
Collaborator Author

@psankhe28 psankhe28 Sep 30, 2024

Choose a reason for hiding this comment

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

Sorry @JaeAeich , I couldn't find this line: config_file (str): Path to the configuration file.
I have removed it already

cloud_storage_handler/clients/minio_client.py Outdated Show resolved Hide resolved
cloud_storage_handler/clients/minio_client.py Outdated Show resolved Hide resolved
cloud_storage_handler/clients/minio_client.py Outdated Show resolved Hide resolved
cloud_storage_handler/clients/minio_client.py Outdated Show resolved Hide resolved
cloud_storage_handler/clients/minio_client.py Outdated Show resolved Hide resolved
cloud_storage_handler/main.py Outdated Show resolved Hide resolved
Signed-off-by: Pratiksha Sankhe <[email protected]>
Signed-off-by: Pratiksha Sankhe <[email protected]>
@JaeAeich
Copy link
Collaborator

@psankhe28 Can you please go through the previous conversation again (ping me here itself if something doesn't make sense), but I see there are alot of convos that have been closed but not resolved, it makes no sense for me to rewrite those review as they haven't been resolved.

@psankhe28
Copy link
Collaborator Author

@psankhe28 Can you please go through the previous conversation again (ping me here itself if something doesn't make sense), but I see there are alot of convos that have been closed but not resolved, it makes no sense for me to rewrite those review as they haven't been resolved.

@JaeAeich , I think you have not seen the updated version.
The previous two comments were based on outdated version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

feat: MinIO configuration
3 participants