Skip to content

Commit

Permalink
refactor:add conditional for primitives
Browse files Browse the repository at this point in the history
Signed-off-by: zazulam <[email protected]>
  • Loading branch information
zazulam committed Sep 24, 2024
1 parent f930a37 commit b3f1d79
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions sdk/python/kfp/compiler/pipeline_spec_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,31 @@ def check_task_input_types(input_value, input_name, pipeline_task_spec, task,

elif isinstance(input_value, list):
for item in input_value:
check_task_input_types(item, input_name, pipeline_task_spec, task,
parent_component_inputs,
tasks_in_current_dag)
if isinstance(item, (pipeline_channel.PipelineArtifactChannel,
pipeline_channel.PipelineParameterChannel)):
check_task_input_types(item, input_name, pipeline_task_spec,
task, parent_component_inputs,
tasks_in_current_dag)
elif isinstance(item, (str, int, float, bool)):
pipeline_task_spec.inputs.parameters[
input_name].runtime_value.constant.CopyFrom(
to_protobuf_value(input_value))

elif isinstance(input_value, dict):
for _, value in input_value.items():
check_task_input_types(value, input_name, pipeline_task_spec, task,
parent_component_inputs,
tasks_in_current_dag)
for key, value in input_value.items():
if isinstance(value, (pipeline_channel.PipelineArtifactChannel,
pipeline_channel.PipelineParameterChannel)):
check_task_input_types(value, input_name, pipeline_task_spec,
task, parent_component_inputs,
tasks_in_current_dag)

elif isinstance(value, (str, int, float, bool)):
pipeline_task_spec.inputs.parameters[
input_name].runtime_value.CopyFrom(
to_protobuf_value(input_value))
# check_task_input_types(value, input_name, pipeline_task_spec, task,
# parent_component_inputs,
# tasks_in_current_dag)

elif isinstance(input_value, (str, int, float, bool)):
pipeline_channels = (
Expand Down

0 comments on commit b3f1d79

Please sign in to comment.