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

Infer consume operation if not present in dataset interface #859

Merged

Conversation

mrchtr
Copy link
Contributor

@mrchtr mrchtr commented Feb 16, 2024

Basic implementation, I still have to add tests. I wanted to get some feedback first.

  • Added a method to the lightweight components to generate a ComponentSpec based on the attributes.
  • Added a method in the pipeline to infer the consumption based on the ComponentSpec.
    In cases where a user hasn't specified a consume in the pipeline operations, we now infer this. If a component spec contains a consumes section and additionalProperties are set to true, we load all columns. If additionalProperties is set to false, we limit the columns defined in the component spec.

Fix #836

@property
def consumes_additional_properties(self) -> bool:
"""Returns a boolean indicating whether the component consumes additional properties."""
return self._specification.get("consumes", {}).get(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This might be nice to implement on the spec (same for the produces)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean in the OperationSpec?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I took a better look and never mind. I was lost in the many specs 😛 .

Copy link
Member

@RobbeSneyders RobbeSneyders left a comment

Choose a reason for hiding this comment

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

Thanks @mrchtr!

Left some comments, but they're mostly nits. Looks a lot cleaner now!

src/fondant/component/component.py Outdated Show resolved Hide resolved
src/fondant/pipeline/pipeline.py Outdated Show resolved Hide resolved
src/fondant/pipeline/pipeline.py Outdated Show resolved Hide resolved
logger.info(msg)
return None

# Component has consumes and additionalProperties, we will load all dataset columns
Copy link
Member

Choose a reason for hiding this comment

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

Wondering about the case here where there's both a schema and additionalProperties. But I guess this is fine for now. We might want to have more logic here once we add support for additionalProperties schemas instead of just the boolean.

src/fondant/pipeline/pipeline.py Outdated Show resolved Hide resolved
@RobbeSneyders RobbeSneyders merged commit 0de3f5c into main Feb 20, 2024
11 checks passed
@RobbeSneyders RobbeSneyders deleted the feature/passing-all-columns-to-the-write-component branch February 20, 2024 08: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.

Passing all columns to the write component when no consumes is specified
3 participants