Skip to content

Fix materializer type compatibility check during loading #3105

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

Merged
merged 4 commits into from
Oct 28, 2024

Conversation

schustmi
Copy link
Contributor

Describe changes

The issubclass(...) checks in BaseMaterializer.can_handle_type were only correct when saving artifacts and not when loading them.

  • A materializer can save any artifact that is an associated type or a subclass of an associated type.
  • A user can specify a superclass of an associated type as step input and the materializer can be used to load this artifact
class Parent:
  value: int

class Child(Parent):
  another_value: int

class ChildMaterializer(BaseMaterializer):
  ASSOCIATED_TYPES = (Child,)
  
  ...

@step
def producer() -> Child:
  return Child(value=1, another_value=2)

@step
def consumer(parent: Parent) -> None:
  pass

@pipeline
def test():
  consumer(producer())

Pre-requisites

Please ensure you have done the following:

  • I have read the CONTRIBUTING.md document.
  • If my change requires a change to docs, I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have based my new branch on develop and the open PR is targeting develop. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.
  • If my changes require changes to the dashboard, these changes are communicated/requested.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Other (add details above)

@github-actions github-actions bot added internal To filter out internal PRs and issues bug Something isn't working labels Oct 21, 2024
@schustmi schustmi requested a review from bcdurak October 22, 2024 07:10
Copy link
Contributor

@bcdurak bcdurak left a comment

Choose a reason for hiding this comment

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

🦭

@schustmi schustmi merged commit a347a24 into develop Oct 28, 2024
49 of 51 checks passed
@schustmi schustmi deleted the bugfix/materializer-type-compatibility-when-loading branch October 28, 2024 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internal To filter out internal PRs and issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants