Skip to content

Fix for compatibility with Kedro 0.18.4 onwards#22

Open
Zubin Roy (Prospect-Zubin) wants to merge 1 commit into
getindata:developfrom
Prospect-Zubin:fix/kedro-version-compatibility
Open

Fix for compatibility with Kedro 0.18.4 onwards#22
Zubin Roy (Prospect-Zubin) wants to merge 1 commit into
getindata:developfrom
Prospect-Zubin:fix/kedro-version-compatibility

Conversation

@Prospect-Zubin

Copy link
Copy Markdown

Updates to allow integration with kedro 0.18.4 > onwards which uses OmegaConfigLoader which replaced the legacy ConfigLoader and TemplatedConfigLoader previously used. Updates also allow for backwards integration for versions of kedro <= 0.18.4.

Updates also added user flexibility for choice of docker image platform architecture which allows for multi-architecture docker images.

As a result of the codebase changes updates to the affected unit tests were made.

This is my first PR for a public codebase so any feedback or comments is appreciated :)

…megaConfigLoader which replaced the legacy ConfigLoader and TemplatedConfigLoader previously used. Updates also allow for backwards integration for versions of kedro <= 0.18.4.

Updates also added user flexibility for choice of docker image platform architecture which allows for multi-architecture docker images.

As a result of the codebase changes updates to the affected unit tests were made.
Comment thread kedro_sagemaker/utils.py
Comment on lines +11 to +13
import kedro
from kedro.framework.session import KedroSession
from packaging import version

Choose a reason for hiding this comment

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

You might want to use importlib.metadata instead of relying on packaging.version and kedro.__version__ https://docs.python.org/3.9/library/importlib.metadata.html#metadata

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure happy to make that change. What is the benefit of doing it that way rather than using packaging.version?

Choose a reason for hiding this comment

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

Using packaging.version might be unavoidable if you want to parse it. The key is how to obtain the currently installed version, and importlib.metadata is the canonical way I'd say. See pallets/flask#5230

@DimedS Dmitry Sorokin (DimedS) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for the PR, your interest in the plugin, and the time you've spent improving it, Zubin Roy (@Prospect-Zubin)! I really like the idea of adding platform support and have asked a question about incorporating the OmegaConf Loader.

Additionally, I noticed that starting from Kedro version 0.19, a few other changes are needed to make kedro-sagemaker work properly. I plan to address those in a separate PR once we reach an agreement on this one.

Comment thread kedro_sagemaker/utils.py

if current_version > required_version:
return KedroSageMakerPluginConfig.parse_obj(
self.context.config_loader["parameters"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you please clarify how this should work? If I understand correctly, the SageMaker configuration is stored in the sagemaker.yml file, and it will not be loaded into the parameters section by OmegaConf because only the following patterns are configured to be read:

self.config_patterns = {
    "catalog": ["catalog*", "catalog*/**", "**/catalog*"],
    "parameters": ["parameters*", "parameters*/**", "**/parameters*"],
    "credentials": ["credentials*", "credentials*/**", "**/credentials*"],
    "globals": ["globals.yml"],
}

Even if it were loaded along with other parameters, Pydantic would raise a validation error during the parsing process.

Comment thread kedro_sagemaker/utils.py
Comment thread kedro_sagemaker/utils.py
rv = subprocess.run(
[
"docker",
"buildx",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

buildx build?

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.

4 participants