pipelines icon indicating copy to clipboard operation
pipelines copied to clipboard

container_component parameter check issue

Open hankug1234 opened this issue 11 months ago • 1 comments

/kind bug

What steps did you take and what happened: i use kfp v2.7.0 and i try to compile my pipeline dsl code

this is my container_component function signature

def whisper(audio: dsl.InputPath(Dataset), model: str, language: str, format: str, output_dir: dsl.OutputPath(Dataset)):

when i compile my code i get some error

Traceback (most recent call last): File "C:\Users\USER\PycharmProjects\pythonProject\kuberflow\main.py", line 9, in def my_component( File "C:\Users\USER\PycharmProjects\pythonProject\kuberflow\venv\lib\site-packages\kfp\dsl\container_component_decorator.py", line 53, in container_component return component_factory.create_container_component_from_func(func) File "C:\Users\USER\PycharmProjects\pythonProject\kuberflow\venv\lib\site-packages\kfp\dsl\component_factory.py", line 644, in create_container_component_from_func make_input_for_parameterized_container_component_function( File "C:\Users\USER\PycharmProjects\pythonProject\kuberflow\venv\lib\site-packages\kfp\dsl\component_factory.py", line 623, in make_input_for_parameterized_container_component_function placeholder._ir_type = type_utils.get_parameter_type_name( File "C:\Users\USER\PycharmProjects\pythonProject\kuberflow\venv\lib\site-packages\kfp\dsl\types\type_utils.py", line 217, in get_parameter_type_name raise ValueError( ValueError: param_type is not a parameter type. Cannot get ParameterType name.

when i see this document https://kubeflow-pipelines.readthedocs.io/en/latest/source/dsl.html#kfp.dsl.container_component

there is a example that

from kfp.dsl import container_component, ContainerSpec, InputPath, OutputPath, Output

@container_component def my_component( dataset_path: InputPath(Dataset), model: Output[Model], num_epochs: int, output_parameter: OutputPath(str), ): return ContainerSpec( image='gcr.io/my-image', command=['sh', 'my_component.sh'], args=[ '--dataset_path', dataset_path, '--model_path', model.path, '--output_parameter_path', output_parameter, ] )

so i understand container_component can use InputPath class

but

follow error log in found some code in "C:\Users\USER\PycharmProjects\pythonProject\kuberflow\venv\lib\site-packages\kfp\dsl\component_factory.py", line 623,

def make_input_for_parameterized_container_component_function( name: str, annotation: Union[Type[List[artifact_types.Artifact]], Type[artifact_types.Artifact]] ) -> Union[placeholders.Placeholder, container_component_artifact_channel .ContainerComponentArtifactChannel]:

this code check container_component parameter can acceptable

but it only accept artifact_wrapped_in_Input type, artifact_wrapped_in_Output type, OutputPath type and primitive type

so i think basically inputPath can't accepted in container_component but official document example talk inputPath class can acceptable

what is correct?

What did you expect to happen:

Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]

Environment:

  • kfp==2.7.0

hankug1234 avatar Mar 27 '24 02:03 hankug1234