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 - Stop adding empty descriptions and inputs #1969

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
11 changes: 5 additions & 6 deletions sdk/python/kfp/dsl/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ def _extract_component_metadata(func):
arg_default = arg_default.value
if arg in annotations:
arg_type = _annotation_to_typemeta(annotations[arg])
inputs.append(ParameterMeta(name=arg, description='', param_type=arg_type, default=arg_default))
inputs.append(ParameterMeta(name=arg, param_type=arg_type, default=arg_default))
# Outputs
outputs = []
if 'return' in annotations:
for output in annotations['return']:
arg_type = _annotation_to_typemeta(annotations['return'][output])
outputs.append(ParameterMeta(name=output, description='', param_type=arg_type))
outputs.append(ParameterMeta(name=output, param_type=arg_type))

#TODO: add descriptions to the metadata
#docstring parser:
Expand All @@ -172,9 +172,8 @@ def _extract_component_metadata(func):
# Construct the ComponentMeta
return ComponentMeta(
name=func.__name__,
description='',
inputs=inputs,
outputs=outputs,
inputs=inputs if inputs else None,
outputs=outputs if outputs else None,
)


Expand Down Expand Up @@ -218,7 +217,7 @@ def _extract_pipeline_metadata(func):
# In case the property value for the schema validator is a string instead of a dict.
schema_object = json.loads(schema_object)
validate(instance=arg_default, schema=schema_object)
pipeline_meta.inputs.append(ParameterMeta(name=arg, description='', param_type=arg_type, default=arg_default))
pipeline_meta.inputs.append(ParameterMeta(name=arg, param_type=arg_type, default=arg_default))

#TODO: add descriptions to the metadata
#docstring parser:
Expand Down
4 changes: 2 additions & 2 deletions sdk/python/tests/compiler/compiler_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def op():
image='image'
)

@dsl.pipeline(name='Pipeline', description='')
@dsl.pipeline(name='Pipeline')
def pipeline():
task1 = op()
task2 = op().after(task1)
Expand Down Expand Up @@ -625,7 +625,7 @@ def some_op():
command=['sleep 1'],
)

@dsl.pipeline(name='some_pipeline', description='')
@dsl.pipeline(name='some_pipeline')
def some_pipeline():
task1 = some_op()
task2 = some_op()
Expand Down
10 changes: 5 additions & 5 deletions sdk/python/tests/dsl/component_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ def componentA(a: {'ArtifactA': {'file_type': 'csv'}}, b: Integer() = 12, c: {'A

containerOp = componentA(1,2,c=3)

golden_meta = ComponentMeta(name='componentA', description='')
golden_meta.inputs.append(ParameterMeta(name='a', description='', param_type={'ArtifactA': {'file_type': 'csv'}}))
golden_meta.inputs.append(ParameterMeta(name='b', description='', param_type={'Integer': {'openapi_schema_validator': {"type": "integer"}}}, default=12))
golden_meta.inputs.append(ParameterMeta(name='c', description='', param_type={'ArtifactB': {'path_type':'file', 'file_type': 'tsv'}}, default='gs://hello/world'))
golden_meta.outputs.append(ParameterMeta(name='model', description='', param_type={'Integer': {'openapi_schema_validator': {"type": "integer"}}}))
golden_meta = ComponentMeta(name='componentA')
golden_meta.inputs.append(ParameterMeta(name='a', param_type={'ArtifactA': {'file_type': 'csv'}}))
golden_meta.inputs.append(ParameterMeta(name='b', param_type={'Integer': {'openapi_schema_validator': {"type": "integer"}}}, default=12))
golden_meta.inputs.append(ParameterMeta(name='c', param_type={'ArtifactB': {'path_type':'file', 'file_type': 'tsv'}}, default='gs://hello/world'))
golden_meta.outputs.append(ParameterMeta(name='model', param_type={'Integer': {'openapi_schema_validator': {"type": "integer"}}}))

self.assertEqual(containerOp._metadata, golden_meta)

Expand Down
4 changes: 2 additions & 2 deletions sdk/python/tests/dsl/pipeline_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def my_pipeline1(a: {'Schema': {'file_type': 'csv'}}='good', b: Integer()=12):
pass

golden_meta = PipelineMeta(name='p1', description='description1')
golden_meta.inputs.append(ParameterMeta(name='a', description='', param_type={'Schema': {'file_type': 'csv'}}, default='good'))
golden_meta.inputs.append(ParameterMeta(name='b', description='', param_type={'Integer': {'openapi_schema_validator': {"type": "integer"}}}, default=12))
golden_meta.inputs.append(ParameterMeta(name='a', param_type={'Schema': {'file_type': 'csv'}}, default='good'))
golden_meta.inputs.append(ParameterMeta(name='b', param_type={'Integer': {'openapi_schema_validator': {"type": "integer"}}}, default=12))

pipeline_meta = _extract_pipeline_metadata(my_pipeline1)
self.assertEqual(pipeline_meta, golden_meta)