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

Added the component name to the docstring #976

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: 2 additions & 0 deletions sdk/python/kfp/components/_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ def _try_get_object_by_name(obj_name):
def _create_task_factory_from_component_spec(component_spec:ComponentSpec, component_filename=None, component_ref: ComponentReference = None):
name = component_spec.name or _default_component_name
description = component_spec.description
if component_spec.name:
description = component_spec.name + '\n' + description

inputs_list = component_spec.inputs or [] #List[InputSpec]
input_names = [input.name for input in inputs_list]
Expand Down
4 changes: 2 additions & 2 deletions sdk/python/tests/components/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _test_load_component_from_file(self, component_path: str):
task1 = task_factory1(arg1, arg2)

self.assertEqual(task1.human_name, 'Add')
self.assertEqual(task_factory1.__doc__.strip(), 'Returns sum of two arguments')
self.assertEqual(task_factory1.__doc__.strip(), 'Add\nReturns sum of two arguments')
self.assertEqual(task1.image, 'python:3.5')
self.assertEqual(task1.arguments[0], str(arg1))
self.assertEqual(task1.arguments[1], str(arg2))
Expand Down Expand Up @@ -60,7 +60,7 @@ def test_load_component_from_url(self):
component_text = resp.content
component_dict = load_yaml(component_text)
task_factory1 = comp.load_component_from_url(url)
assert task_factory1.__doc__ == component_dict['description']
assert task_factory1.__doc__ == component_dict['name'] + '\n' + component_dict['description']

arg1 = 3
arg2 = 5
Expand Down