Skip to content

Commit

Permalink
SDK/Client - Supporting pipeline packages with multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
Ark-kun committed Apr 23, 2019
1 parent 4e41128 commit b4d9678
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions sdk/python/kfp/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,12 @@ def _extract_pipeline_yaml(self, package_file):
if len(all_yaml_files) == 0:
raise ValueError('Invalid package. Missing pipeline yaml file in the package.')

if len(all_yaml_files) > 1:
raise ValueError('Invalid package. Multiple yaml files in the package.')
pipeline_file = all_yaml_files[0]
if 'pipeline.yaml' in all_yaml_files:
pipeline_file = 'pipeline.yaml'
else:
if len(all_yaml_files) > 1:
raise ValueError('Invalid package. Multiple yaml files in the package and no pipeline.yaml file.')

with tar.extractfile(all_yaml_files[0]) as f:
return yaml.load(f)
Expand All @@ -186,8 +190,12 @@ def _extract_pipeline_yaml(self, package_file):
if len(all_yaml_files) == 0:
raise ValueError('Invalid package. Missing pipeline yaml file in the package.')

if len(all_yaml_files) > 1:
raise ValueError('Invalid package. Multiple yaml files in the package.')
pipeline_file = all_yaml_files[0]
if 'pipeline.yaml' in all_yaml_files:
pipeline_file = 'pipeline.yaml'
else:
if len(all_yaml_files) > 1:
raise ValueError('Invalid package. Missing pipeline yaml file in the package and no pipeline.yaml file.')

filename = zip.extract(all_yaml_files[0])
with open(filename, 'r') as f:
Expand Down

0 comments on commit b4d9678

Please sign in to comment.