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

SDK/Components - Command line args can only be strings or placeholders #711

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions sdk/python/kfp/components/_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,14 @@ def __init__(self,
super().__init__(locals())


CommandlineArgumentType = Optional[Union[
PrimitiveTypes, InputValuePlaceholder, InputPathPlaceholder, OutputPathPlaceholder,
CommandlineArgumentType = Union[
str,
InputValuePlaceholder,
InputPathPlaceholder,
OutputPathPlaceholder,
'ConcatPlaceholder',
'IfPlaceholder',
]]
]


class ConcatPlaceholder(ModelBase): #Non-standard attr names
Expand Down Expand Up @@ -479,6 +482,7 @@ def __init__(self,
k8s_pod_options: Optional[v1.PodArgoSubset] = None,
):
super().__init__(locals())
#TODO: If component_ref is resolved to component spec, then check that the arguments correspond to the inputs
Ark-kun marked this conversation as resolved.
Show resolved Hide resolved


class GraphSpec(ModelBase):
Expand Down
59 changes: 0 additions & 59 deletions sdk/python/tests/components/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,65 +227,6 @@ def test_load_component_from_url_fail_on_none_arg(self):
def test_load_component_from_text_fail_on_none_arg(self):
comp.load_component_from_text(None)

def test_command_yaml_types(self):
component_text = '''\
implementation:
container:
image: busybox
args:
# Nulls:
- null #A null
- #Also a null
# Strings:
- "" #empty string
- "string"
# Booleans
- true
- True
- false
- FALSE
# Integers
- 0
- 0o7
- 0x3A
- -19
# Floats
- 0.
- -0.0
- .5
- +12e03
- -2E+05
# Infinite floats
- .inf
- -.Inf
- +.INF
- .NAN
'''
task_factory1 = comp.load_component(text=component_text)
task = task_factory1()
self.assertEqual(task.arguments, [
#Nulls are skipped
'',
'string',
'True',
'True',
'False',
'False',
'0',
'0o7',
'58',
'-19',
'0.0',
'-0.0',
'0.5',
'+12e03',
'-2E+05',
'inf',
'-inf',
'inf',
'nan',
])

def test_input_value_resolving(self):
component_text = '''\
inputs:
Expand Down