Skip to content

Commit

Permalink
Added the component name to the docstring (#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ark-kun authored and k8s-ci-robot committed Mar 20, 2019
1 parent dcdff39 commit 665d088
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions sdk/python/kfp/components/_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,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 @@ -33,7 +33,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 @@ -62,7 +62,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

0 comments on commit 665d088

Please sign in to comment.