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 - Renamed container.arguments to container.args #437

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
2 changes: 1 addition & 1 deletion sdk/python/kfp/compiler/_component_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def _generate_pythonop(component_func, target_image, target_component_file=None)
container=ContainerSpec(
image=target_image,
#command=['python3', program_file], #TODO: Include the command line
arguments=[{'value': input_name} for input_name in input_names],
args=[{'value': input_name} for input_name in input_names],
file_outputs={ #TODO: Use proper output arguments (e.g. "{output: output_name}" ) instead of this workaround. Our 1st-party components should not be using the file_outputs workaround.
output_name: output_file,
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/kfp/components/_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def expand_argument_list(argument_list):
return expanded_list

expanded_command = expand_argument_list(container_spec.command)
expanded_args = expand_argument_list(container_spec.arguments)
expanded_args = expand_argument_list(container_spec.args)

#Working around Python's variable scoping. Do not write to variable from global scope as that makes the variable local.

Expand Down
2 changes: 1 addition & 1 deletion sdk/python/kfp/components/_python_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def annotation_to_argument_kind_and_type_name(annotation):
container=ContainerSpec(
image=base_image,
command=['python3', '-c', full_source],
arguments=arguments,
args=arguments,
)
)
)
Expand Down
12 changes: 6 additions & 6 deletions sdk/python/kfp/components/_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ class OutputSpec(InputOrOutputSpec):


class ContainerSpec:
def __init__(self, image:str, command:List=None, arguments:List=None, file_outputs:Mapping[str,str]=None):
def __init__(self, image:str, command:List=None, args:List=None, file_outputs:Mapping[str,str]=None):
if not isinstance(image, str):
raise ValueError('image must be a string')
self.image = image
self.command = command
self.arguments = arguments
self.args = args
self.file_outputs = file_outputs

@staticmethod
Expand All @@ -129,8 +129,8 @@ def from_struct(spec_dict:Mapping):

if 'command' in spec_dict:
container_spec.command = list(spec_dict.pop('command'))
if 'arguments' in spec_dict:
container_spec.arguments = list(spec_dict.pop('arguments'))
if 'args' in spec_dict:
container_spec.args = list(spec_dict.pop('args'))
if 'fileOutputs' in spec_dict:
container_spec.file_outputs = dict(spec_dict.pop('fileOutputs'))

Expand All @@ -145,8 +145,8 @@ def to_struct(self):
struct['image'] = self.image
if self.command:
struct['command'] = self.command
if self.arguments:
struct['arguments'] = self.arguments
if self.args:
struct['args'] = self.args
if self.file_outputs:
struct['fileOutputs'] = self.file_outputs

Expand Down
28 changes: 14 additions & 14 deletions sdk/python/tests/components/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ def test_fail_on_unknown_value_argument(self):
implementation:
container:
image: busybox
arguments:
- [value, Wrong]
args:
- {value: Wrong}
'''
task_factory1 = comp.load_component_from_text(component_text)

Expand Down Expand Up @@ -231,7 +231,7 @@ def test_command_yaml_types(self):
implementation:
container:
image: busybox
arguments:
args:
# Nulls:
- null #A null
- #Also a null
Expand Down Expand Up @@ -292,7 +292,7 @@ def test_input_value_resolving(self):
implementation:
container:
image: busybox
arguments:
args:
- --data
- value: Data
'''
Expand All @@ -308,7 +308,7 @@ def test_output_resolving(self):
implementation:
container:
image: busybox
arguments:
args:
- --output-data
- output: Data
'''
Expand All @@ -324,7 +324,7 @@ def test_automatic_output_resolving(self):
implementation:
container:
image: busybox
arguments:
args:
- --output-data
- {output: Data}
'''
Expand Down Expand Up @@ -396,7 +396,7 @@ def test_command_concat(self):
implementation:
container:
image: busybox
arguments:
args:
- concat: [{value: In1}, {value: In2}]
'''
task_factory1 = comp.load_component(text=component_text)
Expand All @@ -409,7 +409,7 @@ def test_command_if_boolean_true_then_else(self):
implementation:
container:
image: busybox
arguments:
args:
- if:
cond: true
then: --true-arg
Expand All @@ -424,7 +424,7 @@ def test_command_if_boolean_false_then_else(self):
implementation:
container:
image: busybox
arguments:
args:
- if:
cond: false
then: --true-arg
Expand All @@ -439,7 +439,7 @@ def test_command_if_true_string_then_else(self):
implementation:
container:
image: busybox
arguments:
args:
- if:
cond: 'true'
then: --true-arg
Expand All @@ -454,7 +454,7 @@ def test_command_if_false_string_then_else(self):
implementation:
container:
image: busybox
arguments:
args:
- if:
cond: 'false'
then: --true-arg
Expand All @@ -472,7 +472,7 @@ def test_command_if_is_present_then(self):
implementation:
container:
image: busybox
arguments:
args:
- if:
cond: {isPresent: In}
then: [--in, {value: In}]
Expand All @@ -493,7 +493,7 @@ def test_command_if_is_present_then_else(self):
implementation:
container:
image: busybox
arguments:
args:
- if:
cond: {isPresent: In}
then: [--in, {value: In}]
Expand All @@ -517,7 +517,7 @@ def test_command_if_input_value_then(self):
implementation:
container:
image: busybox
arguments:
args:
- if:
cond: {value: Do test}
then: [--test-data, {value: Test data}, --test-param1, {value: Test parameter 1}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ implementation:

import fire
fire.Fire(add_wrapper)
arguments:
args:
- {value: a}
- {value: b}
- {output: Output}