-
Notifications
You must be signed in to change notification settings - Fork 25
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
Integrate argument inference #788
Conversation
@@ -20,7 +20,7 @@ def __post_init__(self): | |||
self.base_image = "fondant:latest" | |||
|
|||
|
|||
class PythonComponent: | |||
class PythonComponent(BaseComponent): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed this to satisfy typing.
) | ||
|
||
DockerCompiler().compile(pipeline) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This expands the coverage of this test by including the compilation without errors of lightweight components.
@@ -42,12 +42,12 @@ def wrapper(cls): | |||
|
|||
# updated=() is needed to prevent an attempt to update the class's __dict__ | |||
@wraps(cls, updated=()) | |||
class AppliedPythonComponent(cls, PythonComponent): | |||
class PythonComponentOp(cls, PythonComponent): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The component is not applied yet at this point.
97cc1ea
to
e52a5c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Robbe!
examples/sample_pipeline/pipeline.py
Outdated
return dataframe | ||
|
||
|
||
_ = dataset.apply( | ||
ref=CalculateChunkLength, | ||
consumes={"text": pa.string()}, | ||
produces={"chunk_length": pa.int32()}, | ||
arguments={"feature_name": "chunk_length"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit confusing, can't we just keep it as it was before and pass a random string argument
src/fondant/pipeline/pipeline.py
Outdated
@@ -222,6 +223,7 @@ def from_ref(cls, ref: t.Any, **kwargs) -> "ComponentOp": | |||
description=description, | |||
consumes={"additionalProperties": True}, | |||
produces={"additionalProperties": True}, | |||
args={k: v.to_spec() for k, v in infer_arguments(ref).items()}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args={k: v.to_spec() for k, v in infer_arguments(ref).items()}, | |
args={arg_name: arg.to_spec() for arg_name, arg in infer_arguments(ref).items()}, |
just for clarity
examples/sample_pipeline/pipeline.py
Outdated
return dataframe | ||
|
||
|
||
_ = dataset.apply( | ||
ref=CalculateChunkLength, | ||
consumes={"text": pa.string()}, | ||
produces={"chunk_length": pa.int32()}, | ||
arguments={"feature_name": "chunk_length"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: looks on a first view a bit confusing. Could we pass an dummy argument which is not used and keep dataframe["chunk_length"]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great minds think alike
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no comment only approve
Follow-up to use the argument inference functionality added in #763