Skip to content

Commit d99dd9d

Browse files
committed
Set spec.description when compiling to Kubernetes manifests
Signed-off-by: mprahl <[email protected]>
1 parent 794fc67 commit d99dd9d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

sdk/python/kfp/compiler/compiler_test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,8 @@ def simple_pipeline():
10391039
def test_compile_with_kubernetes_manifest_format(self):
10401040
with tempfile.TemporaryDirectory() as tmpdir:
10411041

1042-
@dsl.pipeline(name='my-pipeline')
1042+
@dsl.pipeline(
1043+
name='my-pipeline', description='A simple test pipeline')
10431044
def my_pipeline(input1: str):
10441045
print_op(message=input1)
10451046

@@ -1080,6 +1081,8 @@ def my_pipeline(input1: str):
10801081
pipeline_name)
10811082
self.assertEqual(pipeline_manifest['spec']['displayName'],
10821083
pipeline_display_name)
1084+
self.assertEqual(pipeline_manifest['spec']['description'],
1085+
'A simple test pipeline')
10831086
self.assertEqual(pipeline_manifest['metadata']['namespace'],
10841087
namespace)
10851088

@@ -1091,6 +1094,8 @@ def my_pipeline(input1: str):
10911094
pipeline_version_name)
10921095
self.assertEqual(pipeline_version_manifest['spec']['displayName'],
10931096
pipeline_version_display_name)
1097+
self.assertEqual(pipeline_version_manifest['spec']['description'],
1098+
'A simple test pipeline')
10941099
self.assertEqual(pipeline_version_manifest['spec']['pipelineName'],
10951100
pipeline_name)
10961101
self.assertEqual(pipeline_version_manifest['metadata']['namespace'],

sdk/python/kfp/compiler/pipeline_spec_builder.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,6 +2035,7 @@ def write_pipeline_spec_to_file(
20352035
opts=opts,
20362036
pipeline_spec=pipeline_spec,
20372037
platform_spec=platform_spec,
2038+
pipeline_description=pipeline_description,
20382039
)
20392040
return
20402041

@@ -2077,6 +2078,7 @@ def _write_kubernetes_manifest_to_file(
20772078
opts: KubernetesManifestOptions,
20782079
pipeline_spec: pipeline_spec_pb2.PipelineSpec,
20792080
platform_spec: pipeline_spec_pb2.PlatformSpec,
2081+
pipeline_description: Union[str, None] = None,
20802082
) -> None:
20812083
pipeline_name = opts.pipeline_name
20822084
pipeline_display_name = opts.pipeline_display_name
@@ -2103,6 +2105,8 @@ def _write_kubernetes_manifest_to_file(
21032105
'displayName': pipeline_display_name,
21042106
},
21052107
}
2108+
if pipeline_description:
2109+
pipeline_manifest['spec']['description'] = pipeline_description
21062110
documents.append(pipeline_manifest)
21072111

21082112
# PipelineVersion manifest
@@ -2120,6 +2124,8 @@ def _write_kubernetes_manifest_to_file(
21202124
'platformSpec': platform_spec_dict,
21212125
},
21222126
}
2127+
if pipeline_description:
2128+
pipeline_version_manifest['spec']['description'] = pipeline_description
21232129
documents.append(pipeline_version_manifest)
21242130

21252131
with open(package_path, 'w') as yaml_file:

0 commit comments

Comments
 (0)