[feature] Support serializable classes as a parameter
Feature Area
/area sdk
What feature would you like to see?
Being able to send an argument that is a serializable class to a @dsl.component function
What is the use case or pain point?
Reduce code duplication.
Is there a workaround currently?
Copy and paste the function multiple times inside the @dsl.component
Code example that must work:
from kfp import dsl
from kfp.compiler import Compiler
from kfp import local
local.init(runner=local.SubprocessRunner())
class MyExample:
def do_sum(self, a, b):
return a + b
@dsl.component(base_image="docker.io/library/python:3.10")
def do_something(my_example: MyExample):
result = my_example.do_sum(1, 2)
assert result == 3
@dsl.pipeline(name="simple_example")
def my_pipeline():
my_example = MyExample()
task = do_something(my_example)
if __name__ == "__main__":
Compiler().compile(my_pipeline, "my_pipeline.yaml")
# Execute the pipeline directly
my_pipeline()
👏👏👏
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had recent activity. Please comment "/reopen" to reopen it.
/reopen
@diegolovison: Reopened this issue.
In response to this:
/reopen
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Any update on this?
/lifecycle frozen